aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/pci-gart_64.c
diff options
context:
space:
mode:
authorMark Langsdorf <mark.langsdorf@amd.com>2009-07-05 16:50:52 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-06 03:42:09 -0400
commitfe2245c905631a3a353504fc04388ce3dfaf9d9e (patch)
tree96ad07e4da2ca4fd92188ecdf3d7ebf1e33e3c3d /arch/x86/kernel/pci-gart_64.c
parent83cce2b69eaa4bc7535f98f75b79397baf277470 (diff)
x86: enable GART-IOMMU only after setting up protection methods
The current code to set up the GART as an IOMMU enables GART translations before it removes the aperture from the kernel memory map, sets the GART PTEs to UC, sets up the guard and scratch pages, or does a wbinvd(). This leaves the possibility of cache aliasing open and can cause system crashes. Re-order the code so as to enable the GART translations only after all safeguards are in place and the tlb has been flushed. AMD has tested this patch on both Istanbul systems and 1st generation Opteron systems with APG enabled and seen no adverse effects. Istanbul systems with HT Assist enabled sometimes see MCE errors due to cache artifacts with the unmodified code. Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com> Cc: <stable@kernel.org> Cc: Joerg Roedel <joerg.roedel@amd.com> Cc: akpm@linux-foundation.org Cc: jbarnes@virtuousgeek.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/pci-gart_64.c')
-rw-r--r--arch/x86/kernel/pci-gart_64.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 1e8920d98f7c..cfd9f9063896 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -658,8 +658,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
658 658
659 agp_gatt_table = gatt; 659 agp_gatt_table = gatt;
660 660
661 enable_gart_translations();
662
663 error = sysdev_class_register(&gart_sysdev_class); 661 error = sysdev_class_register(&gart_sysdev_class);
664 if (!error) 662 if (!error)
665 error = sysdev_register(&device_gart); 663 error = sysdev_register(&device_gart);
@@ -816,6 +814,14 @@ void __init gart_iommu_init(void)
816 * the pages as Not-Present: 814 * the pages as Not-Present:
817 */ 815 */
818 wbinvd(); 816 wbinvd();
817
818 /*
819 * Now all caches are flushed and we can safely enable
820 * GART hardware. Doing it early leaves the possibility
821 * of stale cache entries that can lead to GART PTE
822 * errors.
823 */
824 enable_gart_translations();
819 825
820 /* 826 /*
821 * Try to workaround a bug (thanks to BenH): 827 * Try to workaround a bug (thanks to BenH):