Skip to content

Commit 50a8a6b

Browse files
Chuang XuMichael Tokarev
authored andcommitted
i386/cpu: fixup number of addressable IDs for processor cores in the physical package
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]. When creating a CPU topology of 1 core per package, host-cache-info only uses the Host's addressable core IDs field (CPUID.04H.EAX[bits 31-26]), resulting in a conflict (on the multicore Host) between the Guest core topology information in this field and the Guest's actual cores number. Fix it by removing the unnecessary condition to cover 1 core per package case. This is safe because cores_per_pkg will not be 0 and will be at least 1. Fixes: d7caf13 ("x86: cpu: fixup number of addressable IDs for logical processors sharing cache") Signed-off-by: Guixiong Wei <[email protected]> Signed-off-by: Yipeng Yin <[email protected]> Signed-off-by: Chuang Xu <[email protected]> Reviewed-by: Zhao Liu <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 903916f) Signed-off-by: Michael Tokarev <[email protected]> (Mjt: fixup for 9.0 due to other changes in this area past 9.0)
1 parent bbbbc04 commit 50a8a6b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

target/i386/cpu.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6097,10 +6097,8 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
60976097
if (*eax & 31) {
60986098
int host_vcpus_per_cache = 1 + ((*eax & 0x3FFC000) >> 14);
60996099
int vcpus_per_socket = cs->nr_cores * cs->nr_threads;
6100-
if (cs->nr_cores > 1) {
6101-
*eax &= ~0xFC000000;
6102-
*eax |= (pow2ceil(cs->nr_cores) - 1) << 26;
6103-
}
6100+
*eax &= ~0xFC000000;
6101+
*eax |= (pow2ceil(cs->nr_cores) - 1) << 26;
61046102
if (host_vcpus_per_cache > vcpus_per_socket) {
61056103
*eax &= ~0x3FFC000;
61066104
*eax |= (pow2ceil(vcpus_per_socket) - 1) << 14;

0 commit comments

Comments
 (0)