[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 52/52] i386: Support cpu_index_to_core_type() for x86
From: |
Zhao Liu |
Subject: |
[RFC 52/52] i386: Support cpu_index_to_core_type() for x86 |
Date: |
Mon, 13 Feb 2023 17:50:35 +0800 |
From: Zhao Liu <zhao1.liu@intel.com>
The cpu_index_to_core_type() of MachineClass is implemented in x86 to
obtain the string name of core type, so that users can get the basic
topology information (topology type and core type) of x86 machine
(currently, only PC machine) in query_cpus_fast.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
hw/i386/x86.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index f58a90359170..67318a527c6c 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -1583,6 +1583,38 @@ static int x86_parse_hybrid_core_type(MachineState *ms,
const char *coretype)
return type;
}
+static const char *x86_cpu_index_to_hybrid_core_type(MachineState *machine,
+ unsigned cpu_index)
+{
+ CPUState *cs;
+
+ if (machine_topo_is_smp(machine)) {
+ return NULL;
+ }
+
+ CPU_FOREACH(cs) {
+ X86CPU *cpu = X86_CPU(cs);
+ CPUX86State *env = &cpu->env;
+
+ if (cs->cpu_index == cpu_index) {
+ const char *core_type;
+
+ switch (env->hybrid_core_type) {
+ case INTEL_ATOM_TYPE:
+ core_type = "atom";
+ break;
+ case INTEL_CORE_TYPE:
+ core_type = "core";
+ break;
+ default:
+ abort();
+ }
+ return core_type;
+ }
+ }
+ return NULL;
+}
+
static void x86_machine_initfn(Object *obj)
{
X86MachineState *x86ms = X86_MACHINE(obj);
@@ -1611,6 +1643,7 @@ static void x86_machine_class_init(ObjectClass *oc, void
*data)
x86mc->fwcfg_dma_enabled = true;
nc->nmi_monitor_handler = x86_nmi;
mc->core_type = x86_parse_hybrid_core_type;
+ mc->cpu_index_to_core_type = x86_cpu_index_to_hybrid_core_type;
object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto",
x86_machine_get_smm, x86_machine_set_smm,
--
2.34.1
- [RFC 39/52] i386/cpu: Add Intel hybrid related CPUID support, (continued)
- [RFC 39/52] i386/cpu: Add Intel hybrid related CPUID support, Zhao Liu, 2023/02/13
- [RFC 43/52] hw/machine: Rename MachineClass.smp_props to MachineClass.topo_props, Zhao Liu, 2023/02/13
- [RFC 44/52] machine: Add "-hybrid" parsing rule, Zhao Liu, 2023/02/13
- [RFC 45/52] hw/machine: Add hybrid cpu topology validation, Zhao Liu, 2023/02/13
- [RFC 47/52] hw/machine: Use opts_visitor to parse hybrid topo, Zhao Liu, 2023/02/13
- [RFC 46/52] hw/machine: build core level hybrid topology form HybridCorePack, Zhao Liu, 2023/02/13
- [RFC 48/52] machine: Support "-hybrid" command, Zhao Liu, 2023/02/13
- [RFC 49/52] i386/pc: Support hybrid cpu topology, Zhao Liu, 2023/02/13
- [RFC 50/52] qemu-options: Add the document of hybrid command, Zhao Liu, 2023/02/13
- [RFC 51/52] qapi: Expose CPU topology info in query_cpus_fast, Zhao Liu, 2023/02/13
- [RFC 52/52] i386: Support cpu_index_to_core_type() for x86,
Zhao Liu <=
- Re: [RFC 00/52] Introduce hybrid CPU topology, Alex Bennée, 2023/02/13
- Re: [RFC 00/52] Introduce hybrid CPU topology, Daniel P . Berrangé, 2023/02/13