Use X86_PROPERTY_SEV_C_BIT instead of open coding equivalent functionality, and delete the overly-verbose CPUID_FN_ENCRYPT_MEM_CAPAB macro. Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx> --- lib/x86/amd_sev.c | 10 +--------- lib/x86/amd_sev.h | 6 ------ 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/x86/amd_sev.c b/lib/x86/amd_sev.c index b7cefd0f..da0e2077 100644 --- a/lib/x86/amd_sev.c +++ b/lib/x86/amd_sev.c @@ -33,19 +33,11 @@ bool amd_sev_enabled(void) efi_status_t setup_amd_sev(void) { - struct cpuid cpuid_out; - if (!amd_sev_enabled()) { return EFI_UNSUPPORTED; } - /* - * Extract C-Bit position from ebx[5:0] - * AMD64 Architecture Programmer's Manual Volume 3 - * - Section " Function 8000_001Fh - Encrypted Memory Capabilities" - */ - cpuid_out = cpuid(CPUID_FN_ENCRYPT_MEM_CAPAB); - amd_sev_c_bit_pos = (unsigned short)(cpuid_out.b & 0x3f); + amd_sev_c_bit_pos = this_cpu_property(X86_PROPERTY_SEV_C_BIT); return EFI_SUCCESS; } diff --git a/lib/x86/amd_sev.h b/lib/x86/amd_sev.h index defcda75..daa33a05 100644 --- a/lib/x86/amd_sev.h +++ b/lib/x86/amd_sev.h @@ -19,12 +19,6 @@ #include "asm/page.h" #include "efi.h" -/* - * AMD Programmer's Manual Volume 3 - * - Section "Function 8000_001Fh - Encrypted Memory Capabilities" - */ -#define CPUID_FN_ENCRYPT_MEM_CAPAB 0x8000001f - /* * AMD Programmer's Manual Volume 2 * - Section "SEV_STATUS MSR" -- 2.50.0.rc0.642.g800a2b2222-goog