diff options
author | Like Xu <like.xu@linux.intel.com> | 2019-06-20 13:45:24 +0800 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2019-07-05 17:08:04 -0300 |
commit | 6f479566a87d5087d6f3106b9401e6f53e933309 (patch) | |
tree | 8b5233d11def22ec0847fde7c8e4cb13f3822f36 /include | |
parent | a94e1428991f741e2c6636e7c8df7f8d1905d983 (diff) |
machine: Refactor smp_parse() in vl.c as MachineClass::smp_parse()
To make smp_parse() more flexible and expansive, a smp_parse function
pointer is added to MachineClass that machine types could override.
The generic smp_parse() code in vl.c is moved to hw/core/machine.c, and
become the default implementation of MachineClass::smp_parse. A PC-specific
function called pc_smp_parse() has been added to hw/i386/pc.c, which in
this patch changes nothing against the default one .
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Like Xu <like.xu@linux.intel.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190620054525.37188-3-like.xu@linux.intel.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/boards.h | 5 | ||||
-rw-r--r-- | include/hw/i386/pc.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h index ae7a542511..a71d1a53a5 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -162,6 +162,10 @@ typedef struct { * computed based on other criteria such as the host kernel capabilities. * @numa_mem_supported: * true if '--numa node.mem' option is supported and false otherwise + * @smp_parse: + * The function pointer to hook different machine specific functions for + * parsing "smp-opts" from QemuOpts to MachineState::CpuTopology and more + * machine specific topology fields, such as smp_dies for PCMachine. */ struct MachineClass { /*< private >*/ @@ -178,6 +182,7 @@ struct MachineClass { void (*reset)(MachineState *state); void (*hot_add_cpu)(MachineState *state, const int64_t id, Error **errp); int (*kvm_type)(MachineState *machine, const char *arg); + void (*smp_parse)(MachineState *ms, QemuOpts *opts); BlockInterfaceType block_default_type; int units_per_default_bus; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index e56c1a39cb..0fa3e3beeb 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -192,6 +192,7 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level); void pc_cpus_init(PCMachineState *pcms); void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp); +void pc_smp_parse(MachineState *ms, QemuOpts *opts); void pc_guest_info_init(PCMachineState *pcms); |