aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBorislav Petkov <bp@amd64.org>2010-03-12 09:43:03 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-12 18:02:45 -0400
commitcecce8c45585602e29690a3c93889d1a052d0a7a (patch)
tree87dbdd17618c8ab2702516f4f7469a5c1fdfa42e /arch
parentd04fe16c31384a00562f7f9ca0cf78641a510ceb (diff)
x86, k8 nb: Fix boot crash: enable k8_northbridges unconditionally on AMD systems
commit 0e152cd7c16832bd5cadee0c2e41d9959bc9b6f9 upstream. de957628ce7c84764ff41331111036b3ae5bad0f changed setting of the x86_init.iommu.iommu_init function ptr only when GART IOMMU is found. One side effect of it is that num_k8_northbridges is not initialized anymore if not explicitly called. This resulted in uninitialized pointers in <arch/x86/kernel/cpu/intel_cacheinfo.c:amd_calc_l3_indices()>, for example, which uses the num_k8_northbridges thing through node_to_k8_nb_misc(). Fix that through an initcall that runs right after the PCI subsystem and does all the scanning. Then, remove initialization in gart_iommu_init() which is a rootfs_initcall and we're running before that. What is more, since num_k8_northbridges is being used in other places beside GART IOMMU, include it whenever we add AMD CPU support. The previous dependency chain in kconfig contained K8_NB depends on AGP_AMD64|GART_IOMMU which was clearly incorrect. The more natural way in terms of hardware dependency should be AGP_AMD64|GART_IOMMU depends on K8_NB depends on CPU_SUP_AMD && PCI. Make it so Number One! Signed-off-by: Borislav Petkov <borislav.petkov@amd.com> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Joerg Roedel <joerg.roedel@amd.com> LKML-Reference: <20100312144303.GA29262@aftab> Signed-off-by: Ingo Molnar <mingo@elte.hu> Tested-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/Kconfig4
-rw-r--r--arch/x86/kernel/k8.c14
-rw-r--r--arch/x86/kernel/pci-gart_64.c2
3 files changed, 17 insertions, 3 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index eb4092568f9e..ddb52b8d38a7 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -627,7 +627,7 @@ config GART_IOMMU
627 bool "GART IOMMU support" if EMBEDDED 627 bool "GART IOMMU support" if EMBEDDED
628 default y 628 default y
629 select SWIOTLB 629 select SWIOTLB
630 depends on X86_64 && PCI 630 depends on X86_64 && PCI && K8_NB
631 ---help--- 631 ---help---
632 Support for full DMA access of devices with 32bit memory access only 632 Support for full DMA access of devices with 32bit memory access only
633 on systems with more than 3GB. This is usually needed for USB, 633 on systems with more than 3GB. This is usually needed for USB,
@@ -2026,7 +2026,7 @@ endif # X86_32
2026 2026
2027config K8_NB 2027config K8_NB
2028 def_bool y 2028 def_bool y
2029 depends on AGP_AMD64 || (X86_64 && (GART_IOMMU || (PCI && NUMA))) 2029 depends on CPU_SUP_AMD && PCI
2030 2030
2031source "drivers/pcmcia/Kconfig" 2031source "drivers/pcmcia/Kconfig"
2032 2032
diff --git a/arch/x86/kernel/k8.c b/arch/x86/kernel/k8.c
index cbc4332a77b2..9b895464dd03 100644
--- a/arch/x86/kernel/k8.c
+++ b/arch/x86/kernel/k8.c
@@ -121,3 +121,17 @@ void k8_flush_garts(void)
121} 121}
122EXPORT_SYMBOL_GPL(k8_flush_garts); 122EXPORT_SYMBOL_GPL(k8_flush_garts);
123 123
124static __init int init_k8_nbs(void)
125{
126 int err = 0;
127
128 err = cache_k8_northbridges();
129
130 if (err < 0)
131 printk(KERN_NOTICE "K8 NB: Cannot enumerate AMD northbridges.\n");
132
133 return err;
134}
135
136/* This has to go after the PCI subsystem */
137fs_initcall(init_k8_nbs);
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 4f41b29fde98..0ae24d9b44b3 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -738,7 +738,7 @@ int __init gart_iommu_init(void)
738 unsigned long scratch; 738 unsigned long scratch;
739 long i; 739 long i;
740 740
741 if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0) 741 if (num_k8_northbridges == 0)
742 return 0; 742 return 0;
743 743
744#ifndef CONFIG_AGP_AMD64 744#ifndef CONFIG_AGP_AMD64