[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 15/18] hw/i386: Introduce apic_id_from_topo_ids handler in PCM
From: |
Babu Moger |
Subject: |
[PATCH v3 15/18] hw/i386: Introduce apic_id_from_topo_ids handler in PCMachineState |
Date: |
Tue, 03 Dec 2019 18:38:39 -0600 |
User-agent: |
StGit/unknown-version |
Add function pointer apic_id_from_topo_ids in PCMachineState.
Initialize with correct handler based on the mode selected.
Also rename the handler apicid_from_topo_ids to x86_apicid_from_topo_ids
for consistency. x86_apicid_from_topo_ids will be the default handler.
Signed-off-by: Babu Moger <address@hidden
---
hw/i386/pc.c | 3 ++-
include/hw/i386/pc.h | 2 ++
include/hw/i386/topology.h | 4 ++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b0d58515dd..e6c8a458e7 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -2305,7 +2305,7 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
topo_ids.llc_id = cpu->llc_id;
topo_ids.core_id = cpu->core_id;
topo_ids.smt_id = cpu->thread_id;
- cpu->apic_id = apicid_from_topo_ids(&topo_info, &topo_ids);
+ cpu->apic_id = pcms->apicid_from_topo_ids(&topo_info, &topo_ids);
}
cpu_slot = pc_find_cpu_slot(MACHINE(pcms), cpu->apic_id, &idx);
@@ -2682,6 +2682,7 @@ static void pc_machine_initfn(Object *obj)
/* Initialize the apic id related handlers */
pcms->apicid_from_cpu_idx = x86_apicid_from_cpu_idx;
pcms->topo_ids_from_apicid = x86_topo_ids_from_apicid;
+ pcms->apicid_from_topo_ids = x86_apicid_from_topo_ids;
pc_system_flash_create(pcms);
}
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index ffc5c78164..0789f8b5ea 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -73,6 +73,8 @@ struct PCMachineState {
unsigned cpu_index);
void (*topo_ids_from_apicid)(apic_id_t apicid, X86CPUTopoInfo *topo_info,
X86CPUTopoIDs *topo_ids);
+ apic_id_t (*apicid_from_topo_ids)(X86CPUTopoInfo *topo_info,
+ const X86CPUTopoIDs *topo_ids);
/* Address space used by IOAPIC device. All IOAPIC interrupts
* will be translated to MSI messages in the address space. */
diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h
index adb92fe9ce..b2b9e93a06 100644
--- a/include/hw/i386/topology.h
+++ b/include/hw/i386/topology.h
@@ -206,7 +206,7 @@ static inline apic_id_t
x86_apicid_from_cpu_idx_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(X86CPUTopoInfo *topo_info,
+static inline apic_id_t x86_apicid_from_topo_ids(X86CPUTopoInfo *topo_info,
const X86CPUTopoIDs *topo_ids)
{
return (topo_ids->pkg_id << apicid_pkg_offset(topo_info)) |
@@ -259,7 +259,7 @@ static inline apic_id_t
x86_apicid_from_cpu_idx(X86CPUTopoInfo *topo_info,
{
X86CPUTopoIDs topo_ids;
x86_topo_ids_from_idx(topo_info, cpu_index, &topo_ids);
- return apicid_from_topo_ids(topo_info, &topo_ids);
+ return x86_apicid_from_topo_ids(topo_info, &topo_ids);
}
#endif /* HW_I386_TOPOLOGY_H */
- [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 <=
- [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, 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