diff --git a/drivers/video/tegra/host/nvdla/nvdla_ioctl.c b/drivers/video/tegra/host/nvdla/nvdla_ioctl.c index 4987ee3b..86f2a721 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_ioctl.c +++ b/drivers/video/tegra/host/nvdla/nvdla_ioctl.c @@ -167,7 +167,7 @@ fail_to_send_fence: static int nvdla_pin(struct nvdla_private *priv, void *arg) { - u32 handles[MAX_NVDLA_PIN_BUFFERS]; + struct nvdla_mem_share_handle handles[MAX_NVDLA_PIN_BUFFERS]; struct dma_buf *dmabufs[MAX_NVDLA_PIN_BUFFERS]; int err = 0; int i = 0; @@ -194,14 +194,14 @@ static int nvdla_pin(struct nvdla_private *priv, void *arg) nvdla_dbg_info(pdev, "num of buffers [%d]", count); if (copy_from_user(handles, (void __user *)buf_list->buffers, - (count * sizeof(u32)))) { + (count * sizeof(struct nvdla_mem_share_handle)))) { err = -EFAULT; goto nvdla_buffer_cpy_err; } /* get the dmabuf pointer from the fd handle */ for (i = 0; i < count; i++) { - dmabufs[i] = dma_buf_get(handles[i]); + dmabufs[i] = dma_buf_get(handles[i].share_id); if (IS_ERR_OR_NULL(dmabufs[i])) { err = -EFAULT; goto fail_to_get_dma_buf; @@ -222,7 +222,7 @@ fail_to_get_val_arg: static int nvdla_unpin(struct nvdla_private *priv, void *arg) { - u32 handles[MAX_NVDLA_PIN_BUFFERS]; + struct nvdla_mem_share_handle handles[MAX_NVDLA_PIN_BUFFERS]; struct dma_buf *dmabufs[MAX_NVDLA_PIN_BUFFERS]; int err = 0; int i = 0; @@ -249,14 +249,14 @@ static int nvdla_unpin(struct nvdla_private *priv, void *arg) nvdla_dbg_info(pdev, "num of buffers [%d]", count); if (copy_from_user(handles, (void __user *)buf_list->buffers, - (count * sizeof(u32)))) { + (count * sizeof(struct nvdla_mem_share_handle)))) { err = -EFAULT; goto nvdla_buffer_cpy_err; } /* get the dmabuf pointer and clean valid ones */ for (i = 0; i < count; i++) { - dmabufs[i] = dma_buf_get(handles[i]); + dmabufs[i] = dma_buf_get(handles[i].share_id); if (IS_ERR_OR_NULL(dmabufs[i])) continue; } diff --git a/include/uapi/linux/nvhost_nvdla_ioctl.h b/include/uapi/linux/nvhost_nvdla_ioctl.h index 3d85c544..ed008012 100644 --- a/include/uapi/linux/nvhost_nvdla_ioctl.h +++ b/include/uapi/linux/nvhost_nvdla_ioctl.h @@ -52,6 +52,21 @@ struct nvdla_ping_args { __u32 out_response; }; +/** + * struct nvdla_mem_share_handle structure for sharing memory identifier + * and its properties + * + * @share_id identifier of handle to be shared + * @offset offset within the shared memory + * @access_flags access with which memory is intended to be shared + * @reserved reserved for future use + **/ +struct nvdla_mem_share_handle { + __u32 share_id; + __u32 offset; + __u32 access_flags; + __u32 reserved; +}; /** * struct nvdla_pin_unpin_args strcture args for buffer pin/unpin