Received: from eggs.gnu.org ([2001:4830:134:3::10]:56952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8Wwi-00026b-6x for qemu-devel@nongnu.org; Mon, 14 Dec 2015 12:30:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8Wwb-0002Q8-Vv for qemu-devel@nongnu.org; Mon, 14 Dec 2015 12:30:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8Wwb-0002Q3-QH for qemu-devel@nongnu.org; Mon, 14 Dec 2015 12:29:53 -0500 Date: Mon, 14 Dec 2015 15:29:49 -0200 From: Eduardo Habkost Message-ID: <20151214172949.GC3774@thinpad.lan.raisama.net> References: <1449728144-6223-1-git-send-email-bharata@linux.vnet.ibm.com> <1449728144-6223-3-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1449728144-6223-3-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v0 2/9] cpu: Store CPU typename in MachineState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: peter.maydell@linaro.org, agraf@suse.de, qemu-devel@nongnu.org, borntraeger@de.ibm.com, imammedo@redhat.com, pbonzini@redhat.com, afaerber@suse.de, david@gibson.dropbear.id.au On Thu, Dec 10, 2015 at 11:45:37AM +0530, Bharata B Rao wrote: > 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 Suggestions: * Name the field "cpu_base_type" to indicate it is the base CPU class name, not the actual CPU class name used when creating CPUs. * Put it in MachineClass, as it may be useful for code that runs before machine->init(), in the future. * Maybe make it a CPUClass* field instead of a string? > --- > 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 > -- Eduardo