From: Paolo Bonzini <pbonzini@redhat.com>
To: "Liu, Jinsong" <jinsong.liu@intel.com>
Cc: "haoxudong.hao@gmail.com" <haoxudong.hao@gmail.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Gleb Natapov <gleb@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [PATCH 3/4] KVM/X86: Enable Intel MPX for guest
Date: Fri, 29 Nov 2013 15:33:20 +0100 [thread overview]
Message-ID: <5298A5B0.3030506@redhat.com> (raw)
In-Reply-To: <DE8DF0795D48FD4CA783C40EC8292335013EF24A@SHSMSX101.ccr.corp.intel.com>
> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> index a8ce117..e30d4ce 100644
> --- a/arch/x86/kvm/cpuid.c
> +++ b/arch/x86/kvm/cpuid.c
> @@ -75,7 +75,7 @@ void kvm_update_cpuid(struct kvm_vcpu *vcpu)
> (best->eax | ((u64)best->edx << 32)) &
> host_xcr0 & KVM_SUPPORTED_XCR0;
> vcpu->arch.guest_xstate_size = best->ebx =
> - xstate_required_size(vcpu->arch.guest_supported_xcr0);
> + xstate_required_size(vcpu->arch.xcr0);
> }
>
> kvm_pmu_cpuid_update(vcpu);
> ...
> kvm_put_guest_xcr0(vcpu);
> vcpu->arch.xcr0 = xcr0;
> +
> + if ((xcr0 ^ old_xcr0) & XSTATE_EXTEND_MASK)
> + kvm_update_cpuid(vcpu);
> +
> return 0;
> }
These hunks should be part of the previous patch.
> @@ -5960,6 +5967,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
> preempt_disable();
>
> kvm_x86_ops->prepare_guest_switch(vcpu);
> + if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE) &&
Shouldn't be necessary, setting xcr0 fails unless OSXSAVE=1.
> + (vcpu->arch.xcr0 & (u64)(XSTATE_BNDREGS | XSTATE_BNDCSR)))
> + kvm_x86_ops->fpu_activate(vcpu);
Can you explain this?
> if (vcpu->fpu_active)
> kvm_load_guest_fpu(vcpu);
> kvm_load_guest_xcr0(vcpu);
> diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
> index 587fb9e..985e40e 100644
> --- a/arch/x86/kvm/x86.h
> +++ b/arch/x86/kvm/x86.h
> @@ -122,7 +122,8 @@ int kvm_write_guest_virt_system(struct x86_emulate_ctxt *ctxt,
> gva_t addr, void *val, unsigned int bytes,
> struct x86_exception *exception);
>
> -#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM)
> +#define KVM_SUPPORTED_XCR0 (XSTATE_FP | XSTATE_SSE | XSTATE_YMM \
> + | XSTATE_BNDREGS | XSTATE_BNDCSR)
> extern u64 host_xcr0;
>
> extern struct static_key kvm_no_apic_vcpu;
>
Otherwise looks straightforward.
Paolo
next prev parent reply other threads:[~2013-11-29 14:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 13:43 [Qemu-devel] [PATCH 3/4] KVM/X86: Enable Intel MPX for guest Liu, Jinsong
2013-11-29 14:33 ` Paolo Bonzini [this message]
2013-11-29 14:52 ` Liu, Jinsong
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=5298A5B0.3030506@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@redhat.com \
--cc=haoxudong.hao@gmail.com \
--cc=jinsong.liu@intel.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).