From 6bfd26f3810e82ce0c8f78f1ad4e5ee7471c11e7 Mon Sep 17 00:00:00 2001 From: vit9696 Date: Wed, 13 May 2020 15:30:03 +0300 Subject: [PATCH] OcCpuLib: Fixed CPU detection crash with QEMU 5.0 and KVM accelerator closes acidanthera/bugtracker#914 --- Changelog.md | 1 + Library/OcCpuLib/OcCpuLib.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 9eb00d2f..ebb46c31 100644 --- a/Changelog.md +++ b/Changelog.md @@ -21,6 +21,7 @@ OpenCore Changelog - Added partial hotkey support to OpenCanopy (e.g. Ctrl+Enter) - Added builtin text renderer compatibility with Shell page mode - Fixed `FadtEnableReset` with too small FACP tables +- Fixed CPU detection crash with QEMU 5.0 and KVM accelerator #### v0.5.8 - Fixed invalid CPU object reference in SSDT-PLUG diff --git a/Library/OcCpuLib/OcCpuLib.c b/Library/OcCpuLib/OcCpuLib.c index 8489acb5..d98c7de8 100755 --- a/Library/OcCpuLib/OcCpuLib.c +++ b/Library/OcCpuLib/OcCpuLib.c @@ -300,9 +300,15 @@ ScanIntelProcessor ( return; } - if (Cpu->Model >= CPU_MODEL_SANDYBRIDGE) { + // + // Some virtual machines like QEMU 5.0 with KVM will fail to read this value. + // REF: https://github.com/acidanthera/bugtracker/issues/914 + // + if (Cpu->Model >= CPU_MODEL_SANDYBRIDGE && !Cpu->Hypervisor) { PkgCstConfigControl.Uint64 = AsmReadMsr64 (MSR_SANDY_BRIDGE_PKG_CST_CONFIG_CONTROL); Cpu->CstConfigLock = PkgCstConfigControl.Bits.CFGLock == 1; + } else { + Cpu->CstConfigLock = FALSE; } // -- GitLab