Add CPUX86Family type in CPUX86State. This will be used to differentiate generic x86 and x86 EPYC based cpu models.
Signed-off-by: Babu Moger <babu.mo...@amd.com> --- hw/i386/pc.c | 4 ++++ target/i386/cpu.c | 1 + target/i386/cpu.h | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 5dc11df922..7f30104a6b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1398,6 +1398,8 @@ static void pc_new_cpu(PCMachineState *pcms, int64_t apic_id, Error **errp) env = &X86_CPU(cpu)->env; env->nr_dies = pcms->smp_dies; env->nr_nodes = ms->numa_state->num_nodes / ms->smp.sockets; + env->family_type = strncmp(ms->cpu_type, "EPYC", 4) ? CPUX86FAMILY_DEFAULT : + CPUX86FAMILY_EPYC; object_property_set_uint(cpu, apic_id, "apic-id", &local_err); object_property_set_bool(cpu, true, "realized", &local_err); @@ -2246,6 +2248,8 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev, env->nr_dies = pcms->smp_dies; env->nr_nodes = ms->numa_state->num_nodes / ms->smp.sockets; + env->family_type = strncmp(ms->cpu_type, "EPYC", 4) ? CPUX86FAMILY_DEFAULT : + CPUX86FAMILY_EPYC; /* * If APIC ID is not set, diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 9b2608a4c8..5629c6d4c1 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5997,6 +5997,7 @@ static void x86_cpu_initfn(Object *obj) env->nr_dies = 1; env->nr_nodes = 1; + env->family_type = CPUX86FAMILY_DEFAULT; cpu_set_cpustate_pointers(cpu); object_property_add(obj, "family", "int", diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 0ef4fdb55f..105744430b 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1284,6 +1284,11 @@ typedef enum TPRAccess { TPR_ACCESS_WRITE, } TPRAccess; +typedef enum CPUX86Family { + CPUX86FAMILY_DEFAULT = 0, + CPUX86FAMILY_EPYC, +} CPUX86Family; + /* Cache information data structures: */ enum CacheType { @@ -1590,6 +1595,8 @@ typedef struct CPUX86State { TPRAccess tpr_access_type; + CPUX86Family family_type; + unsigned nr_dies; unsigned nr_nodes; } CPUX86State;