Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2019-06-15 13:12:05 +0200
committerBorislav Petkov <bp@suse.de>2019-06-15 13:12:05 +0200
commitd26ddbbef67d3da0f30368a6659c9eb267d7ac4c (patch)
tree0c839002749fa6edf6d68bf7136b0066669ecf50
parente8b6320d5533d21d312c4adc2dddaf1feb016f86 (diff)
x86/kvm: Add Hygon Dhyana support to KVM (fate#327735).
-rw-r--r--patches.arch/x86-kvm-add-hygon-dhyana-support-to-kvm.patch83
-rw-r--r--series.conf1
2 files changed, 84 insertions, 0 deletions
diff --git a/patches.arch/x86-kvm-add-hygon-dhyana-support-to-kvm.patch b/patches.arch/x86-kvm-add-hygon-dhyana-support-to-kvm.patch
new file mode 100644
index 0000000000..e5d2085c8f
--- /dev/null
+++ b/patches.arch/x86-kvm-add-hygon-dhyana-support-to-kvm.patch
@@ -0,0 +1,83 @@
+From: Pu Wen <puwen@hygon.cn>
+Date: Sun, 23 Sep 2018 17:36:31 +0800
+Subject: x86/kvm: Add Hygon Dhyana support to KVM
+Git-commit: b8f4abb652146ddde04ab6e2a80e8cde27ff4470
+Patch-mainline: v4.20-rc1
+References: fate#327735
+
+The Hygon Dhyana CPU has the SVM feature as AMD family 17h does.
+So enable the KVM infrastructure support to it.
+
+Signed-off-by: Pu Wen <puwen@hygon.cn>
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Cc: pbonzini@redhat.com
+Cc: rkrcmar@redhat.com
+Cc: tglx@linutronix.de
+Cc: mingo@redhat.com
+Cc: hpa@zytor.com
+Cc: x86@kernel.org
+Cc: thomas.lendacky@amd.com
+Cc: kvm@vger.kernel.org
+Link: https://lkml.kernel.org/r/654dd12876149fba9561698eaf9fc15d030301f8.1537533369.git.puwen@hygon.cn
+---
+ arch/x86/include/asm/kvm_emulate.h | 4 ++++
+ arch/x86/include/asm/virtext.h | 5 +++--
+ arch/x86/kvm/emulate.c | 11 ++++++++++-
+ 3 files changed, 17 insertions(+), 3 deletions(-)
+
+diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
+index 0f82cd91cd3c..93c4bf598fb0 100644
+--- a/arch/x86/include/asm/kvm_emulate.h
++++ b/arch/x86/include/asm/kvm_emulate.h
+@@ -364,6 +364,10 @@ struct x86_emulate_ctxt {
+ #define X86EMUL_CPUID_VENDOR_AMDisbetterI_ecx 0x21726574
+ #define X86EMUL_CPUID_VENDOR_AMDisbetterI_edx 0x74656273
+
++#define X86EMUL_CPUID_VENDOR_HygonGenuine_ebx 0x6f677948
++#define X86EMUL_CPUID_VENDOR_HygonGenuine_ecx 0x656e6975
++#define X86EMUL_CPUID_VENDOR_HygonGenuine_edx 0x6e65476e
++
+ #define X86EMUL_CPUID_VENDOR_GenuineIntel_ebx 0x756e6547
+ #define X86EMUL_CPUID_VENDOR_GenuineIntel_ecx 0x6c65746e
+ #define X86EMUL_CPUID_VENDOR_GenuineIntel_edx 0x49656e69
+diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
+index 0116b2ee9e64..e05e0d309244 100644
+--- a/arch/x86/include/asm/virtext.h
++++ b/arch/x86/include/asm/virtext.h
+@@ -83,9 +83,10 @@ static inline void cpu_emergency_vmxoff(void)
+ */
+ static inline int cpu_has_svm(const char **msg)
+ {
+- if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) {
++ if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD &&
++ boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) {
+ if (msg)
+- *msg = "not amd";
++ *msg = "not amd or hygon";
+ return 0;
+ }
+
+diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
+index 106482da6388..34edf198708f 100644
+--- a/arch/x86/kvm/emulate.c
++++ b/arch/x86/kvm/emulate.c
+@@ -2711,7 +2711,16 @@ static bool em_syscall_is_enabled(struct x86_emulate_ctxt *ctxt)
+ edx == X86EMUL_CPUID_VENDOR_AMDisbetterI_edx)
+ return true;
+
+- /* default: (not Intel, not AMD), apply Intel's stricter rules... */
++ /* Hygon ("HygonGenuine") */
++ if (ebx == X86EMUL_CPUID_VENDOR_HygonGenuine_ebx &&
++ ecx == X86EMUL_CPUID_VENDOR_HygonGenuine_ecx &&
++ edx == X86EMUL_CPUID_VENDOR_HygonGenuine_edx)
++ return true;
++
++ /*
++ * default: (not Intel, not AMD, not Hygon), apply Intel's
++ * stricter rules...
++ */
+ return false;
+ }
+
+
diff --git a/series.conf b/series.conf
index 8b69bd7d31..806dce5247 100644
--- a/series.conf
+++ b/series.conf
@@ -19542,6 +19542,7 @@
patches.arch/x86-apic-add-hygon-dhyana-support.patch
patches.arch/x86-bugs-add-hygon-dhyana-to-the-respective-mitigation-machinery.patch
patches.arch/x86-mce-add-hygon-dhyana-support-to-the-mca-infrastructure.patch
+ patches.arch/x86-kvm-add-hygon-dhyana-support-to-kvm.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