|
|
69f3e1 |
From ff712825c31188b19ece7b9388630f6456bb10db Mon Sep 17 00:00:00 2001
|
|
|
69f3e1 |
From: "plai@redhat.com" <plai@redhat.com>
|
|
|
69f3e1 |
Date: Tue, 20 Aug 2019 00:24:37 +0100
|
|
|
69f3e1 |
Subject: [PATCH 6/9] kvm: Use KVM_GET_MSR_INDEX_LIST for
|
|
|
69f3e1 |
MSR_IA32_ARCH_CAPABILITIES support
|
|
|
69f3e1 |
|
|
|
69f3e1 |
RH-Author: plai@redhat.com
|
|
|
69f3e1 |
Message-id: <1566260680-20995-7-git-send-email-plai@redhat.com>
|
|
|
69f3e1 |
Patchwork-id: 90065
|
|
|
69f3e1 |
O-Subject: [RHEL8.0 qemu-kvm PATCH v3 6/9] kvm: Use KVM_GET_MSR_INDEX_LIST for MSR_IA32_ARCH_CAPABILITIES support
|
|
|
69f3e1 |
Bugzilla: 1718235
|
|
|
69f3e1 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
69f3e1 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
69f3e1 |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
69f3e1 |
|
|
|
69f3e1 |
From: Bandan Das <bsd@redhat.com>
|
|
|
69f3e1 |
|
|
|
69f3e1 |
When writing to guest's MSR_IA32_ARCH_CAPABILITIES, check whether it's
|
|
|
69f3e1 |
supported in the guest using the KVM_GET_MSR_INDEX_LIST ioctl.
|
|
|
69f3e1 |
|
|
|
69f3e1 |
Fixes: d86f963694df27f11b3681ffd225c9362de1b634
|
|
|
69f3e1 |
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
69f3e1 |
Tested-by: balducci@units.it
|
|
|
69f3e1 |
Signed-off-by: Bandan Das <bsd@redhat.com>
|
|
|
69f3e1 |
Message-Id: <jpg4lc4iiav.fsf_-_@linux.bootlegged.copy>
|
|
|
69f3e1 |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
69f3e1 |
(cherry picked from commit aec5e9c3a94cf8b7920f59bef69a6f426092c4a0)
|
|
|
69f3e1 |
Signed-off-by: Paul Lai <plai@redhat.com>
|
|
|
69f3e1 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
69f3e1 |
---
|
|
|
69f3e1 |
target/i386/kvm.c | 15 +++++++--------
|
|
|
69f3e1 |
1 file changed, 7 insertions(+), 8 deletions(-)
|
|
|
69f3e1 |
|
|
|
69f3e1 |
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
|
|
|
69f3e1 |
index d2cb91e..6f661b2 100644
|
|
|
69f3e1 |
--- a/target/i386/kvm.c
|
|
|
69f3e1 |
+++ b/target/i386/kvm.c
|
|
|
69f3e1 |
@@ -94,6 +94,7 @@ static bool has_msr_xss;
|
|
|
69f3e1 |
static bool has_msr_spec_ctrl;
|
|
|
69f3e1 |
static bool has_msr_virt_ssbd;
|
|
|
69f3e1 |
static bool has_msr_smi_count;
|
|
|
69f3e1 |
+static bool has_msr_arch_capabs;
|
|
|
69f3e1 |
|
|
|
69f3e1 |
static uint32_t has_architectural_pmu_version;
|
|
|
69f3e1 |
static uint32_t num_architectural_pmu_gp_counters;
|
|
|
69f3e1 |
@@ -1330,6 +1331,9 @@ static int kvm_get_supported_msrs(KVMState *s)
|
|
|
69f3e1 |
case MSR_VIRT_SSBD:
|
|
|
69f3e1 |
has_msr_virt_ssbd = true;
|
|
|
69f3e1 |
break;
|
|
|
69f3e1 |
+ case MSR_IA32_ARCH_CAPABILITIES:
|
|
|
69f3e1 |
+ has_msr_arch_capabs = true;
|
|
|
69f3e1 |
+ break;
|
|
|
69f3e1 |
}
|
|
|
69f3e1 |
}
|
|
|
69f3e1 |
}
|
|
|
69f3e1 |
@@ -1834,14 +1838,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
|
|
|
69f3e1 |
#endif
|
|
|
69f3e1 |
|
|
|
69f3e1 |
/* If host supports feature MSR, write down. */
|
|
|
69f3e1 |
- if (kvm_feature_msrs) {
|
|
|
69f3e1 |
- int i;
|
|
|
69f3e1 |
- for (i = 0; i < kvm_feature_msrs->nmsrs; i++)
|
|
|
69f3e1 |
- if (kvm_feature_msrs->indices[i] == MSR_IA32_ARCH_CAPABILITIES) {
|
|
|
69f3e1 |
- kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES,
|
|
|
69f3e1 |
- env->features[FEAT_ARCH_CAPABILITIES]);
|
|
|
69f3e1 |
- break;
|
|
|
69f3e1 |
- }
|
|
|
69f3e1 |
+ if (has_msr_arch_capabs) {
|
|
|
69f3e1 |
+ kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES,
|
|
|
69f3e1 |
+ env->features[FEAT_ARCH_CAPABILITIES]);
|
|
|
69f3e1 |
}
|
|
|
69f3e1 |
|
|
|
69f3e1 |
/*
|
|
|
69f3e1 |
--
|
|
|
69f3e1 |
1.8.3.1
|
|
|
69f3e1 |
|