[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH RFC 3/4] x86: add invpcid.h
On 15/02/18 12:10, Wei Liu wrote: > Provide the functions needed for different modes. > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> > --- > xen/include/asm-x86/invpcid.h | 61 > +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 61 insertions(+) > create mode 100644 xen/include/asm-x86/invpcid.h > > diff --git a/xen/include/asm-x86/invpcid.h b/xen/include/asm-x86/invpcid.h > new file mode 100644 > index 0000000000..7c307ecfc3 > --- /dev/null > +++ b/xen/include/asm-x86/invpcid.h > @@ -0,0 +1,61 @@ > +#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; > +}; > + > +static inline void invpcid(unsigned long pcid, unsigned long addr, > + unsigned long type) > +{ > + struct invpcid_desc desc = { .pcid = pcid, .addr = addr }; > + > + asm volatile ("invpcid (%0), %1" > + : : "r" (&desc), "r" (type) : "memory" ); invpcid %[desc], %[type] And you can use [desc] "m" (desc) for the constraint. The structure will be built on the stack, meaning that an %rsp based memory reference is more efficient than forcing the use of a register. We probably also need a -DHAVE_GAS_INVPCID, as INVPCID is newer than some of the instruction groups we already check for. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |