[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 08/18] hw/i386: Update structures for nodes_per_pkg
From: |
Babu Moger |
Subject: |
[PATCH v3 08/18] hw/i386: Update structures for nodes_per_pkg |
Date: |
Tue, 03 Dec 2019 18:37:51 -0600 |
User-agent: |
StGit/unknown-version |
Update structures X86CPUTopoIDs and CPUX86State to hold the nodes_per_pkg. This
is required to build EPYC mode topology.
Signed-off-by: Babu Moger <address@hidden>
---
hw/i386/pc.c | 4 ++++
include/hw/i386/topology.h | 1 +
target/i386/cpu.c | 1 +
target/i386/cpu.h | 1 +
4 files changed, 7 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index df5339c102..5dc11df922 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -870,6 +870,7 @@ static inline void initialize_topo_info(X86CPUTopoInfo
*topo_info,
PCMachineState *pcms,
const MachineState *ms)
{
+ topo_info->nodes_per_pkg = ms->numa_state->num_nodes / ms->smp.sockets;
topo_info->dies_per_pkg = pcms->smp_dies;
topo_info->cores_per_die = ms->smp.cores;
topo_info->threads_per_core = ms->smp.threads;
@@ -1390,11 +1391,13 @@ static void pc_new_cpu(PCMachineState *pcms, int64_t
apic_id, Error **errp)
Object *cpu = NULL;
Error *local_err = NULL;
CPUX86State *env = NULL;
+ MachineState *ms = MACHINE(pcms);
cpu = object_new(MACHINE(pcms)->cpu_type);
env = &X86_CPU(cpu)->env;
env->nr_dies = pcms->smp_dies;
+ env->nr_nodes = ms->numa_state->num_nodes / ms->smp.sockets;
object_property_set_uint(cpu, apic_id, "apic-id", &local_err);
object_property_set_bool(cpu, true, "realized", &local_err);
@@ -2242,6 +2245,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
initialize_topo_info(&topo_info, pcms, ms);
env->nr_dies = pcms->smp_dies;
+ env->nr_nodes = ms->numa_state->num_nodes / ms->smp.sockets;
/*
* If APIC ID is not set,
diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h
index 1238006208..cfb09312fe 100644
--- a/include/hw/i386/topology.h
+++ b/include/hw/i386/topology.h
@@ -54,6 +54,7 @@ typedef struct X86CPUTopoIDs {
} X86CPUTopoIDs;
typedef struct X86CPUTopoInfo {
+ unsigned nodes_per_pkg;
unsigned dies_per_pkg;
unsigned cores_per_die;
unsigned threads_per_core;
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3c81aa3ecd..9b2608a4c8 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5996,6 +5996,7 @@ static void x86_cpu_initfn(Object *obj)
FeatureWord w;
env->nr_dies = 1;
+ env->nr_nodes = 1;
cpu_set_cpustate_pointers(cpu);
object_property_add(obj, "family", "int",
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index a56d44e405..0ef4fdb55f 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1591,6 +1591,7 @@ typedef struct CPUX86State {
TPRAccess tpr_access_type;
unsigned nr_dies;
+ unsigned nr_nodes;
} CPUX86State;
struct kvm_msrs;
- [PATCH v3 14/18] hw/i386: Introduce topo_ids_from_apicid handler PCMachineState, (continued)
- [PATCH v3 14/18] hw/i386: Introduce topo_ids_from_apicid handler PCMachineState, Babu Moger, 2019/12/03
- [PATCH v3 09/18] i386: Add CPUX86Family type in CPUX86State, Babu Moger, 2019/12/03
- [PATCH v3 15/18] hw/i386: Introduce apic_id_from_topo_ids handler in PCMachineState, Babu Moger, 2019/12/03
- [PATCH v3 11/18] i386: Cleanup and use the EPYC mode topology functions, Babu Moger, 2019/12/03
- [PATCH v3 04/18] hw/i386: Introduce initialize_topo_info to initialize X86CPUTopoInfo, Babu Moger, 2019/12/03
- [PATCH v3 02/18] hw/i386: Introduce X86CPUTopoInfo to contain topology info, Babu Moger, 2019/12/03
- [PATCH v3 16/18] hw/i386: Introduce EPYC mode function handlers, Babu Moger, 2019/12/03
- [PATCH v3 12/18] numa: Split the numa initialization, Babu Moger, 2019/12/03
- [PATCH v3 13/18] hw/i386: Introduce apicid_from_cpu_idx in PCMachineState, Babu Moger, 2019/12/03
- [PATCH v3 07/18] machine: Add a new function init_apicid_fn in MachineClass, Babu Moger, 2019/12/03
- [PATCH v3 08/18] hw/i386: Update structures for nodes_per_pkg,
Babu Moger <=
- [PATCH v3 06/18] hw/core: Add core complex id in X86CPU topology, Babu Moger, 2019/12/03
- [PATCH v3 05/18] machine: Add SMP Sockets in CpuTopology, Babu Moger, 2019/12/03
- [PATCH v3 03/18] hw/i386: Consolidate topology functions, Babu Moger, 2019/12/03
- [PATCH v3 01/18] hw/i386: Rename X86CPUTopoInfo structure to X86CPUTopoIDs, Babu Moger, 2019/12/03