video: rockchip: rga3: Fix "unknown ioctl cmd" error

Because of the difference in pointer size between 32/64 bit systems.

Update driver version to 1.2.4

Signed-off-by: Yu Qiaowei <cerf.yu@rock-chips.com>
Change-Id: If557cdeb69f1f811eed6cf44419cbb73679dada0
This commit is contained in:
Yu Qiaowei
2022-02-22 15:36:50 +08:00
committed by Tao Huang
parent a87b81ab11
commit 9b0e3b157c
4 changed files with 11 additions and 8 deletions

View File

@@ -209,7 +209,7 @@ struct rga_external_buffer {
};
struct rga_buffer_pool {
struct rga_external_buffer __user *buffers;
uint64_t buffers_ptr;
uint32_t size;
};

View File

@@ -79,7 +79,7 @@
#define DRIVER_MAJOR_VERISON 1
#define DRIVER_MINOR_VERSION 2
#define DRIVER_REVISION_VERSION 3
#define DRIVER_REVISION_VERSION 4
#define DRIVER_VERSION (STR(DRIVER_MAJOR_VERISON) "." STR(DRIVER_MINOR_VERSION) \
"." STR(DRIVER_REVISION_VERSION))

View File

@@ -255,7 +255,7 @@ static long rga_ioctl_import_buffer(unsigned long arg)
return -EFBIG;
}
if (buffer_pool.buffers == NULL) {
if (buffer_pool.buffers_ptr == 0) {
pr_err("Import buffers is NULL!\n");
return -EFAULT;
}
@@ -267,7 +267,8 @@ static long rga_ioctl_import_buffer(unsigned long arg)
return -ENOMEM;
}
if (unlikely(copy_from_user(external_buffer, buffer_pool.buffers,
if (unlikely(copy_from_user(external_buffer,
u64_to_user_ptr(buffer_pool.buffers_ptr),
sizeof(struct rga_external_buffer) * buffer_pool.size))) {
pr_err("rga_buffer_pool external_buffer list copy_from_user failed\n");
ret = -EFAULT;
@@ -286,7 +287,8 @@ static long rga_ioctl_import_buffer(unsigned long arg)
external_buffer[i].handle = ret;
}
if (unlikely(copy_to_user(buffer_pool.buffers, external_buffer,
if (unlikely(copy_to_user(u64_to_user_ptr(buffer_pool.buffers_ptr),
external_buffer,
sizeof(struct rga_external_buffer) * buffer_pool.size))) {
pr_err("rga_buffer_pool external_buffer list copy_to_user failed\n");
ret = -EFAULT;
@@ -319,7 +321,7 @@ static long rga_ioctl_release_buffer(unsigned long arg)
return -EFBIG;
}
if (buffer_pool.buffers == NULL) {
if (buffer_pool.buffers_ptr == 0) {
pr_err("Release buffers is NULL!\n");
return -EFAULT;
}
@@ -331,7 +333,8 @@ static long rga_ioctl_release_buffer(unsigned long arg)
return -ENOMEM;
}
if (unlikely(copy_from_user(external_buffer, buffer_pool.buffers,
if (unlikely(copy_from_user(external_buffer,
u64_to_user_ptr(buffer_pool.buffers_ptr),
sizeof(struct rga_external_buffer) * buffer_pool.size))) {
pr_err("rga_buffer_pool external_buffer list copy_from_user failed\n");
ret = -EFAULT;

View File

@@ -777,7 +777,7 @@ int rga_job_config_by_user_ctx(struct rga_user_ctx_t *user_ctx)
first_config = true;
}
if (unlikely(copy_from_user(cached_cmd, (struct rga_req *)(unsigned long)user_ctx->cmd_ptr,
if (unlikely(copy_from_user(cached_cmd, u64_to_user_ptr(user_ctx->cmd_ptr),
sizeof(struct rga_req) * user_ctx->cmd_num))) {
pr_err("rga_user_ctx cmd list copy_from_user failed\n");
if (first_config)