On Fri, Mar 02, 2018 at 02:54:16PM +0000, Andrew Cooper wrote:
> On 02/03/18 14:47, Wei Liu wrote:
> > Provide the functions needed for different modes. And cpu_has_invpcid.
> >
> > Signed-off-by: Wei Liu <wei.l...@citrix.com>
> > ---
> > This is useful for Juergen's XPTI improvement series.
> >
> > Cc: Jan Beulich <jbeul...@suse.com>
> > Cc: Andrew Cooper <andrew.coop...@citrix.com>
> > Cc: Juergen Gross <jgr...@suse.com>
> > ---
> >  xen/arch/x86/Rules.mk            |  1 +
> >  xen/include/asm-x86/cpufeature.h |  1 +
> >  xen/include/asm-x86/invpcid.h    | 75 
> > ++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 77 insertions(+)
> >  create mode 100644 xen/include/asm-x86/invpcid.h
> >
> > diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
> > index 9897deaab9..c941059f42 100644
> > --- a/xen/arch/x86/Rules.mk
> > +++ b/xen/arch/x86/Rules.mk
> > @@ -23,6 +23,7 @@ $(call as-option-add,CFLAGS,CC,"rdseed 
> > %eax",-DHAVE_GAS_RDSEED)
> >  $(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1", \
> >                       -U__OBJECT_LABEL__ -DHAVE_GAS_QUOTED_SYM \
> >                       '-D__OBJECT_LABEL__=$(subst 
> > $(BASEDIR)/,,$(CURDIR))/$$@')
> > +$(call as-insn-check,CFLAGS,CC,"invpcid 
> > (%rax)$$(comma)%rax",-DHAVE_GAS_INVPCID)
> 
> Actually, now that we have Clang 6 integrated assembler support, these
> defines really should be s/GAS/AS/.
> 
> Could I trouble someone to global replace across the codebase?

Sure I can do that.

> 
> >  
> >  CFLAGS += -mno-red-zone -fpic -fno-asynchronous-unwind-tables
> >  
> > diff --git a/xen/include/asm-x86/cpufeature.h 
> > b/xen/include/asm-x86/cpufeature.h
> > index 55b696ed07..db8072279d 100644
> > --- a/xen/include/asm-x86/cpufeature.h
> > +++ b/xen/include/asm-x86/cpufeature.h
> > @@ -93,6 +93,7 @@
> >  #define cpu_has_avx2            boot_cpu_has(X86_FEATURE_AVX2)
> >  #define cpu_has_smep            boot_cpu_has(X86_FEATURE_SMEP)
> >  #define cpu_has_bmi2            boot_cpu_has(X86_FEATURE_BMI2)
> > +#define cpu_has_invpcid         boot_cpu_has(X86_FEATURE_INVPCID)
> >  #define cpu_has_rtm             boot_cpu_has(X86_FEATURE_RTM)
> >  #define cpu_has_fpu_sel         (!boot_cpu_has(X86_FEATURE_NO_FPU_SEL))
> >  #define cpu_has_mpx             boot_cpu_has(X86_FEATURE_MPX)
> > diff --git a/xen/include/asm-x86/invpcid.h b/xen/include/asm-x86/invpcid.h
> > new file mode 100644
> > index 0000000000..65a54eab4d
> > --- /dev/null
> > +++ b/xen/include/asm-x86/invpcid.h
> > @@ -0,0 +1,75 @@
> > +#ifndef _ASM_X86_INVPCID_H_
> > +#define _ASM_X86_INVPCID_H_
> > +
> > +#include <xen/types.h>
> > +
> > +#define INVPCID_TYPE_INDIV_ADDR      0
> > +#define INVPCID_TYPE_SINGLE_CTXT     1
> > +#define INVPCID_TYPE_ALL_INCL_GLOBAL 2
> > +#define INVPCID_TYPE_ALL_NON_GLOBAL  3
> > +
> > +struct invpcid_desc {
> > +    uint64_t pcid:12;
> > +    uint64_t reserved:52;
> > +    uint64_t addr;
> > +};
> 
> Thinking about it, this could be hidden inside invpcid.  We've got no
> use for it outside of the wrapper.

That's right.

> 
> > +
> > +#define INVPCID_OPCODE ".byte 0x66, 0x0f, 0x38, 0x82\n"
> > +#define MODRM_ECX_01   ".byte 0x01\n"
> > +
> > +static inline void invpcid(unsigned long pcid, unsigned long addr,
> > +                           unsigned long type)
> 
> pcid and type can drop to just unsigned int.
> 
> Otherwise, LGTM.  Depending on the GAS=>AS transformation, all of these
> issue could be fixed on commit.
> 

We can change GAS to AS here in this patch and I will submit a patch to
s/GAS/AS/g on top of this patch.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to