]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
target/i386/cpu: Fix CPUID_HT exposure
authorXiaoyao Li <xiaoyao.li@intel.com>
Tue, 10 Oct 2023 06:05:39 +0000 (02:05 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 17 Oct 2023 13:20:46 +0000 (15:20 +0200)
When explicitly booting a multiple vcpus vm with "-cpu +ht", it gets
warning of

  warning: host doesn't support requested feature: CPUID.01H:EDX.ht [bit 28]

Make CPUID_HT as supported unconditionally can resolve the warning.
However it introduces another issue that it also expose CPUID_HT to
guest when "-cpu host/max" with only 1 vcpu. To fix this, need mark
CPUID_HT as the no_autoenable_flags.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-ID: <20231010060539.210258-1-xiaoyao.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/cpu.c
target/i386/kvm/kvm.c

index 3aab05ddadc479bc7f6b89c2180d85f2db71e08c..bdca901dfaa4ad62a071dd061b97a337ee0d4206 100644 (file)
@@ -778,6 +778,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {.eax = 1, .reg = R_EDX, },
         .tcg_features = TCG_FEATURES,
+        .no_autoenable_flags = CPUID_HT,
     },
     [FEAT_1_ECX] = {
         .type = CPUID_FEATURE_WORD,
index f6c7f7e26869343d2707188602cb184073c374a2..ab72bcdfad13ba980b3444a993534626141c605b 100644 (file)
@@ -373,6 +373,8 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
     if (function == 1 && reg == R_EDX) {
         /* KVM before 2.6.30 misreports the following features */
         ret |= CPUID_MTRR | CPUID_PAT | CPUID_MCE | CPUID_MCA;
+        /* KVM never reports CPUID_HT but QEMU can support when vcpus > 1 */
+        ret |= CPUID_HT;
     } else if (function == 1 && reg == R_ECX) {
         /* We can set the hypervisor flag, even if KVM does not return it on
          * GET_SUPPORTED_CPUID