diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_prof.c b/drivers/gpu/nvgpu/os/linux/ioctl_prof.c index 1b2fdf05e..7c21a4161 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_prof.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_prof.c @@ -470,6 +470,7 @@ static int nvgpu_prof_ioctl_alloc_pma_stream(struct nvgpu_profiler_object_priv * prof->pma_bytes_available_buffer_va); args->pma_buffer_va = pma_buffer_offset; + args->pma_channel_id = 0u; /* Decrement pma_dmabuf ref count as we already mapped it. */ dma_buf_put(pma_dmabuf); @@ -515,7 +516,8 @@ static void nvgpu_prof_free_pma_stream_priv_data(struct nvgpu_profiler_object_pr prof->pma_bytes_available_buffer_cpuva = NULL; } -static int nvgpu_prof_ioctl_free_pma_stream(struct nvgpu_profiler_object_priv *priv) +static int nvgpu_prof_ioctl_free_pma_stream(struct nvgpu_profiler_object_priv *priv, + struct nvgpu_profiler_free_pma_stream_args *args) { struct nvgpu_profiler_object *prof = priv->prof; struct gk20a *g = prof->g; @@ -942,7 +944,8 @@ long nvgpu_prof_fops_ioctl(struct file *filp, unsigned int cmd, break; case NVGPU_PROFILER_IOCTL_FREE_PMA_STREAM: - err = nvgpu_prof_ioctl_free_pma_stream(prof_priv); + err = nvgpu_prof_ioctl_free_pma_stream(prof_priv, + (struct nvgpu_profiler_free_pma_stream_args *)buf); break; case NVGPU_PROFILER_IOCTL_EXEC_REG_OPS: diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index e8434f83e..d9d640be2 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -832,7 +832,14 @@ struct nvgpu_profiler_alloc_pma_stream_args { #define NVGPU_PROFILER_ALLOC_PMA_STREAM_ARG_FLAG_CTXSW (1 << 0) __u32 flags; - __u32 reserved[3]; + __u32 pma_channel_id; /* out: PMA hardware stream id */ + + __u32 reserved[2]; +}; + +struct nvgpu_profiler_free_pma_stream_args { + __u32 pma_channel_id; /* in: PMA hardware stream id */ + __u32 reserved[2]; }; struct nvgpu_profiler_pma_stream_update_get_put_args { @@ -851,7 +858,9 @@ struct nvgpu_profiler_pma_stream_update_get_put_args { #define NVGPU_PROFILER_PMA_STREAM_UPDATE_GET_PUT_ARG_FLAG_OVERFLOW_TRIGGERED (1 << 3) __u32 flags; - __u32 reserved[3]; + __u32 pma_channel_id; /* in: PMA channel index */ + + __u32 reserved[2]; }; /* @@ -955,7 +964,7 @@ struct nvgpu_profiler_vab_flush_state_args { #define NVGPU_PROFILER_IOCTL_ALLOC_PMA_STREAM \ _IOWR(NVGPU_PROFILER_IOCTL_MAGIC, 4, struct nvgpu_profiler_alloc_pma_stream_args) #define NVGPU_PROFILER_IOCTL_FREE_PMA_STREAM \ - _IO(NVGPU_PROFILER_IOCTL_MAGIC, 5) + _IOW(NVGPU_PROFILER_IOCTL_MAGIC, 5, struct nvgpu_profiler_free_pma_stream_args) #define NVGPU_PROFILER_IOCTL_BIND_PM_RESOURCES \ _IO(NVGPU_PROFILER_IOCTL_MAGIC, 6) #define NVGPU_PROFILER_IOCTL_UNBIND_PM_RESOURCES \