aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iommu/msm_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/msm_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/msm_iommu.c')
-rw-r--r--drivers/iommu/msm_iommu.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 5865dd2e28f9..13718d958da8 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -352,7 +352,7 @@ fail:
352} 352}
353 353
354static int msm_iommu_map(struct iommu_domain *domain, unsigned long va, 354static int msm_iommu_map(struct iommu_domain *domain, unsigned long va,
355 phys_addr_t pa, int order, int prot) 355 phys_addr_t pa, size_t len, int prot)
356{ 356{
357 struct msm_priv *priv; 357 struct msm_priv *priv;
358 unsigned long flags; 358 unsigned long flags;
@@ -363,7 +363,6 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long va,
363 unsigned long *sl_pte; 363 unsigned long *sl_pte;
364 unsigned long sl_offset; 364 unsigned long sl_offset;
365 unsigned int pgprot; 365 unsigned int pgprot;
366 size_t len = 0x1000UL << order;
367 int ret = 0, tex, sh; 366 int ret = 0, tex, sh;
368 367
369 spin_lock_irqsave(&msm_iommu_lock, flags); 368 spin_lock_irqsave(&msm_iommu_lock, flags);
@@ -463,8 +462,8 @@ fail:
463 return ret; 462 return ret;
464} 463}
465 464
466static int msm_iommu_unmap(struct iommu_domain *domain, unsigned long va, 465static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long va,
467 int order) 466 size_t len)
468{ 467{
469 struct msm_priv *priv; 468 struct msm_priv *priv;
470 unsigned long flags; 469 unsigned long flags;
@@ -474,7 +473,6 @@ static int msm_iommu_unmap(struct iommu_domain *domain, unsigned long va,
474 unsigned long *sl_table; 473 unsigned long *sl_table;
475 unsigned long *sl_pte; 474 unsigned long *sl_pte;
476 unsigned long sl_offset; 475 unsigned long sl_offset;
477 size_t len = 0x1000UL << order;
478 int i, ret = 0; 476 int i, ret = 0;
479 477
480 spin_lock_irqsave(&msm_iommu_lock, flags); 478 spin_lock_irqsave(&msm_iommu_lock, flags);
@@ -544,15 +542,12 @@ static int msm_iommu_unmap(struct iommu_domain *domain, unsigned long va,
544 542
545 ret = __flush_iotlb(domain); 543 ret = __flush_iotlb(domain);
546 544
547 /*
548 * the IOMMU API requires us to return the order of the unmapped
549 * page (on success).
550 */
551 if (!ret)
552 ret = order;
553fail: 545fail:
554 spin_unlock_irqrestore(&msm_iommu_lock, flags); 546 spin_unlock_irqrestore(&msm_iommu_lock, flags);
555 return ret; 547
548 /* the IOMMU API requires us to return how many bytes were unmapped */
549 len = ret ? 0 : len;
550 return len;
556} 551}
557 552
558static phys_addr_t msm_iommu_iova_to_phys(struct iommu_domain *domain, 553static phys_addr_t msm_iommu_iova_to_phys(struct iommu_domain *domain,