summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/amd_nb.c
diff options
context:
space:
mode:
authorPu Wen <puwen@hygon.cn>2018-09-25 16:45:01 +0200
committerBorislav Petkov <bp@suse.de>2018-09-27 18:28:58 +0200
commitb7a5cb4f220e78490735b2b984ad29b7d8e612a9 (patch)
tree616a5c1b15f70b7b661fd411d3d0e1ef793afa5d /arch/x86/kernel/amd_nb.c
parentx86/alternative: Init ideal_nops for Hygon Dhyana (diff)
downloadlinux-b7a5cb4f220e78490735b2b984ad29b7d8e612a9.tar.xz
linux-b7a5cb4f220e78490735b2b984ad29b7d8e612a9.zip
x86/amd_nb: Check vendor in AMD-only functions
Exit early in functions which are meant to run on AMD only but which get run on different vendor (VMs, etc). [ bp: rewrite commit message. ] Signed-off-by: Pu Wen <puwen@hygon.cn> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: bhelgaas@google.com Cc: tglx@linutronix.de Cc: mingo@redhat.com Cc: hpa@zytor.com Cc: x86@kernel.org Cc: thomas.lendacky@amd.com Cc: helgaas@kernel.org Link: https://lkml.kernel.org/r/487d8078708baedaf63eb00a82251e228b58f1c2.1537885177.git.puwen@hygon.cn
Diffstat (limited to 'arch/x86/kernel/amd_nb.c')
-rw-r--r--arch/x86/kernel/amd_nb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index b481b95bd8f6..b51c6b183a35 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -264,6 +264,10 @@ bool __init early_is_amd_nb(u32 device)
const struct pci_device_id *id;
u32 vendor = device & 0xffff;
+ if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
+ boot_cpu_data.x86_vendor != X86_VENDOR_HYGON)
+ return false;
+
device >>= 16;
for (id = amd_nb_misc_ids; id->vendor; id++)
if (vendor == id->vendor && device == id->device)