Re: [PATCH v2 06/14] x86/sev: Drop redundant and potentially misleading 'sev_enabled'

From: Tom Lendacky
Date: Thu Jan 14 2021 - 12:55:24 EST


On 1/13/21 6:37 PM, Sean Christopherson wrote:
Drop the sev_enabled flag and switch its one user over to sev_active().
sev_enabled was made redundant with the introduction of sev_status in
commit b57de6cd1639 ("x86/sev-es: Add SEV-ES Feature Detection").
sev_enabled and sev_active() are guaranteed to be equivalent, as each is
true iff 'sev_status & MSR_AMD64_SEV_ENABLED' is true, and are only ever
written in tandem (ignoring compressed boot's version of sev_status).

Removing sev_enabled avoids confusion over whether it refers to the guest
or the host, and will also allow KVM to usurp "sev_enabled" for its own
purposes.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>

Reviewed-by: Tom Lendacky <thomas.lendacky@xxxxxxx>

---
arch/x86/include/asm/mem_encrypt.h | 1 -
arch/x86/mm/mem_encrypt.c | 12 +++++-------
arch/x86/mm/mem_encrypt_identity.c | 1 -
3 files changed, 5 insertions(+), 9 deletions(-)