mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
video: tegra: host: pin with specific permission
[1] Facilitate pinning of buffer with user requested access
permission
[2] This feature allows to restrict access to buffers shared
with the device.
Jira DLA-2502
Change-Id: I175ad10922480689de57eb832040a7d59b29b9bd
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2209415
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ken Adams <kadams@nvidia.com>
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
9343525fd1
commit
31a4285b17
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user