diff options
author | Ruofei Ma <ruofeim@google.com> | 2022-12-07 13:55:15 -0800 |
---|---|---|
committer | Ruofei Ma <ruofeim@google.com> | 2022-12-21 22:23:23 +0000 |
commit | f90c768658bc0f92d2965c754514b633ec5d0107 (patch) | |
tree | 5429bc439296a41b02d68330f4203663cfacfa3d | |
parent | c5a34e25968c800b6e93b18f2d2b2c16b1bed095 (diff) | |
download | gchips-f90c768658bc0f92d2965c754514b633ec5d0107.tar.gz |
Support get padding zeros size
Bug: 254871047
Change-Id: Ic86e575042afa95c6bbf3e5fc456d6f786fa2244
Signed-off-by: Ruofei Ma <ruofeim@google.com>
-rw-r--r-- | bigo.c | 39 | ||||
-rw-r--r-- | include/uapi/linux/bigo.h | 11 |
2 files changed, 50 insertions, 0 deletions
@@ -18,6 +18,7 @@ #include <linux/platform_data/sscoredump.h> #include <linux/soc/samsung/exynos-smc.h> #include <linux/kthread.h> +#include <linux/arm-smccc.h> #include "bigo_io.h" #include "bigo_iommu.h" @@ -40,6 +41,12 @@ #define BIGO_IDLE_TIMEOUT_MS 1000 +#define SMC_DRM_GET_PADDING_SIZE ((unsigned int)(0x8200211E)) + +enum misc_command { + BIGO_GET_PADDING_SIZE, +}; + static int bigo_worker_thread(void *data); static struct sscd_platform_data bigo_sscd_platdata; @@ -491,6 +498,38 @@ static long bigo_unlocked_ioctl(struct file *file, unsigned int cmd, bigo_config_priority(inst, priority); break; } + case BIGO_IOCX_MISC: { + struct bigo_ioc_misc misc; + if (copy_from_user(&misc, user_desc, sizeof(misc))) { + pr_err("Failed to copy from user\n"); + return -EFAULT; + } + switch (misc.cmd) { + case BIGO_GET_PADDING_SIZE: { + struct arm_smccc_res res; + uint64_t iova = (uint64_t)misc.data0; + uint64_t offset = (uint64_t)misc.data1; + int32_t size = (int32_t)misc.data2; + + arm_smccc_smc(SMC_DRM_GET_PADDING_SIZE, iova, offset, size, + 0, 0, 0, 0, &res); + + misc.ret = res.a0; + misc.data0 = res.a1; + + if (copy_to_user(user_desc, &misc, sizeof(misc))) { + pr_err("Failed to copy to user\n"); + rc = -EFAULT; + } + + break; + } + default: + rc = -EINVAL; + break; + } + break; + } case BIGO_IOCX_ABORT: break; default: diff --git a/include/uapi/linux/bigo.h b/include/uapi/linux/bigo.h index d95e445..c9362c2 100644 --- a/include/uapi/linux/bigo.h +++ b/include/uapi/linux/bigo.h @@ -41,6 +41,15 @@ struct bigo_ioc_frmsize { __u32 width; }; +struct bigo_ioc_misc { + __u32 cmd; + __u32 ret; + __u32 data0; + __u32 data1; + __u32 data2; + __u32 data3; +}; + struct bigo_cache_info { __u32 size; __u32 pid; @@ -80,6 +89,7 @@ enum bigo_cmd_id { BIGO_CMD_CONFIG_SECURE, BIGO_CMD_CONFIG_PRIORITY, BIGO_CMD_DMA_SYNC, + BIGO_CMD_MISC, BIGO_CMD_MAXNR, }; /* <END OF HELPERS> */ @@ -96,5 +106,6 @@ enum bigo_cmd_id { #define BIGO_IOCX_CONFIG_SECURE _BIGO_IOW(BIGO_CMD_CONFIG_SECURE, __u32) #define BIGO_IOCX_CONFIG_PRIORITY _BIGO_IOW(BIGO_CMD_CONFIG_PRIORITY, __s32) #define BIGO_IOCX_DMA_SYNC _BIGO_IOW(BIGO_CMD_DMA_SYNC, struct bigo_buf_sync) +#define BIGO_IOCX_MISC _BIGO_IOW(BIGO_CMD_MISC, struct bigo_ioc_misc) #endif /* _UAPI_BIGO_H_ */ |