From: Shuai Ruan Subject: Re: [PATCH V4 3/4] x86/xsaves: enable xsaves/xrstors for hvm guest Date: Fri, 28 Aug 2015 10:52:22 +0800 Message-ID: <13401.6178818003$1440730345@news.gmane.org> References: <1440500087-9852-1-git-send-email-shuai.ruan@linux.intel.com> <1440500087-9852-4-git-send-email-shuai.ruan@linux.intel.com> <55DD96C5.5080701@citrix.com> Reply-To: Shuai Ruan Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <55DD96C5.5080701@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: kevin.tian@intel.com, wei.liu2@citrix.com, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, jun.nakajima@intel.com, ian.jackson@eu.citrix.com, eddie.dong@intel.com, xen-devel@lists.xen.org, jbeulich@suse.com, keir@xen.org List-Id: xen-devel@lists.xenproject.org On Wed, Aug 26, 2015 at 11:36:53AM +0100, Andrew Cooper wrote: > On 25/08/15 11:54, Shuai Ruan wrote: > > This patch enables xsaves for hvm guest, includes: > > 1.handle xsaves vmcs init and vmexit. > > 2.add logic to write/read the XSS msr. > > > > Signed-off-by: Shuai Ruan > > Reviewed-by: Andrew Cooper , given two > corrections... > Thanks. > > --- > > xen/arch/x86/hvm/hvm.c | 43 ++++++++++++++++++++++++++++++++++++++ > > xen/arch/x86/hvm/vmx/vmcs.c | 6 ++++-- > > xen/arch/x86/hvm/vmx/vmx.c | 20 ++++++++++++++++++ > > xen/arch/x86/xstate.c | 4 ++-- > > xen/include/asm-x86/hvm/vmx/vmcs.h | 7 +++++++ > > xen/include/asm-x86/hvm/vmx/vmx.h | 2 ++ > > xen/include/asm-x86/xstate.h | 1 + > > 7 files changed, 79 insertions(+), 4 deletions(-) > > > > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c > > index dc444ac..57612de 100644 > > --- a/xen/arch/x86/hvm/hvm.c > > +++ b/xen/arch/x86/hvm/hvm.c > > @@ -4540,6 +4540,33 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx, > > *ebx = _eax + _ebx; > > } > > } > > + if ( count == 1 ) > > + { > > + if ( cpu_has_xsaves ) > > + { > > + *ebx = XSTATE_AREA_MIN_SIZE; > > + if ( v->arch.xcr0 | v->arch.msr_ia32_xss ) > > + for ( sub_leaf = 2; sub_leaf < 63; sub_leaf++ ) > > + { > > + if ( !((v->arch.xcr0 | v->arch.msr_ia32_xss) > > + & (1ULL << sub_leaf)) ) > > Stray hard tabs. > Ok. > > @@ -4771,6 +4804,16 @@ int hvm_msr_write_intercept(unsigned int msr, uint64_t msr_content, > > return X86EMUL_EXCEPTION; > > break; > > > > + case MSR_IA32_XSS: > > + /* > > + * skylake only support bit 8 , but it is > > + * not support in xen. > > + */ > > I would alter this comment to > > /* No XSS features currently supported for guests. */ > > The skylake bits are covered by cpu_has_xsaves. > > ~Andrew > Ok. > _______________________________________________ > Xen-devel mailing list Thanks for your reviwe,Andrew > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel >