diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2011-09-02 13:32:33 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2011-09-05 09:14:37 -0400 |
commit | 5e1b612cb16f446996398bd23b6cd59ea0206938 (patch) | |
tree | 4278a81d31facf01da8d914bcd90e9573824fc32 | |
parent | b4550d415a2e1668822ebf3a12b481548756b4e3 (diff) |
iommu/omap: ->unmap() should return order of unmapped page
Users of the IOMMU API (kvm specifically) assume that iommu_unmap()
returns the order of the unmapped page.
Fix omap_iommu_unmap() to do so and adopt omap-iovmm accordingly.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r-- | drivers/iommu/omap-iommu.c | 13 | ||||
-rw-r--r-- | drivers/iommu/omap-iovmm.c | 2 |
2 files changed, 5 insertions, 10 deletions
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 4311bc32cfa6..bd5f6064c74a 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c | |||
@@ -1081,18 +1081,13 @@ static int omap_iommu_unmap(struct iommu_domain *domain, unsigned long da, | |||
1081 | struct omap_iommu_domain *omap_domain = domain->priv; | 1081 | struct omap_iommu_domain *omap_domain = domain->priv; |
1082 | struct omap_iommu *oiommu = omap_domain->iommu_dev; | 1082 | struct omap_iommu *oiommu = omap_domain->iommu_dev; |
1083 | struct device *dev = oiommu->dev; | 1083 | struct device *dev = oiommu->dev; |
1084 | size_t bytes = PAGE_SIZE << order; | 1084 | size_t unmap_size; |
1085 | size_t ret; | ||
1086 | 1085 | ||
1087 | dev_dbg(dev, "unmapping da 0x%lx size 0x%x\n", da, bytes); | 1086 | dev_dbg(dev, "unmapping da 0x%lx order %d\n", da, order); |
1088 | 1087 | ||
1089 | ret = iopgtable_clear_entry(oiommu, da); | 1088 | unmap_size = iopgtable_clear_entry(oiommu, da); |
1090 | if (ret != bytes) { | ||
1091 | dev_err(dev, "entry @ 0x%lx was %d; not %d\n", da, ret, bytes); | ||
1092 | return -EINVAL; | ||
1093 | } | ||
1094 | 1089 | ||
1095 | return 0; | 1090 | return unmap_size ? get_order(unmap_size) : -EINVAL; |
1096 | } | 1091 | } |
1097 | 1092 | ||
1098 | static int | 1093 | static int |
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index 39bdb92aa96f..e8fdb8830f69 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c | |||
@@ -480,7 +480,7 @@ static void unmap_iovm_area(struct iommu_domain *domain, struct omap_iommu *obj, | |||
480 | order = get_order(bytes); | 480 | order = get_order(bytes); |
481 | 481 | ||
482 | err = iommu_unmap(domain, start, order); | 482 | err = iommu_unmap(domain, start, order); |
483 | if (err) | 483 | if (err < 0) |
484 | break; | 484 | break; |
485 | 485 | ||
486 | dev_dbg(obj->dev, "%s: unmap %08x(%x) %08x\n", | 486 | dev_dbg(obj->dev, "%s: unmap %08x(%x) %08x\n", |