From: Shuai Ruan Subject: Re: [V9 1/3] x86/xsaves: enable xsaves/xrstors/xsavec in xen Date: Fri, 6 Nov 2015 11:17:47 +0800 Message-ID: <10757.4266069152$1446780019@news.gmane.org> References: <1446532047-5276-1-git-send-email-shuai.ruan@linux.intel.com> <1446532047-5276-2-git-send-email-shuai.ruan@linux.intel.com> <563A48B102000078000B1E00@prv-mh.provo.novell.com> <20151105013404.GA12189@shuai.ruan@linux.intel.com> <563B2A2102000078000B205E@prv-mh.provo.novell.com> <20151105095736.GA22384@shuai.ruan@linux.intel.com> <563B39BD02000078000B20DB@prv-mh.provo.novell.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: <563B39BD02000078000B20DB@prv-mh.provo.novell.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: Jan Beulich Cc: kevin.tian@intel.com, wei.liu2@citrix.com, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, jun.nakajima@intel.com, keir@xen.org List-Id: xen-devel@lists.xenproject.org On Thu, Nov 05, 2015 at 03:13:01AM -0700, Jan Beulich wrote: > >>> On 05.11.15 at 10:57, wrote: > > Ok. So alternative_input will not used here (means use the way > > xrstor in Patch 8)? Or put the XSTATE_FIXUP into alternative_input ? > > Which one is ok to you ? > > The latter, if necessary by extending alternative_input() accordingly > (or provide a second, more flexible variant if need be; iirc Linux has > gained a couple of variants over the years). > Ok,I will introduct 2 new macro to handle this. 1. #define ASM_OUTPUT2(a...) a The first one(Porting from linux) is used when more than one output parameter is needed. 2. #define alternative_io_fixup(oldinstr, newinstr, feature, fixup, output, input...) \ asm volatile (ALTERNATIVE(oldinstr, newinstr, feature) "\n" \ fixup \ : output : "i"(0), ## input) The second is to handle alternaive asm with fixup. Then xrstor side will be: alternative_io_fixup("1: "".byte 0x48,0x0f,0xae,0x2f", ".byte 0x48,0x0f,0xc7,0x1f", X86_FEATURE_XSAVES, XSTATE_FIXUP, ASM_OUTPUT2("+&D" (ptr), "+&a" (lmask)), "m" (*ptr), "g" (lmask), "d" (hmask), "m" (xsave_cntxt_size) : "ecx"); Also, the position of the operand used in XSTATE_FIXUP will changed. Any suggestions of this ? Thanks > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel >