diff mbox

[RFC,Part2,v3,08/26] KVM: X86: Extend CPUID range to include new leaf

Message ID 20170724200303.12197-9-brijesh.singh@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brijesh Singh July 24, 2017, 8:02 p.m. UTC
This CPUID provides the memory encryption support information on
AMD Platform. The complete description for CPUID leaf is available
in APM volume 2, Section 15.34

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
---
 arch/x86/kvm/cpuid.c | 2 +-
 arch/x86/kvm/svm.c   | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Borislav Petkov Sept. 12, 2017, 8:12 p.m. UTC | #1
On Mon, Jul 24, 2017 at 03:02:45PM -0500, Brijesh Singh wrote:
> This CPUID provides the memory encryption support information on
	    ^
	  leaf


> AMD Platform. The complete description for CPUID leaf is available

".. on AMD. Its complete description is available in ..."

> in APM volume 2, Section 15.34
> 
> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
> ---
>  arch/x86/kvm/cpuid.c | 2 +-
>  arch/x86/kvm/svm.c   | 6 ++++++
>  2 files changed, 7 insertions(+), 1 deletion(-)

with the above addressed:

Reviewed-by: Borislav Petkov <bp@suse.de>
diff mbox

Patch

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 59ca2ee..372e969 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -599,7 +599,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;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 1cd7c78..256c9df 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -5131,6 +5131,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);
+
 	}
 }