Re: [sos-linux-ext-patches] [PATCH v4 2/8] KVM: selftests: SEV-SNP test for KVM_SEV_INIT2

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

 




On 11/15/2024 5:10 AM, Pratik R. Sampat wrote:
> Add the X86_FEATURE_SNP CPU feature to the architectural definition for
> the SEV-SNP VM type to exercise the KVM_SEV_INIT2 call. Ensure that the
> SNP test is skipped in scenarios where CPUID supports it but KVM does
> not, so that a failure is not reported in such cases.
> 
> Signed-off-by: Pratik R. Sampat <pratikrajesh.sampat@xxxxxxx>
> ---
>  .../selftests/kvm/include/x86_64/processor.h        |  1 +
>  .../testing/selftests/kvm/x86_64/sev_init2_tests.c  | 13 +++++++++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> index 645200e95f89..c18d2405798f 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> @@ -199,6 +199,7 @@ struct kvm_x86_cpu_feature {
>  #define	X86_FEATURE_VGIF		KVM_X86_CPU_FEATURE(0x8000000A, 0, EDX, 16)
>  #define X86_FEATURE_SEV			KVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 1)

Unrelated to your patch, X86_FEATURE_SEV does not match the KVM API definitions,
1 is used for KVM_X86_SW_PROTECTED_VM 

  #define KVM_X86_DEFAULT_VM    0
  #define KVM_X86_SW_PROTECTED_VM       1
  #define KVM_X86_SEV_VM        2
  #define KVM_X86_SEV_ES_VM     3


>  #define X86_FEATURE_SEV_ES		KVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 3)
> +#define X86_FEATURE_SNP			KVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 4)

Additionally, please add KVM_X86_SNP_VM to the Documentation/virt/kvm/api.rst

Regards
Nikunj




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux