machine: Make smp_parse generic enough for all arches

Currently the only difference between smp_parse and pc_smp_parse
is the support of dies parameter and the related error reporting.
With some arch compat variables like "bool dies_supported", we can
make smp_parse generic enough for all arches and the PC specific
one can be removed.

Making smp_parse() generic enough can reduce code duplication and
ease the code maintenance, and also allows extending the topology
with more arch specific members (e.g., clusters) in the future.

Suggested-by: Andrew Jones <drjones@redhat.com>
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20210929025816.21076-13-wangyanan55@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Yanan Wang 2021-09-29 10:58:12 +08:00 committed by Paolo Bonzini
parent 003f230e37
commit e4a97a893b
3 changed files with 81 additions and 103 deletions

View file

@ -108,6 +108,14 @@ typedef struct {
CPUArchId cpus[];
} CPUArchIdList;
/**
* SMPCompatProps:
* @dies_supported - whether dies are supported by the machine
*/
typedef struct {
bool dies_supported;
} SMPCompatProps;
/**
* MachineClass:
* @deprecation_reason: If set, the machine is marked as deprecated. The
@ -248,6 +256,7 @@ struct MachineClass {
bool numa_mem_supported;
bool auto_enable_numa;
bool smp_prefer_sockets;
SMPCompatProps smp_props;
const char *default_ram_id;
HotplugHandler *(*get_hotplug_handler)(MachineState *machine,