mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wanpeng Li <kernellwp@gmail.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Wanpeng Li" <wanpeng.li@hotmail.com>
Subject: [PATCH 2/2] KVM: X86: XCR0 should be set to the fixed value on vCPU reset
Date: Sat,  7 Oct 2017 19:35:07 -0700	[thread overview]
Message-ID: <1507430107-4338-2-git-send-email-wanpeng.li@hotmail.com> (raw)
In-Reply-To: <1507430107-4338-1-git-send-email-wanpeng.li@hotmail.com>

From: Wanpeng Li <wanpeng.li@hotmail.com>

SDM section 2.6 mentioned: 

After reset, all bits (except bit 0) in XCR0 are cleared to zero; XCR0[0] is set to 1.

This patch sets XCRO to the 0x1 after vCPU reset.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
 arch/x86/kvm/x86.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b0d2915..c784cd6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7816,6 +7816,8 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
 	vcpu->arch.regs_avail = ~0;
 	vcpu->arch.regs_dirty = ~0;
 
+	vcpu->arch.xcr0 = XFEATURE_MASK_FP;
+
 	kvm_x86_ops->vcpu_reset(vcpu, init_event);
 }
 
-- 
2.7.4

  reply	other threads:[~2017-10-08  2:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-08  2:35 [PATCH 1/2] KVM: VMX: Don't expose unrestricted_guest is enabled if ept is disabled Wanpeng Li
2017-10-08  2:35 ` Wanpeng Li [this message]
2017-10-08 22:36   ` [PATCH 2/2] KVM: X86: XCR0 should be set to the fixed value on vCPU reset Jim Mattson
2017-10-09  8:04   ` Paolo Bonzini
2017-10-08 22:35 ` [PATCH 1/2] KVM: VMX: Don't expose unrestricted_guest is enabled if ept is disabled Jim Mattson
2017-10-09  7:54   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1507430107-4338-2-git-send-email-wanpeng.li@hotmail.com \
    --to=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=wanpeng.li@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®