aboutsummaryrefslogtreecommitdiff
path: root/include/hw/boards.h
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2017-09-13 18:04:55 +0200
committerEduardo Habkost <ehabkost@redhat.com>2017-09-19 09:09:32 -0300
commit6063d4c0f98b35a27ca018393d328a1825412a7e (patch)
tree4e57af39b5cfb881ee354743ef6c01ceadf4e3d6 /include/hw/boards.h
parent4482e05cbbb7e50e476f6a9500cf0b38913bd939 (diff)
vl.c: convert cpu_model to cpu type and set of global properties before machine_init()
All machines that support user specified cpu_model either call cpu_generic_init() or cpu_class_by_name()/CPUClass::parse_features to parse feature string and to get CPU type to create. Which leads to code duplication and hard-codding default CPU model within machine_foo_init() code. Which makes it impossible to get CPU type before machine_init() is run. So instead of setting default CPUs models and doing parsing in target specific machine_foo_init() in various ways, provide a generic data driven cpu_model parsing before machine_init() is called. in follow up per target patches, it will allow to: * define default CPU type in consistent/generic manner per machine type and drop custom code that fallbacks to default if cpu_model is NULL * drop custom features parsing in targets and do it in centralized way. * for cases of cpu_generic_init(TYPE_BASE/DEFAULT_CPU, "some_cpu") replace it with cpu_create(machine->cpu_type) || cpu_create(TYPE_FOO) depending if CPU type is user settable or not. not doing useless parsing and clearly documenting where CPU model is user settable or fixed one. Patch allows machine subclasses to define default CPU type per machine class at class_init() time and if that is set generic code will parse cpu_model into a MachineState::cpu_type which will be used to create CPUs for that machine instance and allows gradual per board conversion. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <1505318697-77161-4-git-send-email-imammedo@redhat.com> Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include/hw/boards.h')
-rw-r--r--include/hw/boards.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 7f044d101d..6b67adaef6 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -125,6 +125,10 @@ typedef struct {
* Caller is responsible for freeing returned list.
* @has_hotpluggable_cpus:
* If true, board supports CPUs creation with -device/device_add.
+ * @default_cpu_type:
+ * specifies default CPU_TYPE, which will be used for parsing target
+ * specific features and for creating CPUs if CPU name wasn't provided
+ * explicitly at CLI
* @minimum_page_bits:
* If non-zero, the board promises never to create a CPU with a page size
* smaller than this, so QEMU can use a more efficient larger page
@@ -177,6 +181,7 @@ struct MachineClass {
GArray *compat_props;
const char *hw_version;
ram_addr_t default_ram_size;
+ const char *default_cpu_type;
bool option_rom_has_mr;
bool rom_file_has_mr;
int minimum_page_bits;
@@ -231,6 +236,7 @@ struct MachineState {
char *kernel_cmdline;
char *initrd_filename;
const char *cpu_model;
+ const char *cpu_type;
AccelState *accelerator;
CPUArchIdList *possible_cpus;
};