Skip to contentSkip to conversation

target-i386: do not force-expose WAITPKG if -overcommit cpu-pm=on

PATCH New Paolo Bonzini 1 participant 1 message May 21, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-i386: do not force-expose WAITPKG if -overcommit cpu-pm=on

By force-enabling the WAITPKG bit whenever -overcommit cpu-pm=on is used, commit 67192a298f ("x86/cpu: Add support for UMONITOR/UMWAIT/TPAUSE", 2019-10-23) broke that option is the host processor does not have WAITPKG or the host kernel is too old. This is because TPAUSE, UMWAIT and UMONITOR are not NOPs on older processors (though perhaps they should have been!).

---
 target/i386/kvm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
target/i386/kvm.c +1 -3
index 6513584948..6554fdef3c 100644
@@ -408,9 +408,7 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
             ret &= ~(CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_HLE);
         }
     } else if (function == 7 && index == 0 && reg == R_ECX) {
-        if (enable_cpu_pm) {
-            ret |= CPUID_7_0_ECX_WAITPKG;
-        } else {
+        if (!enable_cpu_pm) {
             ret &= ~CPUID_7_0_ECX_WAITPKG;
         }
     } else if (function == 7 && index == 0 && reg == R_EDX) {
Signature · 1 line
2.25.4