Signed-off-by: Krish Sadhukhan <krish.sadhukhan@xxxxxxxxxx> --- arch/x86/include/asm/svm.h | 1 + arch/x86/kvm/svm/svm.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 8a1f5382a4ea..9eea127563fb 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -216,6 +216,7 @@ struct __attribute__ ((__packed__)) vmcb { }; #define SVM_CPUID_FUNC 0x8000000a +#define SVM_SME_CPUID_FUNC 0x8000001f #define SVM_VM_CR_SVM_DISABLE 4 diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 03dd7bac8034..97333b4ece5a 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -749,7 +749,7 @@ static __init void svm_adjust_mmio_mask(void) u64 msr, mask; /* If there is no memory encryption support, use existing mask */ - if (cpuid_eax(0x80000000) < 0x8000001f) + if (cpuid_eax(0x80000000) < SVM_SME_CPUID_FUNC) return; /* If memory encryption is not enabled, use existing mask */ @@ -757,7 +757,7 @@ static __init void svm_adjust_mmio_mask(void) if (!(msr & MSR_K8_SYSCFG_MEM_ENCRYPT)) return; - enc_bit = cpuid_ebx(0x8000001f) & 0x3f; + enc_bit = cpuid_ebx(SVM_SME_CPUID_FUNC) & 0x3f; mask_bit = boot_cpu_data.x86_phys_bits; /* Increment the mask bit if it is the same as the encryption bit */ -- 2.18.4