aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/omap-iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2011-12-14 06:41:31 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2011-12-14 06:52:09 -0500
commita06ec394c9318e2ee9209ca3c106d3fa6fbfeb00 (patch)
treef94f71b5a542b42ecea60e6f903e3f19e5b2eada /drivers/iommu/omap-iommu.c
parent175d6146738b3d04e1adcaa4a971a3b2b0dbd8af (diff)
parent6c274d1cd5b3aa0834e9f0c3f58038f42278ff8c (diff)
Merge branch 'iommu/page-sizes' into x86/amd
Conflicts: drivers/iommu/amd_iommu.c
Diffstat (limited to 'drivers/iommu/omap-iommu.c')
-rw-r--r--drivers/iommu/omap-iommu.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 8f32b2bf7587..08cf7ec5b4a5 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -33,6 +33,9 @@
33 (__i < (n)) && (cr = __iotlb_read_cr((obj), __i), true); \ 33 (__i < (n)) && (cr = __iotlb_read_cr((obj), __i), true); \
34 __i++) 34 __i++)
35 35
36/* bitmap of the page sizes currently supported */
37#define OMAP_IOMMU_PGSIZES (SZ_4K | SZ_64K | SZ_1M | SZ_16M)
38
36/** 39/**
37 * struct omap_iommu_domain - omap iommu domain 40 * struct omap_iommu_domain - omap iommu domain
38 * @pgtable: the page table 41 * @pgtable: the page table
@@ -1019,12 +1022,11 @@ static void iopte_cachep_ctor(void *iopte)
1019} 1022}
1020 1023
1021static int omap_iommu_map(struct iommu_domain *domain, unsigned long da, 1024static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
1022 phys_addr_t pa, int order, int prot) 1025 phys_addr_t pa, size_t bytes, int prot)
1023{ 1026{
1024 struct omap_iommu_domain *omap_domain = domain->priv; 1027 struct omap_iommu_domain *omap_domain = domain->priv;
1025 struct omap_iommu *oiommu = omap_domain->iommu_dev; 1028 struct omap_iommu *oiommu = omap_domain->iommu_dev;
1026 struct device *dev = oiommu->dev; 1029 struct device *dev = oiommu->dev;
1027 size_t bytes = PAGE_SIZE << order;
1028 struct iotlb_entry e; 1030 struct iotlb_entry e;
1029 int omap_pgsz; 1031 int omap_pgsz;
1030 u32 ret, flags; 1032 u32 ret, flags;
@@ -1049,19 +1051,16 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
1049 return ret; 1051 return ret;
1050} 1052}
1051 1053
1052static int omap_iommu_unmap(struct iommu_domain *domain, unsigned long da, 1054static size_t omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
1053 int order) 1055 size_t size)
1054{ 1056{
1055 struct omap_iommu_domain *omap_domain = domain->priv; 1057 struct omap_iommu_domain *omap_domain = domain->priv;
1056 struct omap_iommu *oiommu = omap_domain->iommu_dev; 1058 struct omap_iommu *oiommu = omap_domain->iommu_dev;
1057 struct device *dev = oiommu->dev; 1059 struct device *dev = oiommu->dev;
1058 size_t unmap_size;
1059
1060 dev_dbg(dev, "unmapping da 0x%lx order %d\n", da, order);
1061 1060
1062 unmap_size = iopgtable_clear_entry(oiommu, da); 1061 dev_dbg(dev, "unmapping da 0x%lx size %u\n", da, size);
1063 1062
1064 return unmap_size ? get_order(unmap_size) : -EINVAL; 1063 return iopgtable_clear_entry(oiommu, da);
1065} 1064}
1066 1065
1067static int 1066static int
@@ -1211,6 +1210,7 @@ static struct iommu_ops omap_iommu_ops = {
1211 .unmap = omap_iommu_unmap, 1210 .unmap = omap_iommu_unmap,
1212 .iova_to_phys = omap_iommu_iova_to_phys, 1211 .iova_to_phys = omap_iommu_iova_to_phys,
1213 .domain_has_cap = omap_iommu_domain_has_cap, 1212 .domain_has_cap = omap_iommu_domain_has_cap,
1213 .pgsize_bitmap = OMAP_IOMMU_PGSIZES,
1214}; 1214};
1215 1215
1216static int __init omap_iommu_init(void) 1216static int __init omap_iommu_init(void)