Re: [kvm-unit-tests PATCH 4/8] x86/hypercall: enable the test on non-KVM environment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Jun 9, 2021, at 11:37 AM, Jim Mattson <jmattson@xxxxxxxxxx> wrote:
> 
> 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?

I would add VIA for the sake of correctness, although I presume it does not really matter in real-life.





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux