Message ID | 1456117285-22273-2-git-send-email-bharata@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On Mon, Feb 22, 2016 at 10:31:18AM +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 sPAPR target for now > > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> As noted elsewhere, I hope we can do away with the need for this, but I haven't yet figured out enough about the QOM model to see how. > --- > hw/ppc/spapr.c | 2 ++ > include/hw/boards.h | 1 + > 2 files changed, 3 insertions(+) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 5bd8fd3..3892a99 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -1823,6 +1823,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 0f30959..cf95d10 100644 > --- a/include/hw/boards.h > +++ b/include/hw/boards.h > @@ -137,6 +137,7 @@ struct MachineState { > char *kernel_cmdline; > char *initrd_filename; > const char *cpu_model; > + const char *cpu_type; > AccelState *accelerator; > }; >
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 5bd8fd3..3892a99 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1823,6 +1823,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 0f30959..cf95d10 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -137,6 +137,7 @@ struct MachineState { char *kernel_cmdline; char *initrd_filename; const char *cpu_model; + const char *cpu_type; AccelState *accelerator; };
Storing CPU typename in MachineState lets us to create CPU threads for all architectures in uniform manner from arch-neutral code. TODO: Touching only sPAPR target for now Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com> --- hw/ppc/spapr.c | 2 ++ include/hw/boards.h | 1 + 2 files changed, 3 insertions(+)