qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: cpu: fixup number of addressable IDs for processor cores in the physical package
@ 2024-05-27  3:13 Chuang Xu
  2024-05-27 15:03 ` Igor Mammedov
  2024-05-28  2:31 ` Zhao Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Chuang Xu @ 2024-05-27  3:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, xieyongji, Chuang Xu, Guixiong Wei, Yipeng Yin

When QEMU is started with:
-cpu host,host-cache-info=on,l3-cache=off \
-smp 2,sockets=1,dies=1,cores=1,threads=2
Guest can't acquire maximum number of addressable IDs for processor cores in
the physical package from CPUID[04H].

This bug was introduced in commit d7caf13b5fcf742e5680c1d3448ba070fc811644.
Fix it by changing the judgement condition to a >= 1.

Signed-off-by: Chuang Xu <xuchuangxclwt@bytedance.com>
Signed-off-by: Guixiong Wei <weiguixiong@bytedance.com>
Signed-off-by: Yipeng Yin <yinyipeng@bytedance.com>
---
 target/i386/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index cd16cb893d..0369c01153 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6097,7 +6097,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
             if (*eax & 31) {
                 int host_vcpus_per_cache = 1 + ((*eax & 0x3FFC000) >> 14);
                 int vcpus_per_socket = cs->nr_cores * cs->nr_threads;
-                if (cs->nr_cores > 1) {
+                if (cs->nr_cores >= 1) {
                     *eax &= ~0xFC000000;
                     *eax |= (pow2ceil(cs->nr_cores) - 1) << 26;
                 }
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-28  3:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27  3:13 [PATCH] x86: cpu: fixup number of addressable IDs for processor cores in the physical package Chuang Xu
2024-05-27 15:03 ` Igor Mammedov
2024-05-27 16:56   ` Zhao Liu
2024-05-28  2:31 ` Zhao Liu
2024-05-28  3:34   ` Chuang Xu

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).