KVM: X86: Extend CPUID range to include new leaf
authorBrijesh Singh <[email protected]>
Mon, 4 Dec 2017 16:57:25 +0000 (10:57 -0600)
committerBrijesh Singh <[email protected]>
Mon, 4 Dec 2017 16:57:25 +0000 (10:57 -0600)
This CPUID leaf provides the memory encryption support information on
AMD Platform. Its complete description is available in APM volume 2,
Section 15.34

Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: "Radim Krčmář" <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Tom Lendacky <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Borislav Petkov <[email protected]>
Signed-off-by: Brijesh Singh <[email protected]>
arch/x86/kvm/cpuid.c
arch/x86/kvm/svm.c

index 0099e10eb045253f2be9ec19603c55007d5789d1..c6473ca825cdd875dbfe19b5197549098ad40e5d 100644 (file)
@@ -604,7 +604,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
                entry->edx = 0;
                break;
        case 0x80000000:
-               entry->eax = min(entry->eax, 0x8000001a);
+               entry->eax = min(entry->eax, 0x8000001f);
                break;
        case 0x80000001:
                entry->edx &= kvm_cpuid_8000_0001_edx_x86_features;
index e403cf1f6ba3d3c350849808a67b0a670e59fcf0..7e302a25bc45507f2b31b482c8cea0e3b462faa4 100644 (file)
@@ -5170,6 +5170,12 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
                        entry->edx |= SVM_FEATURE_NPT;
 
                break;
+       case 0x8000001F:
+               /* Support memory encryption cpuid if host supports it */
+               if (boot_cpu_has(X86_FEATURE_SEV))
+                       cpuid(0x8000001f, &entry->eax, &entry->ebx,
+                               &entry->ecx, &entry->edx);
+
        }
 }