From: ljf Date: Tue, 22 Apr 2014 08:59:21 +0000 (+0800) Subject: rk3288: add a interface for user space to query iommu status X-Git-Tag: firefly_0821_release~5469 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3fc20e7896627a42eddfaddb5887d2065eaad11a;p=firefly-linux-kernel-4.4.55.git rk3288: add a interface for user space to query iommu status --- diff --git a/arch/arm/mach-rockchip/vcodec_service.c b/arch/arm/mach-rockchip/vcodec_service.c index 87bd3a1af479..c550e07be351 100755 --- a/arch/arm/mach-rockchip/vcodec_service.c +++ b/arch/arm/mach-rockchip/vcodec_service.c @@ -43,8 +43,8 @@ #include #endif -#if defined(CONFIG_ROCKCHIP_IOMMU) -//#define CONFIG_VCODEC_MMU +#if defined(CONFIG_ROCKCHIP_IOMMU) & defined(CONFIG_ION_ROCKCHIP) +#define CONFIG_VCODEC_MMU #endif #ifdef CONFIG_VCODEC_MMU @@ -304,7 +304,7 @@ typedef struct vpu_service_info { struct dentry *debugfs_file_regs; u32 irq_status; -#if defined(CONFIG_ION_ROCKCHIP) +#if defined(CONFIG_VCODEC_MMU) struct ion_client * ion_client; #endif @@ -1227,6 +1227,18 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd, unsigned long mutex_unlock(&pservice->lock); break; } + case VPU_IOC_PROBE_IOMMU_STATUS: { +#if defined(CONFIG_VCODEC_MMU) + int iommu_enable = 1; +#else + int iommu_enable = 0; +#endif + if (copy_to_user((void __user *)arg, &iommu_enable, sizeof(int))) { + pr_err("error: VPU_IOC_PROBE_IOMMU_STATUS copy_to_user failed\n"); + return -EFAULT; + } + break; + } default : { pr_err("error: unknow vpu service ioctl cmd %x\n", cmd); break; diff --git a/arch/arm/mach-rockchip/vcodec_service.h b/arch/arm/mach-rockchip/vcodec_service.h index 1148dbe9628d..1b0ca2a3be53 100644 --- a/arch/arm/mach-rockchip/vcodec_service.h +++ b/arch/arm/mach-rockchip/vcodec_service.h @@ -33,6 +33,8 @@ #define VPU_IOC_SET_REG _IOW(VPU_IOC_MAGIC, 3, unsigned long) #define VPU_IOC_GET_REG _IOW(VPU_IOC_MAGIC, 4, unsigned long) +#define VPU_IOC_PROBE_IOMMU_STATUS _IOR(VPU_IOC_MAGIC, 5, unsigned long) + typedef enum VPU_CLIENT_TYPE { VPU_ENC = 0x0, VPU_DEC = 0x1,