On Wed, Jun 9, 2021 at 11:32 AM Nadav Amit <nadav.amit@xxxxxxxxx> wrote: > > From: Nadav Amit <nadav.amit@xxxxxxxxx> > > KVM knows to emulate both vmcall and vmmcall regardless of the > actual architecture. Native hardware does not behave this way. Based on > the availability of test-device, figure out that the test is run on > non-KVM environment, and if so, run vmcall/vmmcall based on the actual > architecture. > > Signed-off-by: Nadav Amit <nadav.amit@xxxxxxxxx> > --- > lib/x86/processor.h | 8 ++++++++ > x86/hypercall.c | 31 +++++++++++++++++++++++-------- > 2 files changed, 31 insertions(+), 8 deletions(-) > > diff --git a/lib/x86/processor.h b/lib/x86/processor.h > index abc04b0..517ee70 100644 > --- a/lib/x86/processor.h > +++ b/lib/x86/processor.h > @@ -118,6 +118,14 @@ static inline u8 cpuid_maxphyaddr(void) > return raw_cpuid(0x80000008, 0).a & 0xff; > } > > +static inline bool is_intel(void) > +{ > + struct cpuid c = cpuid(0); > + u32 name[4] = {c.b, c.d, c.c }; > + > + return strcmp((char *)name, "GenuineIntel") == 0; > +} > + Don't VIA CPUs also require vmcall, since they implement VMX rather than SVM?