]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
x86, k8 nb: Fix boot crash: enable k8_northbridges unconditionally on AMD systems
authorBorislav Petkov <bp@amd64.org>
Fri, 12 Mar 2010 14:43:03 +0000 (15:43 +0100)
committerIngo Molnar <mingo@elte.hu>
Sat, 13 Mar 2010 07:36:16 +0000 (08:36 +0100)
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>
arch/x86/Kconfig
arch/x86/kernel/k8.c
arch/x86/kernel/pci-gart_64.c
drivers/char/agp/Kconfig

index eb4092568f9e53f737bbf902f26fb4aeeb423bf6..ddb52b8d38a7e13606854c32622439421c6451e5 100644 (file)
@@ -627,7 +627,7 @@ config GART_IOMMU
        bool "GART IOMMU support" if EMBEDDED
        default y
        select SWIOTLB
-       depends on X86_64 && PCI
+       depends on X86_64 && PCI && K8_NB
        ---help---
          Support for full DMA access of devices with 32bit memory access only
          on systems with more than 3GB. This is usually needed for USB,
@@ -2026,7 +2026,7 @@ endif # X86_32
 
 config K8_NB
        def_bool y
-       depends on AGP_AMD64 || (X86_64 && (GART_IOMMU || (PCI && NUMA)))
+       depends on CPU_SUP_AMD && PCI
 
 source "drivers/pcmcia/Kconfig"
 
index cbc4332a77b25927947d18c69f47188465a29d3e..9b895464dd0311f9c0c4619b5cf7e3f5e94dd2de 100644 (file)
@@ -121,3 +121,17 @@ void k8_flush_garts(void)
 }
 EXPORT_SYMBOL_GPL(k8_flush_garts);
 
+static __init int init_k8_nbs(void)
+{
+       int err = 0;
+
+       err = cache_k8_northbridges();
+
+       if (err < 0)
+               printk(KERN_NOTICE "K8 NB: Cannot enumerate AMD northbridges.\n");
+
+       return err;
+}
+
+/* This has to go after the PCI subsystem */
+fs_initcall(init_k8_nbs);
index 34de53b46f8759ad90ec23575cca26828b07093a..f3af115a573a5adbb053eae3a6c6921acf8b41fd 100644 (file)
@@ -735,7 +735,7 @@ int __init gart_iommu_init(void)
        unsigned long scratch;
        long i;
 
-       if (cache_k8_northbridges() < 0 || num_k8_northbridges == 0)
+       if (num_k8_northbridges == 0)
                return 0;
 
 #ifndef CONFIG_AGP_AMD64
index 2fb3a480f6b07e1fdd41c2e2bf9fd02ad06ab4d5..4b66c69eaf5790d104cf653dd48a14e5eb2940bf 100644 (file)
@@ -57,7 +57,7 @@ config AGP_AMD
 
 config AGP_AMD64
        tristate "AMD Opteron/Athlon64 on-CPU GART support"
-       depends on AGP && X86
+       depends on AGP && X86 && K8_NB
        help
          This option gives you AGP support for the GLX component of
          X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.