kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs
@ 2018-02-08 22:53 KarimAllah Ahmed
  2018-02-08 22:53 ` [PATCH 2/3] KVM/nVMX: Set the CPU_BASED_USE_MSR_BITMAPS if we have a valid L02 MSR bitmap KarimAllah Ahmed
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: KarimAllah Ahmed @ 2018-02-08 22:53 UTC (permalink / raw)
  To: kvm, linux-kernel
  Cc: KarimAllah Ahmed, Paolo Bonzini, Radim Krčmář

These two variables should check whether SPEC_CTRL and PRED_CMD are
supposed to be passed through to L2 guests or not. While
msr_write_intercepted_l01 would return 'true' if it is not passed through.

So just invert the result of msr_write_intercepted_l01 to implement the
correct semantics.

Fixes: 086e7d4118cc ("KVM: VMX: Allow direct access to MSR_IA32_SPEC_CTRL")
Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 arch/x86/kvm/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bee4c49..599179b 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -10219,8 +10219,8 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu,
 	 *    updated to reflect this when L1 (or its L2s) actually write to
 	 *    the MSR.
 	 */
-	bool pred_cmd = msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
-	bool spec_ctrl = msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
+	bool pred_cmd = !msr_write_intercepted_l01(vcpu, MSR_IA32_PRED_CMD);
+	bool spec_ctrl = !msr_write_intercepted_l01(vcpu, MSR_IA32_SPEC_CTRL);
 
 	if (!nested_cpu_has_virt_x2apic_mode(vmcs12) &&
 	    !pred_cmd && !spec_ctrl)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-02-10  9:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-08 22:53 [PATCH 1/3] X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs KarimAllah Ahmed
2018-02-08 22:53 ` [PATCH 2/3] KVM/nVMX: Set the CPU_BASED_USE_MSR_BITMAPS if we have a valid L02 MSR bitmap KarimAllah Ahmed
2018-02-08 22:53 ` [PATCH 3/3] X86/nVMX: Update the MSR_BITMAP field with the L02 MSR BITMAP KarimAllah Ahmed
2018-02-09 23:26   ` Jim Mattson
2018-02-09 23:41     ` KarimAllah Ahmed
2018-02-09 23:57       ` Jim Mattson
2018-02-10  0:22         ` KarimAllah Ahmed
2018-02-09 23:15 ` [PATCH 1/3] X86/nVMX: Properly set spec_ctrl and pred_cmd before merging MSRs Jim Mattson
2018-02-10  9:07   ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).