Skip to content

Commit c685eb0

Browse files
joergroedelsuryasaimadhu
authored andcommitted
x86/sev-es: Print SEV-ES info into the kernel log
Refactor the message printed to the kernel log which indicates whether SEV or SME, etc is active. This will scale better in the future when more memory encryption features might be added. Also add SEV-ES to the list of features. [ bp: Massage. ] Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent b57de6c commit c685eb0

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

arch/x86/mm/mem_encrypt.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,31 @@ void __init mem_encrypt_free_decrypted_mem(void)
407407
free_init_pages("unused decrypted", vaddr, vaddr_end);
408408
}
409409

410+
static void print_mem_encrypt_feature_info(void)
411+
{
412+
pr_info("AMD Memory Encryption Features active:");
413+
414+
/* Secure Memory Encryption */
415+
if (sme_active()) {
416+
/*
417+
* SME is mutually exclusive with any of the SEV
418+
* features below.
419+
*/
420+
pr_cont(" SME\n");
421+
return;
422+
}
423+
424+
/* Secure Encrypted Virtualization */
425+
if (sev_active())
426+
pr_cont(" SEV");
427+
428+
/* Encrypted Register State */
429+
if (sev_es_active())
430+
pr_cont(" SEV-ES");
431+
432+
pr_cont("\n");
433+
}
434+
410435
/* Architecture __weak replacement functions */
411436
void __init mem_encrypt_init(void)
412437
{
@@ -422,8 +447,6 @@ void __init mem_encrypt_init(void)
422447
if (sev_active())
423448
static_branch_enable(&sev_enable_key);
424449

425-
pr_info("AMD %s active\n",
426-
sev_active() ? "Secure Encrypted Virtualization (SEV)"
427-
: "Secure Memory Encryption (SME)");
450+
print_mem_encrypt_feature_info();
428451
}
429452

0 commit comments

Comments
 (0)