x86, mm: use pfn_range_is_mapped() with gart
authorYinghai Lu <yinghai@kernel.org>
Sat, 17 Nov 2012 03:38:50 +0000 (19:38 -0800)
committerH. Peter Anvin <hpa@linux.intel.com>
Sat, 17 Nov 2012 19:59:10 +0000 (11:59 -0800)
We are going to map ram only, so under max_low_pfn_mapped,
between 4g and max_pfn_mapped does not mean mapped at all.

Use pfn_range_is_mapped() directly.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1353123563-3103-14-git-send-email-yinghai@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/kernel/amd_gart_64.c

index e66311200cbd8ae78274e7f3525d9098cec43ffe..b574b295a2f9922c03673f8784cf72c0a743dbf5 100644 (file)
@@ -768,10 +768,9 @@ int __init gart_iommu_init(void)
        aper_base       = info.aper_base;
        end_pfn         = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
 
-       if (end_pfn > max_low_pfn_mapped) {
-               start_pfn = (aper_base>>PAGE_SHIFT);
+       start_pfn = PFN_DOWN(aper_base);
+       if (!pfn_range_is_mapped(start_pfn, end_pfn))
                init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
-       }
 
        pr_info("PCI-DMA: using GART IOMMU.\n");
        iommu_size = check_iommu_size(info.aper_base, aper_size);