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
This commit is contained in:
Like Xu 2019-08-08 18:10:30 -04:00 committed by Lioncash
parent 1f4c3d6bcc
commit efd887b992
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 3 additions and 0 deletions

View file

@ -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);

View file

@ -1298,6 +1298,8 @@ typedef struct CPUX86State {
TPRAccess tpr_access_type;
unsigned nr_dies;
// Unicorn engine
struct uc_struct *uc;
} CPUX86State;