diff options
-rw-r--r-- | 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 c19212191c98..3b346c6f5514 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -470,10 +470,6 @@ static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom, | |||
470 | * efficient allocator. | 470 | * efficient allocator. |
471 | * | 471 | * |
472 | ****************************************************************************/ | 472 | ****************************************************************************/ |
473 | static unsigned long dma_mask_to_pages(unsigned long mask) | ||
474 | { | ||
475 | return PAGE_ALIGN(mask) >> PAGE_SHIFT; | ||
476 | } | ||
477 | 473 | ||
478 | /* | 474 | /* |
479 | * The address allocator core function. | 475 | * The address allocator core function. |
@@ -486,14 +482,14 @@ static unsigned long dma_ops_alloc_addresses(struct device *dev, | |||
486 | unsigned long align_mask, | 482 | unsigned long align_mask, |
487 | u64 dma_mask) | 483 | u64 dma_mask) |
488 | { | 484 | { |
489 | unsigned long limit = dma_mask_to_pages(dma_mask); | 485 | unsigned long limit; |
490 | unsigned long address; | 486 | unsigned long address; |
491 | unsigned long size = dom->aperture_size >> PAGE_SHIFT; | ||
492 | unsigned long boundary_size; | 487 | unsigned long boundary_size; |
493 | 488 | ||
494 | boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, | 489 | boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, |
495 | PAGE_SIZE) >> PAGE_SHIFT; | 490 | PAGE_SIZE) >> PAGE_SHIFT; |
496 | limit = limit < size ? limit : size; | 491 | limit = iommu_device_max_index(dom->aperture_size >> PAGE_SHIFT, 0, |
492 | dma_mask >> PAGE_SHIFT); | ||
497 | 493 | ||
498 | if (dom->next_bit >= limit) { | 494 | if (dom->next_bit >= limit) { |
499 | dom->next_bit = 0; | 495 | dom->next_bit = 0; |