Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2019-06-15 09:59:01 +0200
committerBorislav Petkov <bp@suse.de>2019-06-15 09:59:06 +0200
commit9641595a3477f3163b3b33af5ec7388f36e34a59 (patch)
tree338425bba474375fd282a95de94b6758dee7d20d
parent6851188d57dee2bcc462520ecdd5424cb685a768 (diff)
x86/amd_nb: Check vendor in AMD-only functions (fate#327735).
-rw-r--r--patches.arch/x86-amd_nb-check-vendor-in-amd-only-functions.patch57
-rw-r--r--series.conf1
2 files changed, 58 insertions, 0 deletions
diff --git a/patches.arch/x86-amd_nb-check-vendor-in-amd-only-functions.patch b/patches.arch/x86-amd_nb-check-vendor-in-amd-only-functions.patch
new file mode 100644
index 0000000000..da871463ab
--- /dev/null
+++ b/patches.arch/x86-amd_nb-check-vendor-in-amd-only-functions.patch
@@ -0,0 +1,57 @@
+From: Pu Wen <puwen@hygon.cn>
+Date: Tue, 25 Sep 2018 22:45:01 +0800
+Subject: x86/amd_nb: Check vendor in AMD-only functions
+Git-commit: b7a5cb4f220e78490735b2b984ad29b7d8e612a9
+Patch-mainline: v4.20-rc1
+References: fate#327735
+
+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
+---
+ arch/x86/include/asm/amd_nb.h | 3 +++
+ arch/x86/kernel/amd_nb.c | 4 ++++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h
+index fddb6d26239f..1ae4e5791afa 100644
+--- a/arch/x86/include/asm/amd_nb.h
++++ b/arch/x86/include/asm/amd_nb.h
+@@ -103,6 +103,9 @@ static inline u16 amd_pci_dev_to_node_id(struct pci_dev *pdev)
+
+ static inline bool amd_gart_present(void)
+ {
++ if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
++ return false;
++
+ /* GART present only on Fam15h, upto model 0fh */
+ if (boot_cpu_data.x86 == 0xf || boot_cpu_data.x86 == 0x10 ||
+ (boot_cpu_data.x86 == 0x15 && boot_cpu_data.x86_model < 0x10))
+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)
+
diff --git a/series.conf b/series.conf
index 1c08c66ff6..8d7eac7c3f 100644
--- a/series.conf
+++ b/series.conf
@@ -19536,6 +19536,7 @@
patches.arch/x86-smpboot-do-not-use-bsp-init-delay-and-mwait-to-idle-on-dhyana.patch
patches.arch/x86-events-add-hygon-dhyana-support-to-pmu-infrastructure.patch
patches.arch/x86-alternative-init-ideal_nops-for-hygon-dhyana.patch
+ patches.arch/x86-amd_nb-check-vendor-in-amd-only-functions.patch
patches.fixes/0001-x86-xen-Fix-boot-loader-version-reported-for-PVH-gue.patch
patches.arch/x86-kexec-correct-kexec_backup_src_end-off-by-one-error.patch
patches.fixes/resource-include-resource-end-in-walk_-interfaces.patch