aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu.c
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2011-11-10 04:32:25 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2011-11-10 05:40:37 -0500
commit5009065d38c95455bd2d27c2838313e3dd0c5bc7 (patch)
treea957af07e95166bcc014b3f333234fe74cef790e /drivers/iommu/amd_iommu.c
parent1ea6b8f48918282bdca0b32a34095504ee65bab5 (diff)
iommu/core: stop converting bytes to page order back and forth
Express sizes in bytes rather than in page order, to eliminate the size->order->size conversions we have whenever the IOMMU API is calling the low level drivers' map/unmap methods. Adopt all existing drivers. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Cc: David Brown <davidb@codeaurora.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Joerg Roedel <Joerg.Roedel@amd.com> Cc: Stepan Moskovchenko <stepanm@codeaurora.org> Cc: KyongHo Cho <pullip.cho@samsung.com> Cc: Hiroshi DOYU <hdoyu@nvidia.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/amd_iommu.c')
-rw-r--r--drivers/iommu/amd_iommu.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 4ee277a8521a..a3b7072e86e2 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2702,9 +2702,8 @@ static int amd_iommu_attach_device(struct iommu_domain *dom,
2702} 2702}
2703 2703
2704static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova, 2704static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova,
2705 phys_addr_t paddr, int gfp_order, int iommu_prot) 2705 phys_addr_t paddr, size_t page_size, int iommu_prot)
2706{ 2706{
2707 unsigned long page_size = 0x1000UL << gfp_order;
2708 struct protection_domain *domain = dom->priv; 2707 struct protection_domain *domain = dom->priv;
2709 int prot = 0; 2708 int prot = 0;
2710 int ret; 2709 int ret;
@@ -2721,13 +2720,11 @@ static int amd_iommu_map(struct iommu_domain *dom, unsigned long iova,
2721 return ret; 2720 return ret;
2722} 2721}
2723 2722
2724static int amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova, 2723static size_t amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova,
2725 int gfp_order) 2724 size_t page_size)
2726{ 2725{
2727 struct protection_domain *domain = dom->priv; 2726 struct protection_domain *domain = dom->priv;
2728 unsigned long page_size, unmap_size; 2727 size_t unmap_size;
2729
2730 page_size = 0x1000UL << gfp_order;
2731 2728
2732 mutex_lock(&domain->api_lock); 2729 mutex_lock(&domain->api_lock);
2733 unmap_size = iommu_unmap_page(domain, iova, page_size); 2730 unmap_size = iommu_unmap_page(domain, iova, page_size);
@@ -2735,7 +2732,7 @@ static int amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova,
2735 2732
2736 domain_flush_tlb_pde(domain); 2733 domain_flush_tlb_pde(domain);
2737 2734
2738 return get_order(unmap_size); 2735 return unmap_size;
2739} 2736}
2740 2737
2741static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom, 2738static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,