[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 7/9] target-i386: kvm: Abort if MCE bank count is not
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 7/9] target-i386: kvm: Abort if MCE bank count is not supported by host |
Date: |
Wed, 25 Nov 2015 18:19:14 +0100 |
From: Eduardo Habkost <address@hidden>
Instead of silently changing the number of banks in mcg_cap based
on kvm_get_mce_cap_supported(), abort initialization if the host
doesn't support MCE_BANKS_DEF banks.
Note that MCE_BANKS_DEF was always 10 since it was introduced in
QEMU, and Linux always returned 32 at KVM_CAP_MCE since
KVM_CAP_MCE was introduced, so no behavior is being changed and
the error can't be triggered by any Linux version. The point of
the new check is to ensure we won't silently change the bank
count if we change MCE_BANKS_DEF or make the bank count
configurable in the future.
Signed-off-by: Eduardo Habkost <address@hidden>
[Avoid Yoda condition and \n at end of error_report. - Paolo]
Signed-off-by: Paolo Bonzini <address@hidden>
---
target-i386/kvm.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 2a9953b..93d1f5e 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -784,11 +784,14 @@ int kvm_arch_init_vcpu(CPUState *cs)
return ret;
}
- if (banks > MCE_BANKS_DEF) {
- banks = MCE_BANKS_DEF;
+ if (banks < MCE_BANKS_DEF) {
+ error_report("kvm: Unsupported MCE bank count (QEMU = %d, KVM =
%d)",
+ MCE_BANKS_DEF, banks);
+ return -ENOTSUP;
}
+
mcg_cap &= MCE_CAP_DEF;
- mcg_cap |= banks;
+ mcg_cap |= MCE_BANKS_DEF;
ret = kvm_vcpu_ioctl(cs, KVM_X86_SETUP_MCE, &mcg_cap);
if (ret < 0) {
fprintf(stderr, "KVM_X86_SETUP_MCE: %s", strerror(-ret));
--
1.8.3.1
- [Qemu-devel] [PULL 8/9] target-i386: kvm: Use env->mcg_cap when setting up MCE, (continued)
- [Qemu-devel] [PULL 8/9] target-i386: kvm: Use env->mcg_cap when setting up MCE, Paolo Bonzini, 2015/11/25
- [Qemu-devel] [PULL 1/9] MAINTAINERS: Update TCG CPU cores section, Paolo Bonzini, 2015/11/25
- [Qemu-devel] [PULL 2/9] QEMU does not care about left shifts of signed negative values, Paolo Bonzini, 2015/11/25
- Re: [Qemu-devel] [PULL 2/9] QEMU does not care about left shifts of signed negative values, Peter Maydell, 2015/11/25
- Re: [Qemu-devel] [PULL 2/9] QEMU does not care about left shifts of signed negative values, Paolo Bonzini, 2015/11/25
- Re: [Qemu-devel] [PULL 2/9] QEMU does not care about left shifts of signed negative values, Peter Maydell, 2015/11/25
- Re: [Qemu-devel] [PULL 2/9] QEMU does not care about left shifts of signed negative values, Paolo Bonzini, 2015/11/25
- Re: [Qemu-devel] [PULL 2/9] QEMU does not care about left shifts of signed negative values, Peter Maydell, 2015/11/25
- Re: [Qemu-devel] [PULL 2/9] QEMU does not care about left shifts of signed negative values, Paolo Bonzini, 2015/11/25
- Re: [Qemu-devel] [PULL 2/9] QEMU does not care about left shifts of signed negative values, Peter Maydell, 2015/11/25
[Qemu-devel] [PULL 7/9] target-i386: kvm: Abort if MCE bank count is not supported by host,
Paolo Bonzini <=
[Qemu-devel] [PULL 9/9] target-i386: kvm: Print warning when clearing mcg_cap bits, Paolo Bonzini, 2015/11/25
Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Peter Maydell, 2015/11/26
- Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Paolo Bonzini, 2015/11/26
- Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Peter Maydell, 2015/11/26
- Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Paolo Bonzini, 2015/11/26
- Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Peter Maydell, 2015/11/26
- Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Markus Armbruster, 2015/11/26
- Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Peter Maydell, 2015/11/26
- Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Paolo Bonzini, 2015/11/26
Re: [Qemu-devel] [PULL 0/9] Misc patches for QEMU 2.5-rc2 (2015-11-25), Paolo Bonzini, 2015/11/26