Skip to content

Commit d99e901

Browse files
yhluIngo Molnar
authored andcommitted
x86: gart iommu have direct mapping when agp is present too
move init_memory_mapping() out of init_k8_gatt. for: http://bugzilla.kernel.org/show_bug.cgi?id=11676 2.6.27-rc2 to rc8, apgart fails, iommu=soft works, regression This is needed because we need to map the GART aperture even if the GATT is not initialized. Signed-off-by: Yinghai Lu <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent fec6ed1 commit d99e901

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

arch/x86/kernel/pci-gart_64.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
626626
struct pci_dev *dev;
627627
void *gatt;
628628
int i, error;
629-
unsigned long start_pfn, end_pfn;
630629

631630
printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
632631
aper_size = aper_base = info->aper_size = 0;
@@ -672,12 +671,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
672671
printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",
673672
aper_base, aper_size>>10);
674673

675-
/* need to map that range */
676-
end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
677-
if (end_pfn > max_low_pfn_mapped) {
678-
start_pfn = (aper_base>>PAGE_SHIFT);
679-
init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
680-
}
681674
return 0;
682675

683676
nommu:
@@ -727,7 +720,8 @@ void __init gart_iommu_init(void)
727720
{
728721
struct agp_kern_info info;
729722
unsigned long iommu_start;
730-
unsigned long aper_size;
723+
unsigned long aper_base, aper_size;
724+
unsigned long start_pfn, end_pfn;
731725
unsigned long scratch;
732726
long i;
733727

@@ -765,8 +759,16 @@ void __init gart_iommu_init(void)
765759
return;
766760
}
767761

762+
/* need to map that range */
763+
aper_size = info.aper_size << 20;
764+
aper_base = info.aper_base;
765+
end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
766+
if (end_pfn > max_low_pfn_mapped) {
767+
start_pfn = (aper_base>>PAGE_SHIFT);
768+
init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
769+
}
770+
768771
printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
769-
aper_size = info.aper_size * 1024 * 1024;
770772
iommu_size = check_iommu_size(info.aper_base, aper_size);
771773
iommu_pages = iommu_size >> PAGE_SHIFT;
772774

0 commit comments

Comments
 (0)