From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH 2/2] x86/xsave: use alternative asm on xsave side. Date: Wed, 03 Feb 2016 05:08:30 -0700 Message-ID: <56B1FBCE02000078000CDFAB@prv-mh.provo.novell.com> References: <1454397064-29268-1-git-send-email-shuai.ruan@linux.intel.com> <1454397064-29268-3-git-send-email-shuai.ruan@linux.intel.com> <56B1F53002000078000CDF17@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <56B1F53002000078000CDF17@prv-mh.provo.novell.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Shuai Ruan Cc: andrew.cooper3@citrix.com, keir@xen.org, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 03.02.16 at 12:40, wrote: >>>> On 02.02.16 at 08:11, wrote: >> --- a/xen/arch/x86/xstate.c >> +++ b/xen/arch/x86/xstate.c >> @@ -248,24 +248,26 @@ void xsave(struct vcpu *v, uint64_t mask) >> uint32_t hmask = mask >> 32; >> uint32_t lmask = mask; >> int word_size = mask & XSTATE_FP ? (cpu_has_fpu_sel ? 8 : 0) : -1; >> +#define XSAVE(pfx) \ >> + alternative_io_3(".byte " pfx "0x0f,0xae,0x27\n", \ >> + ".byte " pfx "0x0f,0xae,0x37\n", \ >> + X86_FEATURE_XSAVEOPT, \ >> + ".byte " pfx "0x0f,0xc7,0x27\n", \ >> + X86_FEATURE_XSAVEC, \ >> + ".byte " pfx "0x0f,0xc7,0x37\n", \ >> + X86_FEATURE_XSAVES, \ >> + "=m" (*ptr), \ >> + "a" (lmask), "d" (hmask), "D" (ptr)) >> >> if ( word_size <= 0 || !is_pv_32bit_vcpu(v) ) >> { >> typeof(ptr->fpu_sse.fip.sel) fcs = ptr->fpu_sse.fip.sel; >> typeof(ptr->fpu_sse.fdp.sel) fds = ptr->fpu_sse.fdp.sel; >> >> - if ( cpu_has_xsaves ) >> - asm volatile ( ".byte 0x48,0x0f,0xc7,0x2f" >> - : "=m" (*ptr) >> - : "a" (lmask), "d" (hmask), "D" (ptr) ); >> - else if ( cpu_has_xsavec ) >> - asm volatile ( ".byte 0x48,0x0f,0xc7,0x27" >> - : "=m" (*ptr) >> - : "a" (lmask), "d" (hmask), "D" (ptr) ); >> - else if ( cpu_has_xsaveopt ) >> + if ( cpu_has_xsaveopt || cpu_has_xsaves ) >> { >> /* >> - * xsaveopt may not write the FPU portion even when the > respective >> + * xsaveopt/xsaves may not write the FPU portion even when the > respective > > Apart from this line now being too long and hence the entire > comment needing re-formatting > Reviewed-by: Jan Beulich Withdrawn. There's a bug here, and since I'm re-doing patch 1 from scratch I'll send out the result later. Jan