Merge branches 'apple/dart', 'arm/smmu', 'iommu/fixes', 'x86/amd', 'x86/vt-d' and...
[sfrench/cifs-2.6.git] / include / linux / io-pgtable.h
index 4d40dfa75b55fed24b101610a6c0fd817add9ab4..86af6f0a00a2a1b5701877a26c5f1749c1fa73c8 100644 (file)
@@ -16,6 +16,7 @@ enum io_pgtable_fmt {
        ARM_V7S,
        ARM_MALI_LPAE,
        AMD_IOMMU_V1,
+       APPLE_DART,
        IO_PGTABLE_NUM_FMTS,
 };
 
@@ -73,10 +74,6 @@ struct io_pgtable_cfg {
         *      to support up to 35 bits PA where the bit32, bit33 and bit34 are
         *      encoded in the bit9, bit4 and bit5 of the PTE respectively.
         *
-        * IO_PGTABLE_QUIRK_NON_STRICT: Skip issuing synchronous leaf TLBIs
-        *      on unmap, for DMA domains using the flush queue mechanism for
-        *      delayed invalidation.
-        *
         * IO_PGTABLE_QUIRK_ARM_TTBR1: (ARM LPAE format) Configure the table
         *      for use in the upper half of a split address space.
         *
@@ -86,7 +83,6 @@ struct io_pgtable_cfg {
        #define IO_PGTABLE_QUIRK_ARM_NS         BIT(0)
        #define IO_PGTABLE_QUIRK_NO_PERMS       BIT(1)
        #define IO_PGTABLE_QUIRK_ARM_MTK_EXT    BIT(3)
-       #define IO_PGTABLE_QUIRK_NON_STRICT     BIT(4)
        #define IO_PGTABLE_QUIRK_ARM_TTBR1      BIT(5)
        #define IO_PGTABLE_QUIRK_ARM_OUTER_WBWA BIT(6)
        unsigned long                   quirks;
@@ -136,6 +132,11 @@ struct io_pgtable_cfg {
                        u64     transtab;
                        u64     memattr;
                } arm_mali_lpae_cfg;
+
+               struct {
+                       u64 ttbr[4];
+                       u32 n_ttbrs;
+               } apple_dart_cfg;
        };
 };
 
@@ -143,7 +144,9 @@ struct io_pgtable_cfg {
  * struct io_pgtable_ops - Page table manipulation API for IOMMU drivers.
  *
  * @map:          Map a physically contiguous memory region.
+ * @map_pages:    Map a physically contiguous range of pages of the same size.
  * @unmap:        Unmap a physically contiguous memory region.
+ * @unmap_pages:  Unmap a range of virtually contiguous pages of the same size.
  * @iova_to_phys: Translate iova to physical address.
  *
  * These functions map directly onto the iommu_ops member functions with
@@ -152,8 +155,14 @@ struct io_pgtable_cfg {
 struct io_pgtable_ops {
        int (*map)(struct io_pgtable_ops *ops, unsigned long iova,
                   phys_addr_t paddr, size_t size, int prot, gfp_t gfp);
+       int (*map_pages)(struct io_pgtable_ops *ops, unsigned long iova,
+                        phys_addr_t paddr, size_t pgsize, size_t pgcount,
+                        int prot, gfp_t gfp, size_t *mapped);
        size_t (*unmap)(struct io_pgtable_ops *ops, unsigned long iova,
                        size_t size, struct iommu_iotlb_gather *gather);
+       size_t (*unmap_pages)(struct io_pgtable_ops *ops, unsigned long iova,
+                             size_t pgsize, size_t pgcount,
+                             struct iommu_iotlb_gather *gather);
        phys_addr_t (*iova_to_phys)(struct io_pgtable_ops *ops,
                                    unsigned long iova);
 };
@@ -246,5 +255,6 @@ extern struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s2_init_fns;
 extern struct io_pgtable_init_fns io_pgtable_arm_v7s_init_fns;
 extern struct io_pgtable_init_fns io_pgtable_arm_mali_lpae_init_fns;
 extern struct io_pgtable_init_fns io_pgtable_amd_iommu_v1_init_fns;
+extern struct io_pgtable_init_fns io_pgtable_apple_dart_init_fns;
 
 #endif /* __IO_PGTABLE_H */