Home Home > GIT Browse > openSUSE-15.0
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Rogers <brogers@suse.com>2013-01-18 16:35:55 -0700
committerBruce Rogers <brogers@suse.com>2013-01-18 16:36:03 -0700
commit58aabfd3350bc0fd07a3706213499b03e8fcd02d (patch)
treeb941f70c2a6e99f681699bdd583d8b02c79e3c58
parentd37323c0fb9ffbb2ad6e4a97224601c53e57141a (diff)
KVM: x86: Fix invalid secondary exec controls inrpm-3.0.58-0.9
vmx_cpuid_update() (bnc#799412, fate#313826).
-rw-r--r--patches.arch/kvm-x86-fix-invalid-secondary-exec-controls-in-vmx_cpuid_update.patch76
-rw-r--r--series.conf1
2 files changed, 77 insertions, 0 deletions
diff --git a/patches.arch/kvm-x86-fix-invalid-secondary-exec-controls-in-vmx_cpuid_update.patch b/patches.arch/kvm-x86-fix-invalid-secondary-exec-controls-in-vmx_cpuid_update.patch
new file mode 100644
index 0000000000..53783b2648
--- /dev/null
+++ b/patches.arch/kvm-x86-fix-invalid-secondary-exec-controls-in-vmx_cpuid_update.patch
@@ -0,0 +1,76 @@
+From 29282fde80d44e587f8c152b10049a56e61659f0 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 9 Nov 2012 15:20:17 +0100
+Subject: KVM: x86: Fix invalid secondary exec controls in vmx_cpuid_update()
+Git-commit: 29282fde80d44e587f8c152b10049a56e61659f0
+Patch-mainline: v3.7
+References: bnc#799412, fate#313826
+
+The commit [ad756a16: KVM: VMX: Implement PCID/INVPCID for guests with
+EPT] introduced the unconditional access to SECONDARY_VM_EXEC_CONTROL,
+and this triggers kernel warnings like below on old CPUs:
+
+ vmwrite error: reg 401e value a0568000 (err 12)
+ Pid: 13649, comm: qemu-kvm Not tainted 3.7.0-rc4-test2+ #154
+ Call Trace:
+ [<ffffffffa0558d86>] vmwrite_error+0x27/0x29 [kvm_intel]
+ [<ffffffffa054e8cb>] vmcs_writel+0x1b/0x20 [kvm_intel]
+ [<ffffffffa054f114>] vmx_cpuid_update+0x74/0x170 [kvm_intel]
+ [<ffffffffa03629b6>] kvm_vcpu_ioctl_set_cpuid2+0x76/0x90 [kvm]
+ [<ffffffffa0341c67>] kvm_arch_vcpu_ioctl+0xc37/0xed0 [kvm]
+ [<ffffffff81143f7c>] ? __vunmap+0x9c/0x110
+ [<ffffffffa0551489>] ? vmx_vcpu_load+0x39/0x1a0 [kvm_intel]
+ [<ffffffffa0340ee2>] ? kvm_arch_vcpu_load+0x52/0x1a0 [kvm]
+ [<ffffffffa032dcd4>] ? vcpu_load+0x74/0xd0 [kvm]
+ [<ffffffffa032deb0>] kvm_vcpu_ioctl+0x110/0x5e0 [kvm]
+ [<ffffffffa032e93d>] ? kvm_dev_ioctl+0x4d/0x4a0 [kvm]
+ [<ffffffff8117dc6f>] do_vfs_ioctl+0x8f/0x530
+ [<ffffffff81139d76>] ? remove_vma+0x56/0x60
+ [<ffffffff8113b708>] ? do_munmap+0x328/0x400
+ [<ffffffff81187c8c>] ? fget_light+0x4c/0x100
+ [<ffffffff8117e1a1>] sys_ioctl+0x91/0xb0
+ [<ffffffff815a942d>] system_call_fastpath+0x1a/0x1f
+
+This patch adds a check for the availability of secondary exec
+control to avoid these warnings.
+
+Cc: <stable@vger.kernel.org> [v3.6+]
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
+Acked-by: Bruce Rogers <brogers@suse.com>
+---
+ arch/x86/kvm/vmx.c | 11 +++++++----
+ 1 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
+index ad6b1dd..f858159 100644
+--- a/arch/x86/kvm/vmx.c
++++ b/arch/x86/kvm/vmx.c
+@@ -6549,19 +6549,22 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
+ }
+ }
+
+- exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
+ /* Exposing INVPCID only when PCID is exposed */
+ best = kvm_find_cpuid_entry(vcpu, 0x7, 0);
+ if (vmx_invpcid_supported() &&
+ best && (best->ebx & bit(X86_FEATURE_INVPCID)) &&
+ guest_cpuid_has_pcid(vcpu)) {
++ exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
+ exec_control |= SECONDARY_EXEC_ENABLE_INVPCID;
+ vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
+ exec_control);
+ } else {
+- exec_control &= ~SECONDARY_EXEC_ENABLE_INVPCID;
+- vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
+- exec_control);
++ if (cpu_has_secondary_exec_ctrls()) {
++ exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
++ exec_control &= ~SECONDARY_EXEC_ENABLE_INVPCID;
++ vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
++ exec_control);
++ }
+ if (best)
+ best->ebx &= ~bit(X86_FEATURE_INVPCID);
+ }
+
diff --git a/series.conf b/series.conf
index b4c36a5040..f7bd71afff 100644
--- a/series.conf
+++ b/series.conf
@@ -7994,6 +7994,7 @@
patches.arch/x86-cpufeature-invpcid.patch
patches.arch/x86-kvm-invpcid.patch
patches.arch/kvm-x86-check-invpcid-feature-bit-in-ebx-of-leaf-7.patch
+ patches.arch/kvm-x86-fix-invalid-secondary-exec-controls-in-vmx_cpuid_update.patch
# S390 CCW bus and bump s390 kvm to mostly 3.9 state (FATE#310914)
patches.arch/s390-kvm-0001-kvm-handle-tprot-intercepts.patch