From efd887b992fe543ce6004b6d8e718d11dd05f1ba Mon Sep 17 00:00:00 2001 From: Like Xu Date: Thu, 8 Aug 2019 18:10:30 -0400 Subject: [PATCH] i386: Add die-level cpu topology to x86CPU on PCMachine The die-level as the first PC-specific cpu topology is added to the leagcy cpu topology model, which has one die per package implicitly and only the numbers of sockets/cores/threads are configurable. In the new model with die-level support, the total number of logical processors (including offline) on board will be calculated as: \#cpus = #sockets * #dies * #cores * #threads and considering compatibility, the default value for #dies would be initialized to one in x86_cpu_initfn() and pc_machine_initfn(). Backports commit c26ae610811e8d52f4fc73e3ae0a8bc4a24d6763 from qemu --- qemu/target/i386/cpu.c | 1 + qemu/target/i386/cpu.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/qemu/target/i386/cpu.c b/qemu/target/i386/cpu.c index 8626ea92..f7935490 100644 --- a/qemu/target/i386/cpu.c +++ b/qemu/target/i386/cpu.c @@ -4803,6 +4803,7 @@ static void x86_cpu_initfn(struct uc_struct *uc, Object *obj, void *opaque) X86CPUClass *xcc = X86_CPU_GET_CLASS(uc, obj); CPUX86State *env = &cpu->env; + env->nr_dies = 1; cpu_set_cpustate_pointers(cpu); cpu_exec_init(cs, &error_abort, opaque); diff --git a/qemu/target/i386/cpu.h b/qemu/target/i386/cpu.h index 854dcc89..56862804 100644 --- a/qemu/target/i386/cpu.h +++ b/qemu/target/i386/cpu.h @@ -1298,6 +1298,8 @@ typedef struct CPUX86State { TPRAccess tpr_access_type; + unsigned nr_dies; + // Unicorn engine struct uc_struct *uc; } CPUX86State;