Skip to contentSkip to conversation

Patch "kvm/svm: Setup MCG_CAP on AMD properly" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Mar 18, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

kvm/svm: Setup MCG_CAP on AMD properly

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
kvm-svm-setup-mcg_cap-on-amd-properly.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Sun Mar 18 16:55:33 CET 2018

From: Borislav Petkov <[email protected]>
Date: Sun, 26 Mar 2017 23:51:24 +0200
Subject: kvm/svm: Setup MCG_CAP on AMD properly

From: Borislav Petkov <[email protected]>

[ Upstream commit 74f169090b6f36b867c9df0454366dd9af6f62d1 ]

MCG_CAP[63:9] bits are reserved on AMD. However, on an AMD guest, this MSR returns 0x100010a. More specifically, bit 24 is set, which is simply wrong. That bit is MCG_SER_P and is present only on Intel. Thus, clean up the reserved bits in order not to confuse guests.

---
 arch/x86/kvm/svm.c |    7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/kvm/svm.c +7 -0
@@ -5449,6 +5449,12 @@ static inline void avic_post_state_resto
 	avic_handle_ldr_update(vcpu);
 }
 
+static void svm_setup_mce(struct kvm_vcpu *vcpu)
+{
+	/* [63:9] are reserved. */
+	vcpu->arch.mcg_cap &= 0x1ff;
+}
+
 static struct kvm_x86_ops svm_x86_ops __ro_after_init = {
 	.cpu_has_kvm_support = has_svm,
 	.disabled_by_bios = is_disabled,
@@ -5564,6 +5570,7 @@ static struct kvm_x86_ops svm_x86_ops __
 	.pmu_ops = &amd_pmu_ops,
 	.deliver_posted_interrupt = svm_deliver_avic_intr,
 	.update_pi_irte = svm_update_pi_irte,
+	.setup_mce = svm_setup_mce,
 };
 
 static int __init svm_init(void)

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/x86-mce-handle-broadcasted-mce-gracefully-with-kexec.patch queue-4.9/perf-stat-issue-a-hw-watchdog-disable-hint.patch queue-4.9/x86-mm-make-mmap-map_32bit-work-correctly.patch queue-4.9/edac-altera-fix-peripheral-warnings-for-cyclone5.patch queue-4.9/kvm-svm-setup-mcg_cap-on-amd-properly.patch queue-4.9/x86-mce-init-some-cpu-features-early.patch