[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 16/18] hw/i386: Introduce EPYC mode function handlers
From: |
Babu Moger |
Subject: |
[PATCH v3 16/18] hw/i386: Introduce EPYC mode function handlers |
Date: |
Tue, 03 Dec 2019 18:38:46 -0600 |
User-agent: |
StGit/unknown-version |
Introduce following handlers for new epyc mode.
x86_apicid_from_cpu_idx_epyc: Generate apicid from cpu index.
x86_topo_ids_from_apicid_epyc: Generate topo ids from apic id.
x86_apicid_from_topo_ids_epyc: Generate apicid from topo ids.
Signed-off-by: Babu Moger <address@hidden>
---
hw/i386/pc.c | 12 ++++++++++++
include/hw/i386/topology.h | 4 ++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index e6c8a458e7..64e3658873 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -2819,6 +2819,17 @@ static bool pc_hotplug_allowed(MachineState *ms,
DeviceState *dev, Error **errp)
return true;
}
+static void pc_init_apicid_fn(MachineState *ms)
+{
+ PCMachineState *pcms = PC_MACHINE(ms);
+
+ if (!strncmp(ms->cpu_type, "EPYC", 4)) {
+ pcms->apicid_from_cpu_idx = x86_apicid_from_cpu_idx_epyc;
+ pcms->topo_ids_from_apicid = x86_topo_ids_from_apicid_epyc;
+ pcms->apicid_from_topo_ids = x86_apicid_from_topo_ids_epyc;
+ }
+}
+
static void pc_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -2847,6 +2858,7 @@ static void pc_machine_class_init(ObjectClass *oc, void
*data)
mc->cpu_index_to_instance_props = pc_cpu_index_to_props;
mc->get_default_cpu_node_id = pc_get_default_cpu_node_id;
mc->possible_cpu_arch_ids = pc_possible_cpu_arch_ids;
+ mc->init_apicid_fn = pc_init_apicid_fn;
mc->auto_enable_numa_with_memhp = true;
mc->has_hotpluggable_cpus = true;
mc->default_boot_order = "cad";
diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h
index b2b9e93a06..f028d2332a 100644
--- a/include/hw/i386/topology.h
+++ b/include/hw/i386/topology.h
@@ -140,7 +140,7 @@ static inline unsigned
apicid_pkg_offset_epyc(X86CPUTopoInfo *topo_info)
*
* The caller must make sure core_id < nr_cores and smt_id < nr_threads.
*/
-static inline apic_id_t apicid_from_topo_ids_epyc(X86CPUTopoInfo *topo_info,
+static inline apic_id_t x86_apicid_from_topo_ids_epyc(X86CPUTopoInfo
*topo_info,
const X86CPUTopoIDs
*topo_ids)
{
return (topo_ids->pkg_id << apicid_pkg_offset_epyc(topo_info)) |
@@ -200,7 +200,7 @@ static inline apic_id_t
x86_apicid_from_cpu_idx_epyc(X86CPUTopoInfo *topo_info,
{
X86CPUTopoIDs topo_ids;
x86_topo_ids_from_idx_epyc(topo_info, cpu_index, &topo_ids);
- return apicid_from_topo_ids_epyc(topo_info, &topo_ids);
+ return x86_apicid_from_topo_ids_epyc(topo_info, &topo_ids);
}
/* Make APIC ID for the CPU based on Pkg_ID, Core_ID, SMT_ID
*
- [PATCH v3 00/18] APIC ID fixes for AMD EPYC CPU models, Babu Moger, 2019/12/03
- [PATCH v3 10/18] hw/386: Add EPYC mode topology decoding functions, Babu Moger, 2019/12/03
- [PATCH v3 17/18] i386: Fix pkg_id offset for epyc mode, Babu Moger, 2019/12/03
- [PATCH v3 18/18] tests: Update the Unit tests, Babu Moger, 2019/12/03
- [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 <=
- [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, 2019/12/03
- [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