|
|
2ec96d |
From 44f5e2649ee37f15607c516c8f9efc58aad708bb Mon Sep 17 00:00:00 2001
|
|
|
2ec96d |
From: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
Date: Wed, 9 Oct 2019 17:51:45 +0200
|
|
|
2ec96d |
Subject: [PATCH 07/10] x86: define a new MSR based feature word --
|
|
|
2ec96d |
FEATURE_WORDS_ARCH_CAPABILITIES
|
|
|
2ec96d |
|
|
|
2ec96d |
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
Message-id: <20191009175148.1361-8-ehabkost@redhat.com>
|
|
|
2ec96d |
Patchwork-id: 91362
|
|
|
2ec96d |
O-Subject: [RHEL-7.7.z qemu-kvm PATCH 07/10] x86: define a new MSR based feature word -- FEATURE_WORDS_ARCH_CAPABILITIES
|
|
|
2ec96d |
Bugzilla: 1730606
|
|
|
2ec96d |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
2ec96d |
RH-Acked-by: Bandan Das <bsd@redhat.com>
|
|
|
2ec96d |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
2ec96d |
|
|
|
2ec96d |
From: Robert Hoo <robert.hu@linux.intel.com>
|
|
|
2ec96d |
|
|
|
2ec96d |
Note RSBA is specially treated -- no matter host support it or not, qemu
|
|
|
2ec96d |
pretends it is supported.
|
|
|
2ec96d |
|
|
|
2ec96d |
7.8 backport conflicts (plai):
|
|
|
2ec96d |
target/i386/cpu.c
|
|
|
2ec96d |
target/i386/cpu.h
|
|
|
2ec96d |
target/i386/kvm.c
|
|
|
2ec96d |
|
|
|
2ec96d |
7.7.z backport notes (ehabkost):
|
|
|
2ec96d |
* Cherry picked from 7.8 tree with no conflicts
|
|
|
2ec96d |
|
|
|
2ec96d |
Signed-off-by: Robert Hoo <robert.hu@linux.intel.com>
|
|
|
2ec96d |
Message-Id: <1539578845-37944-4-git-send-email-robert.hu@linux.intel.com>
|
|
|
2ec96d |
[ehabkost: removed automatic enabling of RSBA]
|
|
|
2ec96d |
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
(cherry picked from commit d86f963694df27f11b3681ffd225c9362de1b634)
|
|
|
2ec96d |
Signed-off-by: Paul Lai <plai@redhat.com>
|
|
|
2ec96d |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
|
|
|
2ec96d |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
2ec96d |
---
|
|
|
2ec96d |
target-i386/cpu.c | 23 +++++++++++++++++++++++
|
|
|
2ec96d |
target-i386/cpu.h | 8 ++++++++
|
|
|
2ec96d |
target-i386/kvm.c | 10 ++++++++++
|
|
|
2ec96d |
3 files changed, 41 insertions(+)
|
|
|
2ec96d |
|
|
|
2ec96d |
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
|
|
|
2ec96d |
index 7fecd21..35381f0 100644
|
|
|
2ec96d |
--- a/target-i386/cpu.c
|
|
|
2ec96d |
+++ b/target-i386/cpu.c
|
|
|
2ec96d |
@@ -199,6 +199,17 @@ static const char *cpuid_xsave_feature_name[] = {
|
|
|
2ec96d |
NULL, NULL, NULL, NULL,
|
|
|
2ec96d |
};
|
|
|
2ec96d |
|
|
|
2ec96d |
+static const char *cpuid_arch_capabilities_feature_name[] = {
|
|
|
2ec96d |
+ "rdctl-no", "ibrs-all", "rsba", "skip-l1dfl-vmentry",
|
|
|
2ec96d |
+ "ssb-no", NULL, NULL, NULL,
|
|
|
2ec96d |
+ NULL, NULL, NULL, NULL,
|
|
|
2ec96d |
+ NULL, NULL, NULL, NULL,
|
|
|
2ec96d |
+ NULL, NULL, NULL, NULL,
|
|
|
2ec96d |
+ NULL, NULL, NULL, NULL,
|
|
|
2ec96d |
+ NULL, NULL, NULL, NULL,
|
|
|
2ec96d |
+ NULL, NULL, NULL, NULL,
|
|
|
2ec96d |
+};
|
|
|
2ec96d |
+
|
|
|
2ec96d |
#define I486_FEATURES (CPUID_FP87 | CPUID_VME | CPUID_PSE)
|
|
|
2ec96d |
#define PENTIUM_FEATURES (I486_FEATURES | CPUID_DE | CPUID_TSC | \
|
|
|
2ec96d |
CPUID_MSR | CPUID_MCE | CPUID_CX8 | CPUID_MMX | CPUID_APIC)
|
|
|
2ec96d |
@@ -375,6 +386,18 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
|
|
|
2ec96d |
.reg = R_EAX,
|
|
|
2ec96d |
},
|
|
|
2ec96d |
},
|
|
|
2ec96d |
+ /*Below are MSR exposed features*/
|
|
|
2ec96d |
+ [FEAT_ARCH_CAPABILITIES] = {
|
|
|
2ec96d |
+ .type = MSR_FEATURE_WORD,
|
|
|
2ec96d |
+ .feat_names = cpuid_arch_capabilities_feature_name,
|
|
|
2ec96d |
+ .msr = {
|
|
|
2ec96d |
+ .index = MSR_IA32_ARCH_CAPABILITIES,
|
|
|
2ec96d |
+ .cpuid_dep = {
|
|
|
2ec96d |
+ FEAT_7_0_EDX,
|
|
|
2ec96d |
+ CPUID_7_0_EDX_ARCH_CAPABILITIES
|
|
|
2ec96d |
+ }
|
|
|
2ec96d |
+ },
|
|
|
2ec96d |
+ },
|
|
|
2ec96d |
};
|
|
|
2ec96d |
|
|
|
2ec96d |
typedef struct X86RegisterInfo32 {
|
|
|
2ec96d |
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
|
|
|
2ec96d |
index ea5df77..1c62e63 100644
|
|
|
2ec96d |
--- a/target-i386/cpu.h
|
|
|
2ec96d |
+++ b/target-i386/cpu.h
|
|
|
2ec96d |
@@ -415,6 +415,7 @@ typedef enum FeatureWord {
|
|
|
2ec96d |
FEAT_KVM, /* CPUID[4000_0001].EAX (KVM_CPUID_FEATURES) */
|
|
|
2ec96d |
FEAT_SVM, /* CPUID[8000_000A].EDX */
|
|
|
2ec96d |
FEAT_XSAVE, /* CPUID[EAX=0xd,ECX=1].EAX */
|
|
|
2ec96d |
+ FEAT_ARCH_CAPABILITIES,
|
|
|
2ec96d |
FEATURE_WORDS,
|
|
|
2ec96d |
} FeatureWord;
|
|
|
2ec96d |
|
|
|
2ec96d |
@@ -632,6 +633,13 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
|
|
|
2ec96d |
#define CPUID_MWAIT_IBE (1U << 1) /* Interrupts can exit capability */
|
|
|
2ec96d |
#define CPUID_MWAIT_EMX (1U << 0) /* enumeration supported */
|
|
|
2ec96d |
|
|
|
2ec96d |
+/* MSR Feature Bits */
|
|
|
2ec96d |
+#define MSR_ARCH_CAP_RDCL_NO (1U << 0)
|
|
|
2ec96d |
+#define MSR_ARCH_CAP_IBRS_ALL (1U << 1)
|
|
|
2ec96d |
+#define MSR_ARCH_CAP_RSBA (1U << 2)
|
|
|
2ec96d |
+#define MSR_ARCH_CAP_SKIP_L1DFL_VMENTRY (1U << 3)
|
|
|
2ec96d |
+#define MSR_ARCH_CAP_SSB_NO (1U << 4)
|
|
|
2ec96d |
+
|
|
|
2ec96d |
#ifndef HYPERV_SPINLOCK_NEVER_RETRY
|
|
|
2ec96d |
#define HYPERV_SPINLOCK_NEVER_RETRY 0xFFFFFFFF
|
|
|
2ec96d |
#endif
|
|
|
2ec96d |
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
|
|
|
2ec96d |
index 2b1d7da..180ae56 100644
|
|
|
2ec96d |
--- a/target-i386/kvm.c
|
|
|
2ec96d |
+++ b/target-i386/kvm.c
|
|
|
2ec96d |
@@ -1325,6 +1325,16 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
|
|
|
2ec96d |
kvm_msr_entry_set(&msrs[n++], MSR_IA32_TSC, env->tsc);
|
|
|
2ec96d |
}
|
|
|
2ec96d |
}
|
|
|
2ec96d |
+ /* If host supports feature MSR, write down. */
|
|
|
2ec96d |
+ if (kvm_feature_msrs) {
|
|
|
2ec96d |
+ int i;
|
|
|
2ec96d |
+ for (i = 0; i < kvm_feature_msrs->nmsrs; i++)
|
|
|
2ec96d |
+ if (kvm_feature_msrs->indices[i] == MSR_IA32_ARCH_CAPABILITIES) {
|
|
|
2ec96d |
+ kvm_msr_entry_set(&msrs[n++], MSR_IA32_ARCH_CAPABILITIES,
|
|
|
2ec96d |
+ env->features[FEAT_ARCH_CAPABILITIES]);
|
|
|
2ec96d |
+ break;
|
|
|
2ec96d |
+ }
|
|
|
2ec96d |
+ }
|
|
|
2ec96d |
/*
|
|
|
2ec96d |
* The following MSRs have side effects on the guest or are too heavy
|
|
|
2ec96d |
* for normal writeback. Limit them to reset or full state updates.
|
|
|
2ec96d |
--
|
|
|
2ec96d |
1.8.3.1
|
|
|
2ec96d |
|