[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080929000525E.fujita.tomonori@lab.ntt.co.jp>
Date: Mon, 29 Sep 2008 00:06:36 +0900
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
To: joerg.roedel@....com
Cc: mingo@...e.hu, linux-kernel@...r.kernel.org
Subject: [PATCH] AMD IOMMU: use iommu_device_max_index
This is against tip/iommu.
=
From: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
Subject: [PATCH] AMD IOMMU: use iommu_device_max_index
AMD IOMMU can use iommu_device_max_index() instead of the homegrown
function.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>
---
arch/x86/kernel/amd_iommu.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 2028810..34e4d11 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -480,10 +480,6 @@ static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom,
* efficient allocator.
*
****************************************************************************/
-static unsigned long dma_mask_to_pages(unsigned long mask)
-{
- return PAGE_ALIGN(mask) >> PAGE_SHIFT;
-}
/*
* The address allocator core function.
@@ -496,14 +492,14 @@ static unsigned long dma_ops_alloc_addresses(struct device *dev,
unsigned long align_mask,
u64 dma_mask)
{
- unsigned long limit = dma_mask_to_pages(dma_mask);
+ unsigned long limit;
unsigned long address;
- unsigned long size = dom->aperture_size >> PAGE_SHIFT;
unsigned long boundary_size;
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
PAGE_SIZE) >> PAGE_SHIFT;
- limit = limit < size ? limit : size;
+ limit = iommu_device_max_index(dom->aperture_size >> PAGE_SHIFT, 0,
+ dma_mask >> PAGE_SHIFT);
if (dom->next_bit >= limit) {
dom->next_bit = 0;
--
1.5.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists