[kvm-unit-tests PATCH 15/16] x86/sev: Use amd_sev_es_enabled() to detect if SEV-ES is enabled

Liam Merwick liam.merwick at oracle.com
Fri May 30 09:22:48 PDT 2025



On 29/05/2025 23:19, Sean Christopherson wrote:
> Use amd_sev_es_enabled() in the SEV string I/O test instead manually
> checking the SEV_STATUS MSR.
> 
> Signed-off-by: Sean Christopherson <seanjc at google.com>
> ---
>   x86/amd_sev.c | 12 ++----------
>   1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/x86/amd_sev.c b/x86/amd_sev.c
> index 4ec45543..7c207a07 100644
> --- a/x86/amd_sev.c
> +++ b/x86/amd_sev.c
> @@ -19,15 +19,6 @@
>   
>   static char st1[] = "abcdefghijklmnop";
>   
> -static void test_sev_es_activation(void)
> -{
> -	if (rdmsr(MSR_SEV_STATUS) & SEV_ES_ENABLED_MASK) {
> -		printf("SEV-ES is enabled.\n");
> -	} else {
> -		printf("SEV-ES is not enabled.\n");
> -	}
> -}
> -
>   static void test_stringio(void)
>   {
>   	int st1_len = sizeof(st1) - 1;
> @@ -52,7 +43,8 @@ int main(void)
>   		goto out;
>   	}
>   
> -	test_sev_es_activation();
> +	printf("SEV-ES is %senabled.\n", amd_sev_es_enabled() ? "" : "not");

Add a space after 'not' to avoid "notenabled"

Otherwise
Reviewed-by: Liam Merwick <liam.merwick at oracle.com>

> +
>   	test_stringio();
>   
>   out:




More information about the kvm-riscv mailing list