fsicom: updated memory unmap

- add support to unmap the previously mapped memory
- updated the data structure to store the dma pointer in
  user space
- taking dma buf pointer from user space while unmapping

JIRA SS-4006
JIRA SS-4628
Bug 3855033

Change-Id: I8ca71d11076b64af33c32e6e30c7c056828fbf75
Signed-off-by: Rahul Bedarkar <rabedarkar@nvidia.com>
Signed-off-by: Prashant Kumar Shaw <pshaw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2819744
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Prashant Kumar Shaw
2022-12-01 08:05:57 +00:00
committed by mobile promotions
parent f6d27d0561
commit d3d5025a1c
2 changed files with 21 additions and 3 deletions

View File

@@ -153,12 +153,27 @@ static ssize_t device_file_ioctl(
if (copy_to_user((void __user *)&user_input->iova, if (copy_to_user((void __user *)&user_input->iova,
(void *)&dma_addr, sizeof(uint64_t))) (void *)&dma_addr, sizeof(uint64_t)))
return -EACCES; return -EACCES;
if (copy_to_user((void __user *)&user_input->dmabuf,
(void *)&dmabuf, sizeof(uint64_t)))
return -EACCES;
if (copy_to_user((void __user *)&user_input->attach,
(void *)&attach, sizeof(uint64_t)))
return -EACCES;
if (copy_to_user((void __user *)&user_input->sgt,
(void *)&sgt, sizeof(uint64_t)))
return -EACCES;
break; break;
case NVMAP_SMMU_UNMAP: case NVMAP_SMMU_UNMAP:
dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL); if (copy_from_user(&input, (void __user *)arg,
dma_buf_detach(dmabuf, attach); sizeof(struct rw_data)))
dma_buf_put(dmabuf); return -EACCES;
dma_buf_unmap_attachment((struct dma_buf_attachment *)input.attach,
(struct sg_table *) input.sgt, DMA_BIDIRECTIONAL);
dma_buf_detach((struct dma_buf *)input.dmabuf,
(struct dma_buf_attachment *) input.attach);
dma_buf_put((struct dma_buf *)input.dmabuf);
break; break;
case TEGRA_HSP_WRITE: case TEGRA_HSP_WRITE:

View File

@@ -12,6 +12,9 @@ struct rw_data {
uint32_t handle; uint32_t handle;
uint64_t pa; uint64_t pa;
uint64_t iova; uint64_t iova;
uint64_t dmabuf;
uint64_t attach;
uint64_t sgt;
}; };
/*Data type for sending the offset,IOVA and channel Id details to FSI */ /*Data type for sending the offset,IOVA and channel Id details to FSI */