]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/amd_nb: Clean up early_is_amd_nb()
authorYazen Ghannam <yazen.ghannam@amd.com>
Fri, 6 Dec 2024 16:11:56 +0000 (16:11 +0000)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 8 Jan 2025 09:47:22 +0000 (10:47 +0100)
The check for early_is_amd_nb() is only useful for systems with GART or
the NB_CFG register.

Zen-based systems (both AMD and Hygon) have neither, so return early for
them.

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-4-yazen.ghannam@amd.com
arch/x86/kernel/amd_nb.c

index 37b8244899d895d78f6210fad5ff66d3e0cdef4a..ee20071ced997ba4183ed1c0ff2888de5c25a487 100644 (file)
@@ -385,7 +385,6 @@ static int amd_cache_northbridges(void)
  */
 bool __init early_is_amd_nb(u32 device)
 {
-       const struct pci_device_id *misc_ids = amd_nb_misc_ids;
        const struct pci_device_id *id;
        u32 vendor = device & 0xffff;
 
@@ -393,11 +392,11 @@ bool __init early_is_amd_nb(u32 device)
            boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
                return false;
 
-       if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
-               misc_ids = hygon_nb_misc_ids;
+       if (cpu_feature_enabled(X86_FEATURE_ZEN))
+               return false;
 
        device >>= 16;
-       for (id = misc_ids; id->vendor; id++)
+       for (id = amd_nb_misc_ids; id->vendor; id++)
                if (vendor == id->vendor && device == id->device)
                        return true;
        return false;