Re: [PATCH] x86/sev: Dump SEV_STATUS

From: Jeremi Piotrowski
Date: Wed Feb 14 2024 - 11:39:32 EST


On Tue, Feb 13, 2024 at 05:33:11PM +0100, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@xxxxxxxxx>
>
> It is, and will be even more useful in the future, to dump the SEV
> features enabled according to SEV_STATUS. Do so:
>
> [ 0.542753] Memory Encryption Features active: AMD SEV SEV-ES SEV-SNP
> [ 0.544425] SEV: Status: SEV SEV-ES SEV-SNP DebugSwap
>

This could use some commas/delimiters to improve readability for those multi-word
bits (or stick to the name from the APM). This is from an Azure SNP CVM(*):

Feb 14 16:16:55 vm kernel: SEV: Status: SEV SEV-ES SEV-SNP vTom Reflect VC AI DebugSwap No HostIBS BTB Isol VMSA reg prot

(*): tested with the below patch applied (I'm not suggesting this should be
incorporated) because from a kernel point of view only vTOM is present in the
cached sev_status, the rest is handled by VMPL0:

--- a/arch/x86/kernel/sev.c
+++ b/arch/x86/kernel/sev.c
@@ -2285,6 +2285,8 @@
void sev_show_status(void)
{
int i;
+ u64 sev_status;
+ rdmsrl(MSR_AMD64_SEV, sev_status);

pr_info("Status: ");
for (i = 0; i < MSR_AMD64_SNP_RESV_BIT; i++) {