Skip to content

Commit efb3934

Browse files
Igor Mammedovbonzini
authored andcommitted
x86: cpu: make sure number of addressable IDs for processor cores meets the spec
Accourding Intel's CPUID[EAX=04H] resulting bits 31 - 26 in EAX should be: " **** The nearest power-of-2 integer that is not smaller than (1 + EAX[31:26]) is the number of unique Core_IDs reserved for addressing different processor cores in a physical package. Core ID is a subset of bits of the initial APIC ID. " ensure that values stored in EAX[31-26] always meets this condition. Signed-off-by: Igor Mammedov <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent d426ff9 commit efb3934

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

target/i386/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5287,7 +5287,7 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
52875287
/* QEMU gives out its own APIC IDs, never pass down bits 31..26. */
52885288
*eax &= ~0xFC000000;
52895289
if ((*eax & 31) && cs->nr_cores > 1) {
5290-
*eax |= (cs->nr_cores - 1) << 26;
5290+
*eax |= (pow2ceil(cs->nr_cores) - 1) << 26;
52915291
}
52925292
} else if (cpu->vendor_cpuid_only && IS_AMD_CPU(env)) {
52935293
*eax = *ebx = *ecx = *edx = 0;

0 commit comments

Comments
 (0)