* [PATCH] targer/i386/cpu: Fix CPUID_HT exposure
@ 2023-10-10 6:05 Xiaoyao Li
2023-10-10 14:20 ` Paolo Bonzini
2023-10-12 9:39 ` Farrah Chen
0 siblings, 2 replies; 3+ messages in thread
From: Xiaoyao Li @ 2023-10-10 6:05 UTC (permalink / raw)
To: Paolo Bonzini, Marcelo Tosatti; +Cc: qemu-devel, xiaoyao.li
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>
---
target/i386/cpu.c | 1 +
target/i386/kvm/kvm.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index cec5d2b7b65e..32c077455f04 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -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,
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index f6c7f7e26869..ab72bcdfad13 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -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
base-commit: cea3ea670fe265421131aad90c36fbb87bc4d206
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] targer/i386/cpu: Fix CPUID_HT exposure
2023-10-10 6:05 [PATCH] targer/i386/cpu: Fix CPUID_HT exposure Xiaoyao Li
@ 2023-10-10 14:20 ` Paolo Bonzini
2023-10-12 9:39 ` Farrah Chen
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2023-10-10 14:20 UTC (permalink / raw)
To: Xiaoyao Li; +Cc: Marcelo Tosatti, qemu-devel
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] targer/i386/cpu: Fix CPUID_HT exposure
2023-10-10 6:05 [PATCH] targer/i386/cpu: Fix CPUID_HT exposure Xiaoyao Li
2023-10-10 14:20 ` Paolo Bonzini
@ 2023-10-12 9:39 ` Farrah Chen
1 sibling, 0 replies; 3+ messages in thread
From: Farrah Chen @ 2023-10-12 9:39 UTC (permalink / raw)
To: Xiaoyao Li; +Cc: mtosatti, pbonzini, qemu-devel, farrah.chen
On 2023-10-10 at 02:05:39 -0400, Xiaoyao Li wrote:
> 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>
> ---
> target/i386/cpu.c | 1 +
> target/i386/kvm/kvm.c | 2 ++
> 2 files changed, 3 insertions(+)
>
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index cec5d2b7b65e..32c077455f04 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -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,
> diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
> index f6c7f7e26869..ab72bcdfad13 100644
> --- a/target/i386/kvm/kvm.c
> +++ b/target/i386/kvm/kvm.c
> @@ -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
Tested-by: Farrah Chen <farrah.chen@intel.com>
>
> base-commit: cea3ea670fe265421131aad90c36fbb87bc4d206
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-12 9:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10 6:05 [PATCH] targer/i386/cpu: Fix CPUID_HT exposure Xiaoyao Li
2023-10-10 14:20 ` Paolo Bonzini
2023-10-12 9:39 ` Farrah Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).