hw/i386: fw_cfg: do not set VMX feature control on WHPX
Hyper-V doesn't allow setting this bit on build 26100. Signed-off-by: Mohamed Mediouni <mohamed@unpredictable.fr> Link: https://lore.kernel.org/r/20260812082814.27217-3-mohamed@unpredictable.fr Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Mohamed Mediouni committed
Aug 12, 2026 at 10:28 UTC
32452bac6d991e9778dd7a9fb2b3eed3a2b23d71
1 file changed
+11
-2
hw/i386/fw_cfg.c
+11
-2
@@ -13,6 +13,8 @@
13
*/
14
15
#include "qemu/osdep.h"
16
+#include "system/mshv.h"
17
+#include "system/whpx.h"
18
#include "system/numa.h"
19
#include "hw/acpi/acpi.h"
20
#include "hw/acpi/aml-build.h"
@@ -182,8 +184,15 @@ void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg)
184
uint64_t *val;
185
186
cpu_x86_cpuid(env, 1, 0, &unused, &unused, &ecx, &edx);
185
- if (ecx & CPUID_EXT_VMX) {
186
- feature_control_bits |= FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;
187
+
188
+ /*
189
+ * Hyper-V in 26100 disallows this bit to be set.
190
+ * Otherwise a #GP gets raised.
191
+ */
192
+ if (!(whpx_enabled())) {
193
+ if (ecx & CPUID_EXT_VMX) {
194
+ feature_control_bits |= FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX;
195
+ }
196
}
197
198
if ((edx & (CPUID_EXT2_MCE | CPUID_EXT2_MCA)) ==