|
|
c687bc |
From 655e723a5190206302f6cc4f2e794563b8e1c226 Mon Sep 17 00:00:00 2001
|
|
|
c687bc |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
c687bc |
Date: Wed, 24 Feb 2021 11:30:36 -0500
|
|
|
c687bc |
Subject: [PATCH 3/4] x86/cpu: Populate SVM CPUID feature bits
|
|
|
c687bc |
|
|
|
c687bc |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
c687bc |
Message-id: <20210224113037.15599-4-dgilbert@redhat.com>
|
|
|
c687bc |
Patchwork-id: 101200
|
|
|
c687bc |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 3/4] x86/cpu: Populate SVM CPUID feature bits
|
|
|
c687bc |
Bugzilla: 1790620
|
|
|
c687bc |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
c687bc |
|
|
|
c687bc |
From: Wei Huang <wei.huang2@amd.com>
|
|
|
c687bc |
|
|
|
c687bc |
Newer AMD CPUs will add CPUID_0x8000000A_EDX[28] bit, which indicates
|
|
|
c687bc |
that SVM instructions (VMRUN/VMSAVE/VMLOAD) will trigger #VMEXIT before
|
|
|
c687bc |
CPU checking their EAX against reserved memory regions. This change will
|
|
|
c687bc |
allow the hypervisor to avoid intercepting #GP and emulating SVM
|
|
|
c687bc |
instructions. KVM turns on this CPUID bit for nested VMs. In order to
|
|
|
c687bc |
support it, let us populate this bit, along with other SVM feature bits,
|
|
|
c687bc |
in FEAT_SVM.
|
|
|
c687bc |
|
|
|
c687bc |
Signed-off-by: Wei Huang <wei.huang2@amd.com>
|
|
|
c687bc |
Message-Id: <20210126202456.589932-1-wei.huang2@amd.com>
|
|
|
c687bc |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
c687bc |
(cherry picked from commit 5447089c2b3b084b51670af36fc86ee3979e04be)
|
|
|
c687bc |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
c687bc |
---
|
|
|
c687bc |
target/i386/cpu.c | 6 +++---
|
|
|
c687bc |
target/i386/cpu.h | 24 ++++++++++++++----------
|
|
|
c687bc |
2 files changed, 17 insertions(+), 13 deletions(-)
|
|
|
c687bc |
|
|
|
c687bc |
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
|
|
|
c687bc |
index f6a9ed84b3..7227c803c3 100644
|
|
|
c687bc |
--- a/target/i386/cpu.c
|
|
|
c687bc |
+++ b/target/i386/cpu.c
|
|
|
c687bc |
@@ -1026,11 +1026,11 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
|
|
|
c687bc |
"npt", "lbrv", "svm-lock", "nrip-save",
|
|
|
c687bc |
"tsc-scale", "vmcb-clean", "flushbyasid", "decodeassists",
|
|
|
c687bc |
NULL, NULL, "pause-filter", NULL,
|
|
|
c687bc |
- "pfthreshold", NULL, NULL, NULL,
|
|
|
c687bc |
- NULL, NULL, NULL, NULL,
|
|
|
c687bc |
- NULL, NULL, NULL, NULL,
|
|
|
c687bc |
+ "pfthreshold", "avic", NULL, "v-vmsave-vmload",
|
|
|
c687bc |
+ "vgif", NULL, NULL, NULL,
|
|
|
c687bc |
NULL, NULL, NULL, NULL,
|
|
|
c687bc |
NULL, NULL, NULL, NULL,
|
|
|
c687bc |
+ "svme-addr-chk", NULL, NULL, NULL,
|
|
|
c687bc |
},
|
|
|
c687bc |
.cpuid = { .eax = 0x8000000A, .reg = R_EDX, },
|
|
|
c687bc |
.tcg_features = TCG_SVM_FEATURES,
|
|
|
c687bc |
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
|
|
|
c687bc |
index f5a4efcec6..e1b67910c2 100644
|
|
|
c687bc |
--- a/target/i386/cpu.h
|
|
|
c687bc |
+++ b/target/i386/cpu.h
|
|
|
c687bc |
@@ -667,16 +667,20 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS];
|
|
|
c687bc |
#define CPUID_EXT3_PERFCORE (1U << 23)
|
|
|
c687bc |
#define CPUID_EXT3_PERFNB (1U << 24)
|
|
|
c687bc |
|
|
|
c687bc |
-#define CPUID_SVM_NPT (1U << 0)
|
|
|
c687bc |
-#define CPUID_SVM_LBRV (1U << 1)
|
|
|
c687bc |
-#define CPUID_SVM_SVMLOCK (1U << 2)
|
|
|
c687bc |
-#define CPUID_SVM_NRIPSAVE (1U << 3)
|
|
|
c687bc |
-#define CPUID_SVM_TSCSCALE (1U << 4)
|
|
|
c687bc |
-#define CPUID_SVM_VMCBCLEAN (1U << 5)
|
|
|
c687bc |
-#define CPUID_SVM_FLUSHASID (1U << 6)
|
|
|
c687bc |
-#define CPUID_SVM_DECODEASSIST (1U << 7)
|
|
|
c687bc |
-#define CPUID_SVM_PAUSEFILTER (1U << 10)
|
|
|
c687bc |
-#define CPUID_SVM_PFTHRESHOLD (1U << 12)
|
|
|
c687bc |
+#define CPUID_SVM_NPT (1U << 0)
|
|
|
c687bc |
+#define CPUID_SVM_LBRV (1U << 1)
|
|
|
c687bc |
+#define CPUID_SVM_SVMLOCK (1U << 2)
|
|
|
c687bc |
+#define CPUID_SVM_NRIPSAVE (1U << 3)
|
|
|
c687bc |
+#define CPUID_SVM_TSCSCALE (1U << 4)
|
|
|
c687bc |
+#define CPUID_SVM_VMCBCLEAN (1U << 5)
|
|
|
c687bc |
+#define CPUID_SVM_FLUSHASID (1U << 6)
|
|
|
c687bc |
+#define CPUID_SVM_DECODEASSIST (1U << 7)
|
|
|
c687bc |
+#define CPUID_SVM_PAUSEFILTER (1U << 10)
|
|
|
c687bc |
+#define CPUID_SVM_PFTHRESHOLD (1U << 12)
|
|
|
c687bc |
+#define CPUID_SVM_AVIC (1U << 13)
|
|
|
c687bc |
+#define CPUID_SVM_V_VMSAVE_VMLOAD (1U << 15)
|
|
|
c687bc |
+#define CPUID_SVM_VGIF (1U << 16)
|
|
|
c687bc |
+#define CPUID_SVM_SVME_ADDR_CHK (1U << 28)
|
|
|
c687bc |
|
|
|
c687bc |
/* Support RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE */
|
|
|
c687bc |
#define CPUID_7_0_EBX_FSGSBASE (1U << 0)
|
|
|
c687bc |
--
|
|
|
c687bc |
2.27.0
|
|
|
c687bc |
|