qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v0 2/9] cpu: Store CPU typename in MachineState


From: Bharata B Rao
Subject: [Qemu-devel] [RFC PATCH v0 2/9] cpu: Store CPU typename in MachineState
Date: Thu, 10 Dec 2015 11:45:37 +0530

Storing CPU typename in MachineState lets us to create CPU threads
for all architectures in uniform manner from arch-neutral code.

TODO: Touching only i386 and spapr targets for now

Signed-off-by: Bharata B Rao <address@hidden>
---
 hw/i386/pc.c        | 1 +
 hw/ppc/spapr.c      | 2 ++
 include/hw/boards.h | 1 +
 3 files changed, 4 insertions(+)

diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 5e20e07..ffcd645 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1133,6 +1133,7 @@ void pc_cpus_init(PCMachineState *pcms)
         machine->cpu_model = "qemu32";
 #endif
     }
+    machine->cpu_type = TYPE_X86_CPU;
 
     apic_id_limit = pc_apic_id_limit(max_cpus);
     if (apic_id_limit > ACPI_CPU_HOTPLUG_ID_LIMIT) {
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 030ee35..db441f2 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1797,6 +1797,8 @@ static void ppc_spapr_init(MachineState *machine)
     if (machine->cpu_model == NULL) {
         machine->cpu_model = kvm_enabled() ? "host" : "POWER7";
     }
+    machine->cpu_type = TYPE_POWERPC_CPU;
+
     for (i = 0; i < smp_cpus; i++) {
         cpu = cpu_ppc_init(machine->cpu_model);
         if (cpu == NULL) {
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 24eb6f0..a1f9512 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -128,6 +128,7 @@ struct MachineState {
     char *kernel_cmdline;
     char *initrd_filename;
     const char *cpu_model;
+    const char *cpu_type;
     AccelState *accelerator;
 };
 
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]