svn commit: r282336 - in head/sys/amd64/vmm: . amd intel
Neel Natu
neel at FreeBSD.org
Sat May 2 04:19:13 UTC 2015
Author: neel
Date: Sat May 2 04:19:11 2015
New Revision: 282336
URL: https://svnweb.freebsd.org/changeset/base/282336
Log:
Emulate machine check related MSRs to allow guest OSes like Windows to boot.
Reported by: Leon Dang (ldang at nahannisys.com)
MFC after: 2 weeks
Modified:
head/sys/amd64/vmm/amd/svm_msr.c
head/sys/amd64/vmm/intel/vmx_msr.c
head/sys/amd64/vmm/x86.c
Modified: head/sys/amd64/vmm/amd/svm_msr.c
==============================================================================
--- head/sys/amd64/vmm/amd/svm_msr.c Sat May 2 03:25:24 2015 (r282335)
+++ head/sys/amd64/vmm/amd/svm_msr.c Sat May 2 04:19:11 2015 (r282336)
@@ -110,6 +110,10 @@ svm_rdmsr(struct svm_softc *sc, int vcpu
int error = 0;
switch (num) {
+ case MSR_MCG_CAP:
+ case MSR_MCG_STATUS:
+ *result = 0;
+ break;
case MSR_MTRRcap:
case MSR_MTRRdefType:
case MSR_MTRR4kBase ... MSR_MTRR4kBase + 8:
@@ -135,6 +139,9 @@ svm_wrmsr(struct svm_softc *sc, int vcpu
int error = 0;
switch (num) {
+ case MSR_MCG_CAP:
+ case MSR_MCG_STATUS:
+ break; /* ignore writes */
case MSR_MTRRcap:
vm_inject_gp(sc->vm, vcpu);
break;
Modified: head/sys/amd64/vmm/intel/vmx_msr.c
==============================================================================
--- head/sys/amd64/vmm/intel/vmx_msr.c Sat May 2 03:25:24 2015 (r282335)
+++ head/sys/amd64/vmm/intel/vmx_msr.c Sat May 2 04:19:11 2015 (r282336)
@@ -395,6 +395,10 @@ vmx_rdmsr(struct vmx *vmx, int vcpuid, u
error = 0;
switch (num) {
+ case MSR_MCG_CAP:
+ case MSR_MCG_STATUS:
+ *val = 0;
+ break;
case MSR_MTRRcap:
case MSR_MTRRdefType:
case MSR_MTRR4kBase ... MSR_MTRR4kBase + 8:
@@ -433,6 +437,9 @@ vmx_wrmsr(struct vmx *vmx, int vcpuid, u
error = 0;
switch (num) {
+ case MSR_MCG_CAP:
+ case MSR_MCG_STATUS:
+ break; /* ignore writes */
case MSR_MTRRcap:
vm_inject_gp(vmx->vm, vcpuid);
break;
Modified: head/sys/amd64/vmm/x86.c
==============================================================================
--- head/sys/amd64/vmm/x86.c Sat May 2 03:25:24 2015 (r282335)
+++ head/sys/amd64/vmm/x86.c Sat May 2 04:19:11 2015 (r282336)
@@ -285,17 +285,20 @@ x86_emulate_cpuid(struct vm *vm, int vcp
* Hide thermal monitoring
*/
regs[3] &= ~(CPUID_ACPI | CPUID_TM);
-
+
/*
- * Machine check handling is done in the host.
+ * Hide the debug store capability.
*/
- regs[3] &= ~(CPUID_MCA | CPUID_MCE);
-
- /*
- * Hide the debug store capability.
- */
regs[3] &= ~CPUID_DS;
+ /*
+ * Advertise the Machine Check and MTRR capability.
+ *
+ * Some guest OSes (e.g. Windows) will not boot if
+ * these features are absent.
+ */
+ regs[3] |= (CPUID_MCA | CPUID_MCE | CPUID_MTRR);
+
logical_cpus = threads_per_core * cores_per_package;
regs[1] &= ~CPUID_HTT_CORES;
regs[1] |= (logical_cpus & 0xff) << 16;
More information about the svn-src-head
mailing list