]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
x86: fix: do not run code in amd_bus.c on non-AMD CPUs
authorRobert Richter <robert.richter@amd.com>
Fri, 22 Aug 2008 18:23:37 +0000 (20:23 +0200)
committerIngo Molnar <mingo@elte.hu>
Sat, 23 Aug 2008 15:39:30 +0000 (17:39 +0200)
Jan Beulich wrote:

> Even worse - this would even try to access the MSR on non-AMD CPUs
> (currently probably prevented just by the fact that only AMD ones use
> family values of 0x10 or higher).

This patch adds cpu vendor check to the postcore_initcalls.

Reported-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/pci/amd_bus.c

index dbf5323697110709fb365c534e5a26ad1c3ec5f5..4a6f1a6a3aa95e3d30e1d5555628bfe3fb6a2a63 100644 (file)
@@ -555,9 +555,11 @@ static int __init early_fill_mp_bus_info(void)
        return 0;
 }
 
-postcore_initcall(early_fill_mp_bus_info);
+#else  /* !CONFIG_X86_64 */
 
-#endif
+static int __init early_fill_mp_bus_info(void) { return 0; }
+
+#endif /* !CONFIG_X86_64 */
 
 /* common 32/64 bit code */
 
@@ -583,4 +585,15 @@ static int __init enable_pci_io_ecs(void)
        return 0;
 }
 
-postcore_initcall(enable_pci_io_ecs);
+static int __init amd_postcore_init(void)
+{
+       if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
+               return 0;
+
+       early_fill_mp_bus_info();
+       enable_pci_io_ecs();
+
+       return 0;
+}
+
+postcore_initcall(amd_postcore_init);