]> Pileus Git - ~andy/linux/blobdiff - drivers/iommu/omap-iommu.c
Merge branch 'iommu/page-sizes' into x86/amd
[~andy/linux] / drivers / iommu / omap-iommu.c
index 8f32b2bf758777686c4bf9c7a85df3edaf9ac3af..08cf7ec5b4a5f5b00bb65fa665cffe6f4db4c673 100644 (file)
@@ -33,6 +33,9 @@
             (__i < (n)) && (cr = __iotlb_read_cr((obj), __i), true);   \
             __i++)
 
+/* bitmap of the page sizes currently supported */
+#define OMAP_IOMMU_PGSIZES     (SZ_4K | SZ_64K | SZ_1M | SZ_16M)
+
 /**
  * struct omap_iommu_domain - omap iommu domain
  * @pgtable:   the page table
@@ -1019,12 +1022,11 @@ static void iopte_cachep_ctor(void *iopte)
 }
 
 static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
-                        phys_addr_t pa, int order, int prot)
+                        phys_addr_t pa, size_t bytes, int prot)
 {
        struct omap_iommu_domain *omap_domain = domain->priv;
        struct omap_iommu *oiommu = omap_domain->iommu_dev;
        struct device *dev = oiommu->dev;
-       size_t bytes = PAGE_SIZE << order;
        struct iotlb_entry e;
        int omap_pgsz;
        u32 ret, flags;
@@ -1049,19 +1051,16 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
        return ret;
 }
 
-static int omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
-                           int order)
+static size_t omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
+                           size_t size)
 {
        struct omap_iommu_domain *omap_domain = domain->priv;
        struct omap_iommu *oiommu = omap_domain->iommu_dev;
        struct device *dev = oiommu->dev;
-       size_t unmap_size;
-
-       dev_dbg(dev, "unmapping da 0x%lx order %d\n", da, order);
 
-       unmap_size = iopgtable_clear_entry(oiommu, da);
+       dev_dbg(dev, "unmapping da 0x%lx size %u\n", da, size);
 
-       return unmap_size ? get_order(unmap_size) : -EINVAL;
+       return iopgtable_clear_entry(oiommu, da);
 }
 
 static int
@@ -1211,6 +1210,7 @@ static struct iommu_ops omap_iommu_ops = {
        .unmap          = omap_iommu_unmap,
        .iova_to_phys   = omap_iommu_iova_to_phys,
        .domain_has_cap = omap_iommu_domain_has_cap,
+       .pgsize_bitmap  = OMAP_IOMMU_PGSIZES,
 };
 
 static int __init omap_iommu_init(void)