Re: [PATCH 5/5] x86/CPU/AMD: Track SNP host status with cc_platform_*()

From: Tom Lendacky
Date: Fri Mar 29 2024 - 11:16:35 EST


On 3/27/24 10:43, Borislav Petkov wrote:
From: "Borislav Petkov (AMD)" <bp@xxxxxxxxx>

The host SNP worthiness can determined later, after alternatives have
been patched, in snp_rmptable_init() depending on cmdline options like
iommu=pt which is incompatible with SNP, for example.

Which means that one cannot use X86_FEATURE_SEV_SNP and will need to
have a special flag for that control.

Use that newly added CC_ATTR_HOST_SEV_SNP in the appropriate places.

Move kdump_sev_callback() to its rightfull place, while at it.

Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>

If late disabling of CPU feature flags is ever supported in the future, we should come back and possibly remove this. But until then...

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

---
arch/x86/include/asm/sev.h | 4 ++--
arch/x86/kernel/cpu/amd.c | 38 ++++++++++++++++++------------
arch/x86/kernel/cpu/mtrr/generic.c | 2 +-
arch/x86/kernel/sev.c | 10 --------
arch/x86/kvm/svm/sev.c | 2 +-
arch/x86/virt/svm/sev.c | 26 +++++++++++++-------
drivers/crypto/ccp/sev-dev.c | 2 +-
drivers/iommu/amd/init.c | 4 +++-
8 files changed, 49 insertions(+), 39 deletions(-)