rk3288: add a interface for user space to query iommu status
authorljf <ljf@rock-chips.com>
Tue, 22 Apr 2014 08:59:21 +0000 (16:59 +0800)
committerljf <ljf@rock-chips.com>
Tue, 22 Apr 2014 08:59:21 +0000 (16:59 +0800)
arch/arm/mach-rockchip/vcodec_service.c
arch/arm/mach-rockchip/vcodec_service.h

index 87bd3a1af479387ddb278dd6d5dc1796f992b0a6..c550e07be351fa69170c119ad3a611999e674b9a 100755 (executable)
@@ -43,8 +43,8 @@
 #include <linux/rockchip_ion.h>\r
 #endif\r
 \r
-#if defined(CONFIG_ROCKCHIP_IOMMU)\r
-//#define CONFIG_VCODEC_MMU\r
+#if defined(CONFIG_ROCKCHIP_IOMMU) & defined(CONFIG_ION_ROCKCHIP)\r
+#define CONFIG_VCODEC_MMU\r
 #endif\r
 \r
 #ifdef CONFIG_VCODEC_MMU\r
@@ -304,7 +304,7 @@ typedef struct vpu_service_info {
     struct dentry   *debugfs_file_regs;\r
 \r
     u32 irq_status;\r
-#if defined(CONFIG_ION_ROCKCHIP)       \r
+#if defined(CONFIG_VCODEC_MMU) \r
        struct ion_client * ion_client;\r
 #endif \r
 \r
@@ -1227,6 +1227,18 @@ static long vpu_service_ioctl(struct file *filp, unsigned int cmd, unsigned long
                mutex_unlock(&pservice->lock);\r
                break;\r
        }\r
+       case VPU_IOC_PROBE_IOMMU_STATUS: {\r
+#if defined(CONFIG_VCODEC_MMU)\r
+               int iommu_enable = 1;\r
+#else\r
+               int iommu_enable = 0;\r
+#endif\r
+               if (copy_to_user((void __user *)arg, &iommu_enable, sizeof(int))) {\r
+                       pr_err("error: VPU_IOC_PROBE_IOMMU_STATUS copy_to_user failed\n");\r
+                       return -EFAULT;\r
+               }\r
+               break;\r
+       }\r
        default : {\r
                pr_err("error: unknow vpu service ioctl cmd %x\n", cmd);\r
                break;\r
index 1148dbe9628d9c2d7f14656dc50854878f7d2fbb..1b0ca2a3be530dae7ac7e152c73faf1250b7293d 100644 (file)
@@ -33,6 +33,8 @@
 #define VPU_IOC_SET_REG                     _IOW(VPU_IOC_MAGIC, 3, unsigned long)\r
 #define VPU_IOC_GET_REG                     _IOW(VPU_IOC_MAGIC, 4, unsigned long)\r
 \r
+#define VPU_IOC_PROBE_IOMMU_STATUS          _IOR(VPU_IOC_MAGIC, 5, unsigned long)\r
+\r
 typedef enum VPU_CLIENT_TYPE {\r
     VPU_ENC                 = 0x0,\r
     VPU_DEC                 = 0x1,\r