|
|
2ec96d |
From dd8556fe139be9237694229e55ac3762ec71eca5 Mon Sep 17 00:00:00 2001
|
|
|
2ec96d |
From: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
Date: Wed, 9 Oct 2019 17:51:46 +0200
|
|
|
2ec96d |
Subject: [PATCH 08/10] kvm: Use KVM_GET_MSR_INDEX_LIST for
|
|
|
2ec96d |
MSR_IA32_ARCH_CAPABILITIES support
|
|
|
2ec96d |
|
|
|
2ec96d |
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
Message-id: <20191009175148.1361-9-ehabkost@redhat.com>
|
|
|
2ec96d |
Patchwork-id: 91363
|
|
|
2ec96d |
O-Subject: [RHEL-7.7.z qemu-kvm PATCH 08/10] kvm: Use KVM_GET_MSR_INDEX_LIST for MSR_IA32_ARCH_CAPABILITIES support
|
|
|
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: Bandan Das <bsd@redhat.com>
|
|
|
2ec96d |
|
|
|
2ec96d |
When writing to guest's MSR_IA32_ARCH_CAPABILITIES, check whether it's
|
|
|
2ec96d |
supported in the guest using the KVM_GET_MSR_INDEX_LIST ioctl.
|
|
|
2ec96d |
|
|
|
2ec96d |
7.8 backport conflicts (plai):
|
|
|
2ec96d |
target/i386/kvm.c changes to target-i386/kvm.c
|
|
|
2ec96d |
|
|
|
2ec96d |
7.7.z backport notes (ehabkost):
|
|
|
2ec96d |
* Cherry pick from 7.8 tree with no conflicts
|
|
|
2ec96d |
|
|
|
2ec96d |
Fixes: d86f963694df27f11b3681ffd225c9362de1b634
|
|
|
2ec96d |
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
Tested-by: balducci@units.it
|
|
|
2ec96d |
Signed-off-by: Bandan Das <bsd@redhat.com>
|
|
|
2ec96d |
Message-Id: <jpg4lc4iiav.fsf_-_@linux.bootlegged.copy>
|
|
|
2ec96d |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
(cherry picked from commit aec5e9c3a94cf8b7920f59bef69a6f426092c4a0)
|
|
|
2ec96d |
Signed-off-by: Paul Lai <plai@redhat.com>
|
|
|
2ec96d |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
2ec96d |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
2ec96d |
---
|
|
|
2ec96d |
target-i386/cpu.h | 1 +
|
|
|
2ec96d |
target-i386/kvm.c | 19 +++++++++++--------
|
|
|
2ec96d |
2 files changed, 12 insertions(+), 8 deletions(-)
|
|
|
2ec96d |
|
|
|
2ec96d |
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
|
|
|
2ec96d |
index 1c62e63..d855ae3 100644
|
|
|
2ec96d |
--- a/target-i386/cpu.h
|
|
|
2ec96d |
+++ b/target-i386/cpu.h
|
|
|
2ec96d |
@@ -1066,6 +1066,7 @@ typedef struct CPUX86State {
|
|
|
2ec96d |
|
|
|
2ec96d |
uint64_t spec_ctrl;
|
|
|
2ec96d |
uint64_t virt_ssbd;
|
|
|
2ec96d |
+ uint64_t virt_arch_capabs;
|
|
|
2ec96d |
|
|
|
2ec96d |
TPRAccess tpr_access_type;
|
|
|
2ec96d |
} CPUX86State;
|
|
|
2ec96d |
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
|
|
|
2ec96d |
index 180ae56..bc3a514 100644
|
|
|
2ec96d |
--- a/target-i386/kvm.c
|
|
|
2ec96d |
+++ b/target-i386/kvm.c
|
|
|
2ec96d |
@@ -80,6 +80,7 @@ static bool has_msr_mtrr;
|
|
|
2ec96d |
static bool has_msr_xss;
|
|
|
2ec96d |
static bool has_msr_spec_ctrl;
|
|
|
2ec96d |
static bool has_msr_virt_ssbd;
|
|
|
2ec96d |
+static bool has_msr_arch_capabs;
|
|
|
2ec96d |
|
|
|
2ec96d |
static bool has_msr_architectural_pmu;
|
|
|
2ec96d |
static uint32_t num_architectural_pmu_counters;
|
|
|
2ec96d |
@@ -888,6 +889,10 @@ static int kvm_get_supported_msrs(KVMState *s)
|
|
|
2ec96d |
has_msr_virt_ssbd = true;
|
|
|
2ec96d |
continue;
|
|
|
2ec96d |
}
|
|
|
2ec96d |
+ if (kvm_msr_list->indices[i] == MSR_IA32_ARCH_CAPABILITIES) {
|
|
|
2ec96d |
+ has_msr_arch_capabs = true;
|
|
|
2ec96d |
+ continue;
|
|
|
2ec96d |
+ }
|
|
|
2ec96d |
}
|
|
|
2ec96d |
}
|
|
|
2ec96d |
|
|
|
2ec96d |
@@ -1326,14 +1331,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
|
|
|
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 |
+ if (has_msr_arch_capabs) {
|
|
|
2ec96d |
+ kvm_msr_entry_set(&msrs[n++], MSR_IA32_ARCH_CAPABILITIES,
|
|
|
2ec96d |
+ env->features[FEAT_ARCH_CAPABILITIES]);
|
|
|
2ec96d |
}
|
|
|
2ec96d |
/*
|
|
|
2ec96d |
* The following MSRs have side effects on the guest or are too heavy
|
|
|
2ec96d |
@@ -1925,6 +1925,9 @@ static int kvm_get_msrs(X86CPU *cpu)
|
|
|
2ec96d |
case MSR_VIRT_SSBD:
|
|
|
2ec96d |
env->virt_ssbd = msrs[i].data;
|
|
|
2ec96d |
break;
|
|
|
2ec96d |
+ case MSR_IA32_ARCH_CAPABILITIES:
|
|
|
2ec96d |
+ env->features[FEAT_ARCH_CAPABILITIES] = msrs[i].data;
|
|
|
2ec96d |
+ break;
|
|
|
2ec96d |
}
|
|
|
2ec96d |
}
|
|
|
2ec96d |
|
|
|
2ec96d |
--
|
|
|
2ec96d |
1.8.3.1
|
|
|
2ec96d |
|