[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/17] target/i386/kvm: Fix disabling MPX on "-cpu host" with MPX-
From: |
Paolo Bonzini |
Subject: |
[PULL 10/17] target/i386/kvm: Fix disabling MPX on "-cpu host" with MPX-capable host |
Date: |
Wed, 25 May 2022 21:28:45 +0200 |
From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
Since KVM commit 5f76f6f5ff96 ("KVM: nVMX: Do not expose MPX VMX controls when
guest MPX disabled")
it is not possible to disable MPX on a "-cpu host" just by adding "-mpx"
there if the host CPU does indeed support MPX.
QEMU will fail to set MSR_IA32_VMX_TRUE_{EXIT,ENTRY}_CTLS MSRs in this case
and so trigger an assertion failure.
Instead, besides "-mpx" one has to explicitly add also
"-vmx-exit-clear-bndcfgs" and "-vmx-entry-load-bndcfgs" to QEMU command
line to make it work, which is a bit convoluted.
Make the MPX-related bits in FEAT_VMX_{EXIT,ENTRY}_CTLS dependent on MPX
being actually enabled so such workarounds are no longer necessary.
Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Message-Id:
<51aa2125c76363204cc23c27165e778097c33f0b.1653323077.git.maciej.szmigiero@oracle.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/cpu.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 35c3475e6c..385691458f 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1355,6 +1355,14 @@ static FeatureDep feature_dependencies[] = {
.from = { FEAT_7_0_EBX, CPUID_7_0_EBX_INVPCID },
.to = { FEAT_VMX_SECONDARY_CTLS, VMX_SECONDARY_EXEC_ENABLE_INVPCID
},
},
+ {
+ .from = { FEAT_7_0_EBX, CPUID_7_0_EBX_MPX },
+ .to = { FEAT_VMX_EXIT_CTLS, VMX_VM_EXIT_CLEAR_BNDCFGS },
+ },
+ {
+ .from = { FEAT_7_0_EBX, CPUID_7_0_EBX_MPX },
+ .to = { FEAT_VMX_ENTRY_CTLS, VMX_VM_ENTRY_LOAD_BNDCFGS },
+ },
{
.from = { FEAT_7_0_EBX, CPUID_7_0_EBX_RDSEED },
.to = { FEAT_VMX_SECONDARY_CTLS, VMX_SECONDARY_EXEC_RDSEED_EXITING
},
--
2.36.1
- [PULL 00/17] Misc patches for 2022-05-25, Paolo Bonzini, 2022/05/25
- [PULL 01/17] target/i386: Remove LBREn bit check when access Arch LBR MSRs, Paolo Bonzini, 2022/05/25
- [PULL 02/17] hostmem: default the amount of prealloc-threads to smp-cpus, Paolo Bonzini, 2022/05/25
- [PULL 03/17] thread-pool: optimize scheduling of completion bottom half, Paolo Bonzini, 2022/05/25
- [PULL 04/17] thread-pool: replace semaphore with condition variable, Paolo Bonzini, 2022/05/25
- [PULL 05/17] thread-pool: remove stopping variable, Paolo Bonzini, 2022/05/25
- [PULL 06/17] contrib/elf2dmp: add ELF dump header checking, Paolo Bonzini, 2022/05/25
- [PULL 08/17] hw/audio/ac97: Remove unimplemented reset functions, Paolo Bonzini, 2022/05/25
- [PULL 07/17] hw/audio/ac97: Coding style fixes to avoid checkpatch errors, Paolo Bonzini, 2022/05/25
- [PULL 09/17] hw/audio/ac97: Remove unneeded local variables, Paolo Bonzini, 2022/05/25
- [PULL 10/17] target/i386/kvm: Fix disabling MPX on "-cpu host" with MPX-capable host,
Paolo Bonzini <=
- [PULL 11/17] ide_ioport_read: Return lower octet of data register instead of 0xFF, Paolo Bonzini, 2022/05/25
- [PULL 12/17] i386: Use hv_build_cpuid_leaf() for HV_CPUID_NESTED_FEATURES, Paolo Bonzini, 2022/05/25
- [PULL 14/17] i386: Hyper-V XMM fast hypercall input feature, Paolo Bonzini, 2022/05/25
- [PULL 15/17] i386: Hyper-V Support extended GVA ranges for TLB flush hypercalls, Paolo Bonzini, 2022/05/25
- [PULL 13/17] i386: Hyper-V Enlightened MSR bitmap feature, Paolo Bonzini, 2022/05/25
- [PULL 16/17] i386: Hyper-V Direct TLB flush hypercall, Paolo Bonzini, 2022/05/25
- [PULL 17/17] i386: docs: Convert hyperv.txt to rST, Paolo Bonzini, 2022/05/25
- Re: [PULL 00/17] Misc patches for 2022-05-25, Richard Henderson, 2022/05/25