rockchip:iommu:1,fix build error 2,disable invalid tlb when iovmm_unmap
authorxxm <xxm@rock-chips.com>
Thu, 31 Jul 2014 09:35:15 +0000 (17:35 +0800)
committerxxm <xxm@rock-chips.com>
Thu, 31 Jul 2014 09:35:15 +0000 (17:35 +0800)
drivers/iommu/rockchip-iovmm.c
include/linux/rockchip/iovmm.h
include/linux/rockchip/sysmmu.h

index 52d57436e0a06eb1c8baa53c520debd6bb7696c7..c365f27add4345137f4158f42835ea5ecefc45ad 100755 (executable)
@@ -174,9 +174,9 @@ void iovmm_unmap(struct device *dev, dma_addr_t iova)
        region->start = round_down(region->start, PAGE_SIZE);
 
        unmapped_size = iommu_unmap(vmm->domain, region->start, region->size);
-
+       /*
        rockchip_sysmmu_tlb_invalidate(dev);
-
+       */
        gen_pool_free(vmm->vmm_pool, region->start, region->size);
 
        WARN_ON(unmapped_size != region->size);
index 48e212d4dadcd0e5cc15a0f34ada279908e3c17c..bd302136ed16724b52cd0126cc3ab96da335b4a7 100755 (executable)
@@ -7,9 +7,9 @@
 #ifndef __ASM_PLAT_IOVMM_H
 #define __ASM_PLAT_IOVMM_H
 
-#ifdef CONFIG_ROCKCHIP_IOVMM
 struct scatterlist;
 struct device;
+#ifdef CONFIG_ROCKCHIP_IOVMM
 
 int iovmm_activate(struct device *dev);
 void iovmm_deactivate(struct device *dev);
@@ -62,14 +62,14 @@ struct device *rockchip_get_sysmmu_device_by_compatible(const char *compt);
 
 
 #else
-#define iovmm_activate(dev)            (-ENOSYS)
-#define iovmm_deactivate(dev)          do { } while (0)
-#define iovmm_map(dev, sg, offset, size) (-ENOSYS)
-#define iovmm_unmap(dev, iova)         do { } while (0)
-#define iovmm_map_oto(dev, phys, size) (-ENOSYS)
-#define iovmm_unmap_oto(dev, phys)     do { } while (0)
-#define rockchip_get_sysmmu_device_by_compatible(compt) do { } while (0)
-
+static inline int iovmm_activate(struct device *dev) {return -ENOSYS; }
+static inline void iovmm_deactivate(struct device *dev) { }
+static inline dma_addr_t iovmm_map(struct device *dev, struct scatterlist *sg, off_t offset,
+                                  size_t size) { return -ENOSYS; }
+static inline void iovmm_unmap(struct device *dev, dma_addr_t iova) { }
+static inline int iovmm_map_oto(struct device *dev, phys_addr_t phys, size_t size) {return -ENOSYS; }
+static inline void iovmm_unmap_oto(struct device *dev, phys_addr_t phys) { }
+static inline struct device *rockchip_get_sysmmu_device_by_compatible(const char *compt) {return NULL; }
 #endif /* CONFIG_ROCKCHIP_IOVMM */
 
 #endif /*__ASM_PLAT_IOVMM_H*/
index 771defb187f4855d944df9d6763b016e934f60d8..ab3e0414b2e4bf4f295e85c01e512a08186a2ce8 100755 (executable)
@@ -12,6 +12,7 @@
 #include <linux/list.h>
 #include <linux/atomic.h>
 #include <linux/spinlock.h>
+#include <linux/device.h>
 
 #define IEP_SYSMMU_COMPATIBLE_NAME "iommu,iep_mmu"
 #define VIP_SYSMMU_COMPATIBLE_NAME "iommu,vip_mmu"
@@ -90,20 +91,36 @@ void rockchip_sysmmu_tlb_invalidate(struct device *owner);
 void rockchip_sysmmu_set_fault_handler(struct device *dev,sysmmu_fault_handler_t handler);
 
 #else /* CONFIG_ROCKCHIP_IOMMU */
-#define rockchip_sysmmu_enable(owner, pgd) do { } while (0)
-#define rockchip_sysmmu_disable(owner) do { } while (0)
-#define rockchip_sysmmu_tlb_invalidate(owner) do { } while (0)
-#define rockchip_sysmmu_set_fault_handler(sysmmu, handler) do { } while (0)
+static inline int rockchip_sysmmu_enable(struct device *owner, unsigned long pgd)
+{
+       return -ENOSYS;
+}
+static inline bool rockchip_sysmmu_disable(struct device *owner)
+{
+       return false;
+}
+static inline void rockchip_sysmmu_tlb_invalidate(struct device *owner)
+{
+}
+static inline void rockchip_sysmmu_set_fault_handler(struct device *dev,sysmmu_fault_handler_t handler)
+{
+}
+static inline void rockchip_sysmmu_set_prefbuf(struct device *owner,
+                                              unsigned long base0, unsigned long size0,
+                                              unsigned long base1, unsigned long size1)
+{
+}
 #endif
 
 #ifdef CONFIG_IOMMU_API
-#include <linux/device.h>
 static inline void platform_set_sysmmu(struct device *sysmmu, struct device *dev)
 {
        dev->archdata.iommu = sysmmu;
 }
 #else
-#define platform_set_sysmmu(dev, sysmmu) do { } while (0)
+static inline void platform_set_sysmmu(struct device *sysmmu, struct device *dev)
+{
+}
 #endif
 
 #endif /* _ARM_MACH_RK_SYSMMU_H_ */