[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v1 1/2] machine: Add a valid_cpu_types property
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [RFC v1 1/2] machine: Add a valid_cpu_types property |
Date: |
Mon, 11 Sep 2017 13:31:39 +0200 |
On Sat, 9 Sep 2017 17:16:57 -0300
Eduardo Habkost <address@hidden> wrote:
> On Tue, Sep 05, 2017 at 05:12:01PM -0700, Alistair Francis wrote:
> > Signed-off-by: Alistair Francis <address@hidden>
> > ---
> >
> > hw/core/machine.c | 27 +++++++++++++++++++++++++++
> > include/hw/boards.h | 1 +
> > 2 files changed, 28 insertions(+)
> >
> > diff --git a/hw/core/machine.c b/hw/core/machine.c
> > index 41b53a17ad..de0f127d27 100644
> > --- a/hw/core/machine.c
> > +++ b/hw/core/machine.c
> > @@ -758,6 +758,33 @@ void machine_run_board_init(MachineState *machine)
> > machine_numa_finish_init(machine);
> > }
> > machine_class->init(machine);
> > +
> > + if (machine_class->valid_cpu_types && machine->cpu_model) {
> > + const char *temp;
> > + int i, len = machine_class->valid_cpu_types->len;
>
> I suggest doing this after Igor's series that replaces the
> cpu_model field (full -cpu string) with cpu_type (only the CPU
> type name).
in addition check should run before
machine_class->init(machine);
it should be possible after cpu_model -> cpu_type refactoring is complete
[...]
> > diff --git a/include/hw/boards.h b/include/hw/boards.h
> > index 3363dd19fd..78678f84a9 100644
> > --- a/include/hw/boards.h
> > +++ b/include/hw/boards.h
> > @@ -172,6 +172,7 @@ struct MachineClass {
> > int minimum_page_bits;
> > bool has_hotpluggable_cpus;
> > int numa_mem_align_shift;
> > + GArray *valid_cpu_types;
>
> The list of CPU types for a machine are very likely to be
> statically defined at build time. Any specific reason to not
> make it a simple char** pointer?
wile working on cpu_model, I've seen only static checks
used in some machines. So +1 to static null terminated array
[
TYPE_FOO1,
TYPE_FOO2,
NULL
]
>
> > void (*numa_auto_assign_ram)(MachineClass *mc, NodeInfo *nodes,
> > int nb_nodes, ram_addr_t size);
> >
> > --
> > 2.11.0
> >
>