Skip to contentSkip to conversation

kvm:x86/svm: enable SVM lock if host supports it

PATCH In review [email protected] 2 participants 3 messages Apr 17, 2013 – Apr 21, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm:x86/svm: enable SVM lock if host supports it

From: Prasad Joshi <[email protected]>

SVM lock features allows software from preventing update to EFER.SVME. Enable the SVM lock in guest if it is supported on host machine.

---
 arch/x86/kvm/svm.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kvm/svm.c +4 -0
index e1b1ce2..fcdfdea 100644
@@ -4031,6 +4031,10 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
 		if (boot_cpu_has(X86_FEATURE_NRIPS))
 			entry->edx |= SVM_FEATURE_NRIP;
 
+		/* support SVM Lock if host supports it */
+		if (boot_cpu_has(X86_FEATURE_SVML))
+			entry->edx |= SVM_FEATURE_SVML;
+
 		/* Support NPT for the guest if enabled */
 		if (npt_enabled)
 			entry->edx |= SVM_FEATURE_NPT;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 15 lines · On Wed, Apr 17, 2013 at 11:03:33PM +0530, [email protected] wrote:

From: Prasad Joshi <[email protected]>

SVM lock features allows software from preventing update to EFER.SVME. Enable the SVM lock in guest if it is supported on host machine.

---
 arch/x86/kvm/svm.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kvm/svm.c +0 -0
index e1b1ce2..fcdfdea 100644

arch/x86/kvm/svm.c static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) · line 4037

Quoted 7 lines
arch/x86/kvm/svm.c +4 -0
@@ -4031,6 +4031,10 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
 		if (boot_cpu_has(X86_FEATURE_NRIPS))
 			entry->edx |= SVM_FEATURE_NRIP;
 
+		/* support SVM Lock if host supports it */
+		if (boot_cpu_has(X86_FEATURE_SVML))
+			entry->edx |= SVM_FEATURE_SVML;
+

No. SVM lock is way more complex to emulate than just setting the CPUID bit.

Joerg

#2 lore raw
Quoted 19 lines · Joerg Roedel
Quoted 18 lines · On Wed, Apr 17, 2013 at 11:03:33PM +0530, [email protected] wrote:

From: Prasad Joshi <[email protected]>

SVM lock features allows software from preventing update to EFER.SVME. Enable the SVM lock in guest if it is supported on host machine.

---
 arch/x86/kvm/svm.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/x86/kvm/svm.c +0 -0
index e1b1ce2..fcdfdea 100644
@@ -4031,6 +4031,10 @@ static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry)
              if (boot_cpu_has(X86_FEATURE_NRIPS))
                      entry->edx |= SVM_FEATURE_NRIP;
 
Quoted 7 lines

arch/x86/kvm/svm.c static void svm_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) · line 4037

Quoted 4 lines
arch/x86/kvm/svm.c +4 -0
+             /* support SVM Lock if host supports it */
+             if (boot_cpu_has(X86_FEATURE_SVML))
+                     entry->edx |= SVM_FEATURE_SVML;
+

No. SVM lock is way more complex to emulate than just setting the CPUID bit.

Hello Joerg,

I suppose you meant, SVM_KEY MSR to lock/unlock the VM_CR.LOCK. If I am correct, I just sent couple of patches. Can you please review them?

Thanks and Warm Regards,
Prasad

Quoted 5 lines

Joerg