]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/amd_nb: Restrict init function to AMD-based systems
authorYazen Ghannam <yazen.ghannam@amd.com>
Fri, 6 Dec 2024 16:11:55 +0000 (16:11 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:47:01 +0000 (12:47 +0100)
[ Upstream commit bee9e840609cc67d0a7d82f22a2130fb7a0a766d ]

The code implicitly operates on AMD-based systems by matching on PCI
IDs. However, the use of these IDs is going away.

Add an explicit CPU vendor check instead of relying on PCI IDs.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20241206161210.163701-3-yazen.ghannam@amd.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kernel/amd_nb.c

index 16cd56627574dd19165c75b5dd69f94135f99c52..3dcaeb25ee301b2eedd19170e0384033321c27e2 100644 (file)
@@ -536,6 +536,10 @@ static __init void fix_erratum_688(void)
 
 static __init int init_amd_nbs(void)
 {
+       if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
+           boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
+               return 0;
+
        amd_cache_northbridges();
        amd_cache_gart();