aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-11-27 09:55:05 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-11-27 09:55:05 +0000
commitd5d31c9a8ab5e87db4230602a6fd5da8eb13135c (patch)
tree223c558ddddc4cf211267dd522a0e63207e1e828
parentd522fba24478474911b0e6e488b6d1dcf1af54f8 (diff)
parent30a759b61a9247378a9cb84fbe4e437ae66e0461 (diff)
downloadqemu-arm-d5d31c9a8ab5e87db4230602a6fd5da8eb13135c.tar.gz
Merge remote-tracking branch 'remotes/ehabkost/tags/x86-for-3.1-pull-request' into staging
x86 fixes for -rc3 * Fix SynIC crash * Fix x86 crash on MSR code on AMD hosts # gpg: Signature made Mon 26 Nov 2018 20:58:34 GMT # gpg: using RSA key 2807936F984DC5A6 # gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" # Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF D1AA 2807 936F 984D C5A6 * remotes/ehabkost/tags/x86-for-3.1-pull-request: hw/hyperv: fix NULL dereference with pure-kvm SynIC kvm: Use KVM_GET_MSR_INDEX_LIST for MSR_IA32_ARCH_CAPABILITIES support Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/hyperv/hyperv.c6
-rw-r--r--target/i386/kvm.c15
2 files changed, 12 insertions, 9 deletions
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
index a28e7249d8..8758635227 100644
--- a/hw/hyperv/hyperv.c
+++ b/hw/hyperv/hyperv.c
@@ -136,7 +136,11 @@ void hyperv_synic_add(CPUState *cs)
void hyperv_synic_reset(CPUState *cs)
{
- device_reset(DEVICE(get_synic(cs)));
+ SynICState *synic = get_synic(cs);
+
+ if (synic) {
+ device_reset(DEVICE(synic));
+ }
}
static const TypeInfo synic_type_info = {
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index f524e7d929..3d6739a2b2 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -95,6 +95,7 @@ static bool has_msr_xss;
static bool has_msr_spec_ctrl;
static bool has_msr_virt_ssbd;
static bool has_msr_smi_count;
+static bool has_msr_arch_capabs;
static uint32_t has_architectural_pmu_version;
static uint32_t num_architectural_pmu_gp_counters;
@@ -1481,6 +1482,9 @@ static int kvm_get_supported_msrs(KVMState *s)
case MSR_VIRT_SSBD:
has_msr_virt_ssbd = true;
break;
+ case MSR_IA32_ARCH_CAPABILITIES:
+ has_msr_arch_capabs = true;
+ break;
}
}
}
@@ -2002,14 +2006,9 @@ static int kvm_put_msrs(X86CPU *cpu, int level)
#endif
/* If host supports feature MSR, write down. */
- if (kvm_feature_msrs) {
- int i;
- for (i = 0; i < kvm_feature_msrs->nmsrs; i++)
- if (kvm_feature_msrs->indices[i] == MSR_IA32_ARCH_CAPABILITIES) {
- kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES,
- env->features[FEAT_ARCH_CAPABILITIES]);
- break;
- }
+ if (has_msr_arch_capabs) {
+ kvm_msr_entry_add(cpu, MSR_IA32_ARCH_CAPABILITIES,
+ env->features[FEAT_ARCH_CAPABILITIES]);
}
/*