public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Keep masked bits unmodified on kvm_set_shared_msr
@ 2014-08-20 12:11 Nadav Amit
  2014-08-21  8:05 ` Wanpeng Li
  0 siblings, 1 reply; 8+ messages in thread
From: Nadav Amit @ 2014-08-20 12:11 UTC (permalink / raw)
  To: pbonzini; +Cc: kvm, Nadav Amit

Currently, when an msr is updated using kvm_set_shared_msr the masked bits are
zeroed.  This behavior is currently valid since the only MSR with partial mask
is EFER, in which only SCE might be unmasked. However, using the
kvm_set_shared_msr for other purposes becomes impossible.

This patch keeps the masked bits unmodified while setting a shared msr.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
---
 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5f5edb6..ee42410 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -236,6 +236,7 @@ void kvm_set_shared_msr(unsigned slot, u64 value, u64 mask)
 
 	if (((value ^ smsr->values[slot].curr) & mask) == 0)
 		return;
+	value = (smsr->values[slot].curr & ~mask) | (value & mask);
 	smsr->values[slot].curr = value;
 	wrmsrl(shared_msrs_global.msrs[slot], value);
 	if (!smsr->registered) {
-- 
1.9.1


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

end of thread, other threads:[~2014-08-22  6:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-20 12:11 [PATCH] KVM: x86: Keep masked bits unmodified on kvm_set_shared_msr Nadav Amit
2014-08-21  8:05 ` Wanpeng Li
2014-08-21 11:56   ` Paolo Bonzini
2014-08-21 12:19     ` Nadav Amit
2014-08-21 12:31       ` Paolo Bonzini
2014-08-21 12:41         ` Nadav Amit
2014-08-22  4:13     ` Wanpeng Li
2014-08-22  6:55       ` Nadav Amit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox