xref: /openbmc/qemu/include/hw/boards.h (revision a1c31486)
10d09e41aSPaolo Bonzini /* Declarations for use by board files for creating devices.  */
20d09e41aSPaolo Bonzini 
30d09e41aSPaolo Bonzini #ifndef HW_BOARDS_H
40d09e41aSPaolo Bonzini #define HW_BOARDS_H
50d09e41aSPaolo Bonzini 
6d4842052SMarkus Armbruster #include "exec/memory.h"
7aa8b1839SIgor Mammedov #include "sysemu/hostmem.h"
80d09e41aSPaolo Bonzini #include "sysemu/blockdev.h"
98ac25c84SMarkus Armbruster #include "qapi/qapi-types-machine.h"
100b8fa32fSMarkus Armbruster #include "qemu/module.h"
1136d20cb2SMarcel Apfelbaum #include "qom/object.h"
122e5b09fdSMarkus Armbruster #include "hw/core/cpu.h"
130d09e41aSPaolo Bonzini 
14dfabb8b9SPaolo Bonzini #define TYPE_MACHINE_SUFFIX "-machine"
15c84a8f01SEduardo Habkost 
16c84a8f01SEduardo Habkost /* Machine class name that needs to be used for class-name-based machine
17c84a8f01SEduardo Habkost  * type lookup to work.
18c84a8f01SEduardo Habkost  */
19c84a8f01SEduardo Habkost #define MACHINE_TYPE_NAME(machinename) (machinename TYPE_MACHINE_SUFFIX)
20c84a8f01SEduardo Habkost 
2136d20cb2SMarcel Apfelbaum #define TYPE_MACHINE "machine"
22c8897e8eSMarcel Apfelbaum #undef MACHINE  /* BSD defines it and QEMU does not use it */
23a489d195SEduardo Habkost OBJECT_DECLARE_TYPE(MachineState, MachineClass, MACHINE)
2436d20cb2SMarcel Apfelbaum 
250056ae24SMarcel Apfelbaum extern MachineState *current_machine;
260056ae24SMarcel Apfelbaum 
2762b4a227SPhilippe Mathieu-Daudé /**
2862b4a227SPhilippe Mathieu-Daudé  * machine_class_default_cpu_type: Return the machine default CPU type.
2962b4a227SPhilippe Mathieu-Daudé  * @mc: Machine class
3062b4a227SPhilippe Mathieu-Daudé  */
3162b4a227SPhilippe Mathieu-Daudé const char *machine_class_default_cpu_type(MachineClass *mc);
3262b4a227SPhilippe Mathieu-Daudé 
337a2c7da6SMartin Kletzander void machine_add_audiodev_property(MachineClass *mc);
3426f88d84SPaolo Bonzini void machine_run_board_init(MachineState *machine, const char *mem_path, Error **errp);
355e97b623SMarcel Apfelbaum bool machine_usb(MachineState *machine);
366cabe7faSMarcel Apfelbaum int machine_phandle_start(MachineState *machine);
3747c8ca53SMarcel Apfelbaum bool machine_dump_guest_core(MachineState *machine);
3875cc7f01SMarcel Apfelbaum bool machine_mem_merge(MachineState *machine);
3937662d85SXiaoyao Li bool machine_require_guest_memfd(MachineState *machine);
40f2d672c2SIgor Mammedov HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine);
417c88e65dSIgor Mammedov void machine_set_cpu_numa_node(MachineState *machine,
427c88e65dSIgor Mammedov                                const CpuInstanceProperties *props,
437c88e65dSIgor Mammedov                                Error **errp);
443e2f1498SPhilippe Mathieu-Daudé void machine_parse_smp_config(MachineState *ms,
453e2f1498SPhilippe Mathieu-Daudé                               const SMPConfiguration *config, Error **errp);
46a1d027beSZhao Liu unsigned int machine_topo_get_cores_per_socket(const MachineState *ms);
47a1d027beSZhao Liu unsigned int machine_topo_get_threads_per_socket(const MachineState *ms);
48cc0afd8aSDavid Hildenbrand void machine_memory_devices_init(MachineState *ms, hwaddr base, uint64_t size);
495e97b623SMarcel Apfelbaum 
50387c0e8bSPeter Maydell /**
51387c0e8bSPeter Maydell  * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices
52387c0e8bSPeter Maydell  * @mc: Machine class
53387c0e8bSPeter Maydell  * @type: type to allow (should be a subtype of TYPE_SYS_BUS_DEVICE)
54387c0e8bSPeter Maydell  *
55387c0e8bSPeter Maydell  * Add the QOM type @type to the list of devices of which are subtypes
56387c0e8bSPeter Maydell  * of TYPE_SYS_BUS_DEVICE but which are still permitted to be dynamically
57387c0e8bSPeter Maydell  * created (eg by the user on the command line with -device).
58387c0e8bSPeter Maydell  * By default if the user tries to create any devices on the command line
59387c0e8bSPeter Maydell  * that are subtypes of TYPE_SYS_BUS_DEVICE they will get an error message;
60387c0e8bSPeter Maydell  * for the special cases which are permitted for this machine model, the
61387c0e8bSPeter Maydell  * machine model class init code must call this function to add them
62387c0e8bSPeter Maydell  * to the list of specifically permitted devices.
63387c0e8bSPeter Maydell  */
640bd1909dSEduardo Habkost void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type);
65387c0e8bSPeter Maydell 
660fb124dbSPeter Maydell /**
67b5fdf410SDamien Hedde  * device_type_is_dynamic_sysbus: Check if type is an allowed sysbus device
68b5fdf410SDamien Hedde  * type for the machine class.
69b5fdf410SDamien Hedde  * @mc: Machine class
70b5fdf410SDamien Hedde  * @type: type to check (should be a subtype of TYPE_SYS_BUS_DEVICE)
71b5fdf410SDamien Hedde  *
72b5fdf410SDamien Hedde  * Returns: true if @type is a type in the machine's list of
73b5fdf410SDamien Hedde  * dynamically pluggable sysbus devices; otherwise false.
74b5fdf410SDamien Hedde  *
75b5fdf410SDamien Hedde  * Check if the QOM type @type is in the list of allowed sysbus device
76b5fdf410SDamien Hedde  * types (see machine_class_allowed_dynamic_sysbus_dev()).
77b5fdf410SDamien Hedde  * Note that if @type has a parent type in the list, it is allowed too.
78b5fdf410SDamien Hedde  */
79b5fdf410SDamien Hedde bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type);
80b5fdf410SDamien Hedde 
81b5fdf410SDamien Hedde /**
820fb124dbSPeter Maydell  * device_is_dynamic_sysbus: test whether device is a dynamic sysbus device
830fb124dbSPeter Maydell  * @mc: Machine class
840fb124dbSPeter Maydell  * @dev: device to check
850fb124dbSPeter Maydell  *
860fb124dbSPeter Maydell  * Returns: true if @dev is a sysbus device on the machine's list
870fb124dbSPeter Maydell  * of dynamically pluggable sysbus devices; otherwise false.
880fb124dbSPeter Maydell  *
890fb124dbSPeter Maydell  * This function checks whether @dev is a valid dynamic sysbus device,
900fb124dbSPeter Maydell  * by first confirming that it is a sysbus device and then checking it
910fb124dbSPeter Maydell  * against the list of permitted dynamic sysbus devices which has been
920fb124dbSPeter Maydell  * set up by the machine using machine_class_allow_dynamic_sysbus_dev().
930fb124dbSPeter Maydell  *
940fb124dbSPeter Maydell  * It is valid to call this with something that is not a subclass of
950fb124dbSPeter Maydell  * TYPE_SYS_BUS_DEVICE; the function will return false in this case.
960fb124dbSPeter Maydell  * This allows hotplug callback functions to be written as:
970fb124dbSPeter Maydell  *     if (device_is_dynamic_sysbus(mc, dev)) {
980fb124dbSPeter Maydell  *         handle dynamic sysbus case;
990fb124dbSPeter Maydell  *     } else if (some other kind of hotplug) {
1000fb124dbSPeter Maydell  *         handle that;
1010fb124dbSPeter Maydell  *     }
1020fb124dbSPeter Maydell  */
1030fb124dbSPeter Maydell bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev);
1040fb124dbSPeter Maydell 
10582b911aaSIgor Mammedov /*
10682b911aaSIgor Mammedov  * Checks that backend isn't used, preps it for exclusive usage and
10782b911aaSIgor Mammedov  * returns migratable MemoryRegion provided by backend.
10882b911aaSIgor Mammedov  */
10982b911aaSIgor Mammedov MemoryRegion *machine_consume_memdev(MachineState *machine,
11082b911aaSIgor Mammedov                                      HostMemoryBackend *backend);
1110bd1909dSEduardo Habkost 
11236d20cb2SMarcel Apfelbaum /**
1133811ef14SIgor Mammedov  * CPUArchId:
1143811ef14SIgor Mammedov  * @arch_id - architecture-dependent CPU ID of present or possible CPU
1153811ef14SIgor Mammedov  * @cpu - pointer to corresponding CPU object if it's present on NULL otherwise
116d342eb76SIgor Mammedov  * @type - QOM class name of possible @cpu object
117c67ae933SIgor Mammedov  * @props - CPU object properties, initialized by board
118f2d672c2SIgor Mammedov  * #vcpus_count - number of threads provided by @cpu object
1193811ef14SIgor Mammedov  */
120a44432b4SMarkus Armbruster typedef struct CPUArchId {
1213811ef14SIgor Mammedov     uint64_t arch_id;
122f2d672c2SIgor Mammedov     int64_t vcpus_count;
123c67ae933SIgor Mammedov     CpuInstanceProperties props;
12497e03106SPhilippe Mathieu-Daudé     CPUState *cpu;
125d342eb76SIgor Mammedov     const char *type;
1263811ef14SIgor Mammedov } CPUArchId;
1273811ef14SIgor Mammedov 
1283811ef14SIgor Mammedov /**
1293811ef14SIgor Mammedov  * CPUArchIdList:
1303811ef14SIgor Mammedov  * @len - number of @CPUArchId items in @cpus array
1313811ef14SIgor Mammedov  * @cpus - array of present or possible CPUs for current machine configuration
1323811ef14SIgor Mammedov  */
1333811ef14SIgor Mammedov typedef struct {
1343811ef14SIgor Mammedov     int len;
135880a7817SPhilippe Mathieu-Daudé     CPUArchId cpus[];
1363811ef14SIgor Mammedov } CPUArchIdList;
1373811ef14SIgor Mammedov 
1383811ef14SIgor Mammedov /**
139e4a97a89SYanan Wang  * SMPCompatProps:
1402b526199SYanan Wang  * @prefer_sockets - whether sockets are preferred over cores in smp parsing
141e4a97a89SYanan Wang  * @dies_supported - whether dies are supported by the machine
142864c3b5cSYanan Wang  * @clusters_supported - whether clusters are supported by the machine
14397f4effeSYicong Yang  * @has_clusters - whether clusters are explicitly specified in the user
14497f4effeSYicong Yang  *                 provided SMP configuration
1455de1aff2SPierre Morel  * @books_supported - whether books are supported by the machine
1465de1aff2SPierre Morel  * @drawers_supported - whether drawers are supported by the machine
147dcba73b4SZhao Liu  * @modules_supported - whether modules are supported by the machine
148e4a97a89SYanan Wang  */
149e4a97a89SYanan Wang typedef struct {
1502b526199SYanan Wang     bool prefer_sockets;
151e4a97a89SYanan Wang     bool dies_supported;
152864c3b5cSYanan Wang     bool clusters_supported;
15397f4effeSYicong Yang     bool has_clusters;
1545de1aff2SPierre Morel     bool books_supported;
1555de1aff2SPierre Morel     bool drawers_supported;
156dcba73b4SZhao Liu     bool modules_supported;
157e4a97a89SYanan Wang } SMPCompatProps;
158e4a97a89SYanan Wang 
159e4a97a89SYanan Wang /**
16036d20cb2SMarcel Apfelbaum  * MachineClass:
16108fe6824SThomas Huth  * @deprecation_reason: If set, the machine is marked as deprecated. The
16208fe6824SThomas Huth  *    string should provide some clear information about what to use instead.
16372649619SEmilio G. Cota  * @max_cpus: maximum number of CPUs supported. Default: 1
16472649619SEmilio G. Cota  * @min_cpus: minimum number of CPUs supported. Default: 1
16572649619SEmilio G. Cota  * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
166ea0ac7f6SPhilippe Mathieu-Daudé  * @is_default:
167ea0ac7f6SPhilippe Mathieu-Daudé  *    If true QEMU will use this machine by default if no '-M' option is given.
168b7454548SIgor Mammedov  * @get_hotplug_handler: this function is called during bus-less
169b7454548SIgor Mammedov  *    device hotplug. If defined it returns pointer to an instance
170b7454548SIgor Mammedov  *    of HotplugHandler object, which handles hotplug operation
171b7454548SIgor Mammedov  *    for a given @dev. It may return NULL if @dev doesn't require
172b7454548SIgor Mammedov  *    any actions to be performed by hotplug handler.
173ea089eebSIgor Mammedov  * @cpu_index_to_instance_props:
174ea089eebSIgor Mammedov  *    used to provide @cpu_index to socket/core/thread number mapping, allowing
175a1a62cedSMichael Tokarev  *    legacy code to perform mapping from cpu_index to topology properties
176ea089eebSIgor Mammedov  *    Returns: tuple of socket/core/thread ids given cpu_index belongs to.
17757924bcdSIgor Mammedov  *    used to provide @cpu_index to socket number mapping, allowing
17857924bcdSIgor Mammedov  *    a machine to group CPU threads belonging to the same socket/package
17957924bcdSIgor Mammedov  *    Returns: socket number given cpu_index belongs to.
180fac862ffSEduardo Habkost  * @hw_version:
181fac862ffSEduardo Habkost  *    Value of QEMU_VERSION when the machine was added to QEMU.
182fac862ffSEduardo Habkost  *    Set only by old machines because they need to keep
183fac862ffSEduardo Habkost  *    compatibility on code that exposed QEMU_VERSION to guests in
184fac862ffSEduardo Habkost  *    the past (and now use qemu_hw_version()).
1853811ef14SIgor Mammedov  * @possible_cpu_arch_ids:
1863811ef14SIgor Mammedov  *    Returns an array of @CPUArchId architecture-dependent CPU IDs
1873811ef14SIgor Mammedov  *    which includes CPU IDs for present and possible to hotplug CPUs.
1883811ef14SIgor Mammedov  *    Caller is responsible for freeing returned list.
18979e07936SIgor Mammedov  * @get_default_cpu_node_id:
19079e07936SIgor Mammedov  *    returns default board specific node_id value for CPU slot specified by
19179e07936SIgor Mammedov  *    index @idx in @ms->possible_cpus[]
192c5514d0eSIgor Mammedov  * @has_hotpluggable_cpus:
193c5514d0eSIgor Mammedov  *    If true, board supports CPUs creation with -device/device_add.
1946063d4c0SIgor Mammedov  * @default_cpu_type:
1956063d4c0SIgor Mammedov  *    specifies default CPU_TYPE, which will be used for parsing target
1966063d4c0SIgor Mammedov  *    specific features and for creating CPUs if CPU name wasn't provided
1976063d4c0SIgor Mammedov  *    explicitly at CLI
19820bccb82SPeter Maydell  * @minimum_page_bits:
19920bccb82SPeter Maydell  *    If non-zero, the board promises never to create a CPU with a page size
20020bccb82SPeter Maydell  *    smaller than this, so QEMU can use a more efficient larger page
20120bccb82SPeter Maydell  *    size than the target architecture's minimum. (Attempting to create
20220bccb82SPeter Maydell  *    such a CPU will fail.) Note that changing this is a migration
20320bccb82SPeter Maydell  *    compatibility break for the machine.
204ed860129SPeter Maydell  * @ignore_memory_transaction_failures:
205ed860129SPeter Maydell  *    If this is flag is true then the CPU will ignore memory transaction
206ed860129SPeter Maydell  *    failures which should cause the CPU to take an exception due to an
207ed860129SPeter Maydell  *    access to an unassigned physical address; the transaction will instead
208ed860129SPeter Maydell  *    return zero (for a read) or be ignored (for a write). This should be
209ed860129SPeter Maydell  *    set only by legacy board models which rely on the old RAZ/WI behaviour
210ed860129SPeter Maydell  *    for handling devices that QEMU does not yet model. New board models
211ed860129SPeter Maydell  *    should instead use "unimplemented-device" for all memory ranges where
212ed860129SPeter Maydell  *    the guest will attempt to probe for a device that QEMU doesn't
213ed860129SPeter Maydell  *    implement and a stub device is required.
214dc0ca80eSEric Auger  * @kvm_type:
215dc0ca80eSEric Auger  *    Return the type of KVM corresponding to the kvm-type string option or
216dc0ca80eSEric Auger  *    computed based on other criteria such as the host kernel capabilities.
217516fc0a0SAndrew Jones  *    kvm-type may be NULL if it is not needed.
218cd5ff833SIgor Mammedov  * @numa_mem_supported:
219cd5ff833SIgor Mammedov  *    true if '--numa node.mem' option is supported and false otherwise
220d2321d31SPeter Xu  * @hotplug_allowed:
221d2321d31SPeter Xu  *    If the hook is provided, then it'll be called for each device
222d2321d31SPeter Xu  *    hotplug to check whether the device hotplug is allowed.  Return
223d2321d31SPeter Xu  *    true to grant allowance or false to reject the hotplug.  When
224d2321d31SPeter Xu  *    false is returned, an error must be set to show the reason of
225d2321d31SPeter Xu  *    the rejection.  If the hook is not provided, all hotplug will be
226d2321d31SPeter Xu  *    allowed.
227900c0ba3SIgor Mammedov  * @default_ram_id:
228a1a62cedSMichael Tokarev  *    Specifies initial RAM MemoryRegion name to be used for default backend
229900c0ba3SIgor Mammedov  *    creation if user explicitly hasn't specified backend with "memory-backend"
230900c0ba3SIgor Mammedov  *    property.
231a1a62cedSMichael Tokarev  *    It also will be used as a way to option into "-m" option support.
232900c0ba3SIgor Mammedov  *    If it's not set by board, '-m' will be ignored and generic code will
233900c0ba3SIgor Mammedov  *    not create default RAM MemoryRegion.
2345c30ef93SChristian Borntraeger  * @fixup_ram_size:
2355c30ef93SChristian Borntraeger  *    Amends user provided ram size (with -m option) using machine
2365c30ef93SChristian Borntraeger  *    specific algorithm. To be used by old machine types for compat
2375c30ef93SChristian Borntraeger  *    purposes only.
2385c30ef93SChristian Borntraeger  *    Applies only to default memory backend, i.e., explicit memory backend
2395c30ef93SChristian Borntraeger  *    wasn't used.
24036d20cb2SMarcel Apfelbaum  */
24136d20cb2SMarcel Apfelbaum struct MachineClass {
24236d20cb2SMarcel Apfelbaum     /*< private >*/
24336d20cb2SMarcel Apfelbaum     ObjectClass parent_class;
24436d20cb2SMarcel Apfelbaum     /*< public >*/
24536d20cb2SMarcel Apfelbaum 
2462709f263SLaszlo Ersek     const char *family; /* NULL iff @name identifies a standalone machtype */
2478ea75371SMarc-André Lureau     char *name;
24800b4fbe2SMarcel Apfelbaum     const char *alias;
24900b4fbe2SMarcel Apfelbaum     const char *desc;
25008fe6824SThomas Huth     const char *deprecation_reason;
25100b4fbe2SMarcel Apfelbaum 
2523ef96221SMarcel Apfelbaum     void (*init)(MachineState *state);
2537966d70fSJason A. Donenfeld     void (*reset)(MachineState *state, ShutdownCause reason);
2544b5e06c9SNicholas Piggin     void (*wakeup)(MachineState *state);
255dc0ca80eSEric Auger     int (*kvm_type)(MachineState *machine, const char *arg);
25600b4fbe2SMarcel Apfelbaum 
25700b4fbe2SMarcel Apfelbaum     BlockInterfaceType block_default_type;
25816026518SJohn Snow     int units_per_default_bus;
25900b4fbe2SMarcel Apfelbaum     int max_cpus;
26072649619SEmilio G. Cota     int min_cpus;
26172649619SEmilio G. Cota     int default_cpus;
26200b4fbe2SMarcel Apfelbaum     unsigned int no_serial:1,
26300b4fbe2SMarcel Apfelbaum         no_parallel:1,
26400b4fbe2SMarcel Apfelbaum         no_floppy:1,
26500b4fbe2SMarcel Apfelbaum         no_cdrom:1,
26633cd52b5SAlexander Graf         no_sdcard:1,
267bab47d9aSGerd Hoffmann         pci_allow_0_address:1,
268bab47d9aSGerd Hoffmann         legacy_fw_cfg_order:1;
269ea0ac7f6SPhilippe Mathieu-Daudé     bool is_default;
27000b4fbe2SMarcel Apfelbaum     const char *default_machine_opts;
27100b4fbe2SMarcel Apfelbaum     const char *default_boot_order;
2726f00494aSGerd Hoffmann     const char *default_display;
27301ecdaa4SThomas Huth     const char *default_nic;
274b66bbee3SMarc-André Lureau     GPtrArray *compat_props;
27500b4fbe2SMarcel Apfelbaum     const char *hw_version;
276076b35b5SNikunj A Dadhania     ram_addr_t default_ram_size;
2776063d4c0SIgor Mammedov     const char *default_cpu_type;
278b2fc91dbSPeter Xu     bool default_kernel_irqchip_split;
27971ae9e94SEduardo Habkost     bool option_rom_has_mr;
28071ae9e94SEduardo Habkost     bool rom_file_has_mr;
28120bccb82SPeter Maydell     int minimum_page_bits;
282c5514d0eSIgor Mammedov     bool has_hotpluggable_cpus;
283ed860129SPeter Maydell     bool ignore_memory_transaction_failures;
28455641213SLaurent Vivier     int numa_mem_align_shift;
285790a4428SGavin Shan     const char * const *valid_cpu_types;
2860bd1909dSEduardo Habkost     strList *allowed_dynamic_sysbus_devices;
2877b8be49dSDou Liyang     bool auto_enable_numa_with_memhp;
288195784a0SDavid Hildenbrand     bool auto_enable_numa_with_memdev;
289907aac2fSMark Cave-Ayland     bool ignore_boot_device_suffixes;
2907fccf2a0SCorey Minyard     bool smbus_no_migration_support;
291f6a0d06bSEric Auger     bool nvdimm_supported;
292cd5ff833SIgor Mammedov     bool numa_mem_supported;
2930533ef5fSTao Xu     bool auto_enable_numa;
294a494fdb7SGavin Shan     bool cpu_cluster_has_numa_boundary;
295e4a97a89SYanan Wang     SMPCompatProps smp_props;
296900c0ba3SIgor Mammedov     const char *default_ram_id;
297b7454548SIgor Mammedov 
298b7454548SIgor Mammedov     HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
299b7454548SIgor Mammedov                                            DeviceState *dev);
300d2321d31SPeter Xu     bool (*hotplug_allowed)(MachineState *state, DeviceState *dev,
301d2321d31SPeter Xu                             Error **errp);
302ea089eebSIgor Mammedov     CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *machine,
303ea089eebSIgor Mammedov                                                          unsigned cpu_index);
30480e5db30SIgor Mammedov     const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine);
30579e07936SIgor Mammedov     int64_t (*get_default_cpu_node_id)(const MachineState *ms, int idx);
3065c30ef93SChristian Borntraeger     ram_addr_t (*fixup_ram_size)(ram_addr_t size);
30736d20cb2SMarcel Apfelbaum };
30836d20cb2SMarcel Apfelbaum 
30936d20cb2SMarcel Apfelbaum /**
310e017da37SDavid Hildenbrand  * DeviceMemoryState:
311b0c14ec4SDavid Hildenbrand  * @base: address in guest physical address space where the memory
312b0c14ec4SDavid Hildenbrand  * address space for memory devices starts
313f9716f4bSDavid Hildenbrand  * @mr: memory region container for memory devices
314f9716f4bSDavid Hildenbrand  * @as: address space for memory devices
315f9716f4bSDavid Hildenbrand  * @listener: memory listener used to track used memslots in the address space
316e919402bSYangming  * @dimm_size: the sum of plugged DIMMs' sizes
317ac23dd2fSDavid Hildenbrand  * @used_region_size: the part of @mr already used by memory devices
318f9716f4bSDavid Hildenbrand  * @required_memslots: the number of memslots required by memory devices
319f9716f4bSDavid Hildenbrand  * @used_memslots: the number of memslots currently used by memory devices
320a2335113SDavid Hildenbrand  * @memslot_auto_decision_active: whether any plugged memory device
321a2335113SDavid Hildenbrand  *                                automatically decided to use more than
322a2335113SDavid Hildenbrand  *                                one memslot
323b0c14ec4SDavid Hildenbrand  */
324e017da37SDavid Hildenbrand typedef struct DeviceMemoryState {
325b0c14ec4SDavid Hildenbrand     hwaddr base;
326b0c14ec4SDavid Hildenbrand     MemoryRegion mr;
327f9716f4bSDavid Hildenbrand     AddressSpace as;
328f9716f4bSDavid Hildenbrand     MemoryListener listener;
329e919402bSYangming     uint64_t dimm_size;
330ac23dd2fSDavid Hildenbrand     uint64_t used_region_size;
331f9716f4bSDavid Hildenbrand     unsigned int required_memslots;
332f9716f4bSDavid Hildenbrand     unsigned int used_memslots;
333a2335113SDavid Hildenbrand     unsigned int memslot_auto_decision_active;
334e017da37SDavid Hildenbrand } DeviceMemoryState;
335b0c14ec4SDavid Hildenbrand 
336b0c14ec4SDavid Hildenbrand /**
337edeeec91SLike Xu  * CpuTopology:
338edeeec91SLike Xu  * @cpus: the number of present logical processors on the machine
3395de1aff2SPierre Morel  * @drawers: the number of drawers on the machine
3405de1aff2SPierre Morel  * @books: the number of books in one drawer
3415de1aff2SPierre Morel  * @sockets: the number of sockets in one book
342003f230eSYanan Wang  * @dies: the number of dies in one socket
343864c3b5cSYanan Wang  * @clusters: the number of clusters in one die
344dcba73b4SZhao Liu  * @modules: the number of modules in one cluster
345864c3b5cSYanan Wang  * @cores: the number of cores in one cluster
346003f230eSYanan Wang  * @threads: the number of threads in one core
347edeeec91SLike Xu  * @max_cpus: the maximum number of logical processors on the machine
348edeeec91SLike Xu  */
349edeeec91SLike Xu typedef struct CpuTopology {
350edeeec91SLike Xu     unsigned int cpus;
3515de1aff2SPierre Morel     unsigned int drawers;
3525de1aff2SPierre Morel     unsigned int books;
353003f230eSYanan Wang     unsigned int sockets;
35467872eb8SPaolo Bonzini     unsigned int dies;
355864c3b5cSYanan Wang     unsigned int clusters;
356dcba73b4SZhao Liu     unsigned int modules;
357edeeec91SLike Xu     unsigned int cores;
358edeeec91SLike Xu     unsigned int threads;
359edeeec91SLike Xu     unsigned int max_cpus;
360edeeec91SLike Xu } CpuTopology;
361edeeec91SLike Xu 
362edeeec91SLike Xu /**
36336d20cb2SMarcel Apfelbaum  * MachineState:
36436d20cb2SMarcel Apfelbaum  */
36536d20cb2SMarcel Apfelbaum struct MachineState {
36636d20cb2SMarcel Apfelbaum     /*< private >*/
36736d20cb2SMarcel Apfelbaum     Object parent_obj;
36833cd52b5SAlexander Graf 
36936d20cb2SMarcel Apfelbaum     /*< public >*/
37036d20cb2SMarcel Apfelbaum 
371a6487d37SAlex Bennée     void *fdt;
37236d20cb2SMarcel Apfelbaum     char *dtb;
37336d20cb2SMarcel Apfelbaum     char *dumpdtb;
37436d20cb2SMarcel Apfelbaum     int phandle_start;
37536d20cb2SMarcel Apfelbaum     char *dt_compatible;
37636d20cb2SMarcel Apfelbaum     bool dump_guest_core;
37736d20cb2SMarcel Apfelbaum     bool mem_merge;
37836d20cb2SMarcel Apfelbaum     bool usb;
379c6e76503SPaolo Bonzini     bool usb_disabled;
38036d20cb2SMarcel Apfelbaum     char *firmware;
381a52a7fdfSLe Tan     bool iommu;
3829850c604SAlexander Graf     bool suppress_vmdesc;
383cfc58cf3SEduardo Habkost     bool enable_graphics;
384e0292d7cSDavid Gibson     ConfidentialGuestSupport *cgs;
38526f88d84SPaolo Bonzini     HostMemoryBackend *memdev;
38682b911aaSIgor Mammedov     /*
38782b911aaSIgor Mammedov      * convenience alias to ram_memdev_id backend memory region
38882b911aaSIgor Mammedov      * or to numa container memory region
38982b911aaSIgor Mammedov      */
39082b911aaSIgor Mammedov     MemoryRegion *ram;
391e017da37SDavid Hildenbrand     DeviceMemoryState *device_memory;
39236d20cb2SMarcel Apfelbaum 
3937a2c7da6SMartin Kletzander     /*
3947a2c7da6SMartin Kletzander      * Included in MachineState for simplicity, but not supported
3957a2c7da6SMartin Kletzander      * unless machine_add_audiodev_property is called.  Boards
3967a2c7da6SMartin Kletzander      * that have embedded audio devices can call it from the
3977a2c7da6SMartin Kletzander      * machine init function and forward the property to the device.
3987a2c7da6SMartin Kletzander      */
3997a2c7da6SMartin Kletzander     char *audiodev;
4007a2c7da6SMartin Kletzander 
4013ef96221SMarcel Apfelbaum     ram_addr_t ram_size;
402c270fb9eSIgor Mammedov     ram_addr_t maxram_size;
403c270fb9eSIgor Mammedov     uint64_t   ram_slots;
40497ec4d21SPaolo Bonzini     BootConfiguration boot_config;
4056b1b1440SMarcel Apfelbaum     char *kernel_filename;
4066b1b1440SMarcel Apfelbaum     char *kernel_cmdline;
4076b1b1440SMarcel Apfelbaum     char *initrd_filename;
4086063d4c0SIgor Mammedov     const char *cpu_type;
409ac2da55eSEduardo Habkost     AccelState *accelerator;
41038690a1cSIgor Mammedov     CPUArchIdList *possible_cpus;
411edeeec91SLike Xu     CpuTopology smp;
412f6a0d06bSEric Auger     struct NVDIMMState *nvdimms_state;
413aa570207STao Xu     struct NumaState *numa_state;
41436d20cb2SMarcel Apfelbaum };
41536d20cb2SMarcel Apfelbaum 
416*a1c31486SDaniel P. Berrangé /*
417*a1c31486SDaniel P. Berrangé  * The macros which follow are intended to facilitate the
418*a1c31486SDaniel P. Berrangé  * definition of versioned machine types, using a somewhat
419*a1c31486SDaniel P. Berrangé  * similar pattern across targets.
420*a1c31486SDaniel P. Berrangé  *
421*a1c31486SDaniel P. Berrangé  * For example, a macro that can be used to define versioned
422*a1c31486SDaniel P. Berrangé  * 'virt' machine types would look like:
423*a1c31486SDaniel P. Berrangé  *
424*a1c31486SDaniel P. Berrangé  *  #define DEFINE_VIRT_MACHINE_IMPL(latest, ...) \
425*a1c31486SDaniel P. Berrangé  *      static void MACHINE_VER_SYM(class_init, virt, __VA_ARGS__)( \
426*a1c31486SDaniel P. Berrangé  *          ObjectClass *oc, \
427*a1c31486SDaniel P. Berrangé  *          void *data) \
428*a1c31486SDaniel P. Berrangé  *      { \
429*a1c31486SDaniel P. Berrangé  *          MachineClass *mc = MACHINE_CLASS(oc); \
430*a1c31486SDaniel P. Berrangé  *          MACHINE_VER_SYM(options, virt, __VA_ARGS__)(mc); \
431*a1c31486SDaniel P. Berrangé  *          mc->desc = "QEMU " MACHINE_VER_STR(__VA_ARGS__) " Virtual Machine"; \
432*a1c31486SDaniel P. Berrangé  *          if (latest) { \
433*a1c31486SDaniel P. Berrangé  *              mc->alias = "virt"; \
434*a1c31486SDaniel P. Berrangé  *          } \
435*a1c31486SDaniel P. Berrangé  *      } \
436*a1c31486SDaniel P. Berrangé  *      static const TypeInfo MACHINE_VER_SYM(info, virt, __VA_ARGS__) = { \
437*a1c31486SDaniel P. Berrangé  *          .name = MACHINE_VER_TYPE_NAME("virt", __VA_ARGS__), \
438*a1c31486SDaniel P. Berrangé  *          .parent = TYPE_VIRT_MACHINE, \
439*a1c31486SDaniel P. Berrangé  *          .class_init = MACHINE_VER_SYM(class_init, virt, __VA_ARGS__), \
440*a1c31486SDaniel P. Berrangé  *      }; \
441*a1c31486SDaniel P. Berrangé  *      static void MACHINE_VER_SYM(register, virt, __VA_ARGS__)(void) \
442*a1c31486SDaniel P. Berrangé  *      { \
443*a1c31486SDaniel P. Berrangé  *          type_register_static(&MACHINE_VER_SYM(info, virt, __VA_ARGS__)); \
444*a1c31486SDaniel P. Berrangé  *      } \
445*a1c31486SDaniel P. Berrangé  *      type_init(MACHINE_VER_SYM(register, virt, __VA_ARGS__));
446*a1c31486SDaniel P. Berrangé  *
447*a1c31486SDaniel P. Berrangé  * Following this, one (or more) helpers can be added for
448*a1c31486SDaniel P. Berrangé  * whichever scenarios need to be catered for with a machine:
449*a1c31486SDaniel P. Berrangé  *
450*a1c31486SDaniel P. Berrangé  *  // Normal 2 digit, marked as latest e.g. 'virt-9.0'
451*a1c31486SDaniel P. Berrangé  *  #define DEFINE_VIRT_MACHINE_LATEST(major, minor) \
452*a1c31486SDaniel P. Berrangé  *      DEFINE_VIRT_MACHINE_IMPL(true, major, minor)
453*a1c31486SDaniel P. Berrangé  *
454*a1c31486SDaniel P. Berrangé  *  // Normal 2 digit e.g. 'virt-9.0'
455*a1c31486SDaniel P. Berrangé  *  #define DEFINE_VIRT_MACHINE(major, minor) \
456*a1c31486SDaniel P. Berrangé  *      DEFINE_VIRT_MACHINE_IMPL(false, major, minor)
457*a1c31486SDaniel P. Berrangé  *
458*a1c31486SDaniel P. Berrangé  *  // Bugfix 3 digit e.g. 'virt-9.0.1'
459*a1c31486SDaniel P. Berrangé  *  #define DEFINE_VIRT_MACHINE_BUGFIX(major, minor, micro) \
460*a1c31486SDaniel P. Berrangé  *      DEFINE_VIRT_MACHINE_IMPL(false, major, minor, micro)
461*a1c31486SDaniel P. Berrangé  *
462*a1c31486SDaniel P. Berrangé  *  // Tagged 2 digit e.g. 'virt-9.0-extra'
463*a1c31486SDaniel P. Berrangé  *  #define DEFINE_VIRT_MACHINE_TAGGED(major, minor, tag) \
464*a1c31486SDaniel P. Berrangé  *      DEFINE_VIRT_MACHINE_IMPL(false, major, minor, _, tag)
465*a1c31486SDaniel P. Berrangé  *
466*a1c31486SDaniel P. Berrangé  *  // Tagged bugfix 2 digit e.g. 'virt-9.0.1-extra'
467*a1c31486SDaniel P. Berrangé  *  #define DEFINE_VIRT_MACHINE_TAGGED(major, minor, micro, tag) \
468*a1c31486SDaniel P. Berrangé  *      DEFINE_VIRT_MACHINE_IMPL(false, major, minor, micro, _, tag)
469*a1c31486SDaniel P. Berrangé  */
470*a1c31486SDaniel P. Berrangé 
471*a1c31486SDaniel P. Berrangé /*
472*a1c31486SDaniel P. Berrangé  * Helper for dispatching different macros based on how
473*a1c31486SDaniel P. Berrangé  * many __VA_ARGS__ are passed. Supports 1 to 5 variadic
474*a1c31486SDaniel P. Berrangé  * arguments, with the called target able to be prefixed
475*a1c31486SDaniel P. Berrangé  * with 0 or more fixed arguments too. To be called thus:
476*a1c31486SDaniel P. Berrangé  *
477*a1c31486SDaniel P. Berrangé  *  _MACHINE_VER_PICK(__VA_ARGS,
478*a1c31486SDaniel P. Berrangé  *                    MACRO_MATCHING_5_ARGS,
479*a1c31486SDaniel P. Berrangé  *                    MACRO_MATCHING_4_ARGS,
480*a1c31486SDaniel P. Berrangé  *                    MACRO_MATCHING_3_ARGS,
481*a1c31486SDaniel P. Berrangé  *                    MACRO_MATCHING_2_ARGS,
482*a1c31486SDaniel P. Berrangé  *                    MACRO_MATCHING_1_ARG) (FIXED-ARG-1,
483*a1c31486SDaniel P. Berrangé  *                                           ...,
484*a1c31486SDaniel P. Berrangé  *                                           FIXED-ARG-N,
485*a1c31486SDaniel P. Berrangé  *                                           __VA_ARGS__)
486*a1c31486SDaniel P. Berrangé  */
487*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_PICK(x1, x2, x3, x4, x5, x6, ...) x6
488*a1c31486SDaniel P. Berrangé 
489*a1c31486SDaniel P. Berrangé /*
490*a1c31486SDaniel P. Berrangé  * Construct a human targeted machine version string.
491*a1c31486SDaniel P. Berrangé  *
492*a1c31486SDaniel P. Berrangé  * Can be invoked with various signatures
493*a1c31486SDaniel P. Berrangé  *
494*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_STR(sym, prefix, major, minor)
495*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_STR(sym, prefix, major, minor, micro)
496*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_STR(sym, prefix, major, minor, _, tag)
497*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_STR(sym, prefix, major, minor, micro, _, tag)
498*a1c31486SDaniel P. Berrangé  *
499*a1c31486SDaniel P. Berrangé  * Respectively emitting symbols with the format
500*a1c31486SDaniel P. Berrangé  *
501*a1c31486SDaniel P. Berrangé  *   "{major}.{minor}"
502*a1c31486SDaniel P. Berrangé  *   "{major}.{minor}-{tag}"
503*a1c31486SDaniel P. Berrangé  *   "{major}.{minor}.{micro}"
504*a1c31486SDaniel P. Berrangé  *   "{major}.{minor}.{micro}-{tag}"
505*a1c31486SDaniel P. Berrangé  */
506*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_STR2(major, minor) \
507*a1c31486SDaniel P. Berrangé     #major "." #minor
508*a1c31486SDaniel P. Berrangé 
509*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_STR3(major, minor, micro) \
510*a1c31486SDaniel P. Berrangé     #major "." #minor "." #micro
511*a1c31486SDaniel P. Berrangé 
512*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_STR4(major, minor, _unused_, tag) \
513*a1c31486SDaniel P. Berrangé     #major "." #minor "-" #tag
514*a1c31486SDaniel P. Berrangé 
515*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_STR5(major, minor, micro, _unused_, tag) \
516*a1c31486SDaniel P. Berrangé     #major "." #minor "." #micro "-" #tag
517*a1c31486SDaniel P. Berrangé 
518*a1c31486SDaniel P. Berrangé #define MACHINE_VER_STR(...) \
519*a1c31486SDaniel P. Berrangé     _MACHINE_VER_PICK(__VA_ARGS__, \
520*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_STR5, \
521*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_STR4, \
522*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_STR3, \
523*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_STR2) (__VA_ARGS__)
524*a1c31486SDaniel P. Berrangé 
525*a1c31486SDaniel P. Berrangé 
526*a1c31486SDaniel P. Berrangé /*
527*a1c31486SDaniel P. Berrangé  * Construct a QAPI type name for a versioned machine
528*a1c31486SDaniel P. Berrangé  * type
529*a1c31486SDaniel P. Berrangé  *
530*a1c31486SDaniel P. Berrangé  * Can be invoked with various signatures
531*a1c31486SDaniel P. Berrangé  *
532*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_TYPE_NAME(prefix, major, minor)
533*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_TYPE_NAME(prefix, major, minor, micro)
534*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_TYPE_NAME(prefix, major, minor, _, tag)
535*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_TYPE_NAME(prefix, major, minor, micro, _, tag)
536*a1c31486SDaniel P. Berrangé  *
537*a1c31486SDaniel P. Berrangé  * Respectively emitting symbols with the format
538*a1c31486SDaniel P. Berrangé  *
539*a1c31486SDaniel P. Berrangé  *   "{prefix}-{major}.{minor}"
540*a1c31486SDaniel P. Berrangé  *   "{prefix}-{major}.{minor}.{micro}"
541*a1c31486SDaniel P. Berrangé  *   "{prefix}-{major}.{minor}-{tag}"
542*a1c31486SDaniel P. Berrangé  *   "{prefix}-{major}.{minor}.{micro}-{tag}"
543*a1c31486SDaniel P. Berrangé  */
544*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_TYPE_NAME2(prefix, major, minor)   \
545*a1c31486SDaniel P. Berrangé     prefix "-" #major "." #minor TYPE_MACHINE_SUFFIX
546*a1c31486SDaniel P. Berrangé 
547*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_TYPE_NAME3(prefix, major, minor, micro) \
548*a1c31486SDaniel P. Berrangé     prefix "-" #major "." #minor "." #micro TYPE_MACHINE_SUFFIX
549*a1c31486SDaniel P. Berrangé 
550*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_TYPE_NAME4(prefix, major, minor, _unused_, tag) \
551*a1c31486SDaniel P. Berrangé     prefix "-" #major "." #minor "-" #tag TYPE_MACHINE_SUFFIX
552*a1c31486SDaniel P. Berrangé 
553*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_TYPE_NAME5(prefix, major, minor, micro, _unused_, tag) \
554*a1c31486SDaniel P. Berrangé     prefix "-" #major "." #minor "." #micro "-" #tag TYPE_MACHINE_SUFFIX
555*a1c31486SDaniel P. Berrangé 
556*a1c31486SDaniel P. Berrangé #define MACHINE_VER_TYPE_NAME(prefix, ...) \
557*a1c31486SDaniel P. Berrangé     _MACHINE_VER_PICK(__VA_ARGS__, \
558*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_TYPE_NAME5, \
559*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_TYPE_NAME4, \
560*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_TYPE_NAME3, \
561*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_TYPE_NAME2) (prefix, __VA_ARGS__)
562*a1c31486SDaniel P. Berrangé 
563*a1c31486SDaniel P. Berrangé /*
564*a1c31486SDaniel P. Berrangé  * Construct a name for a versioned machine type that is
565*a1c31486SDaniel P. Berrangé  * suitable for use as a C symbol (function/variable/etc).
566*a1c31486SDaniel P. Berrangé  *
567*a1c31486SDaniel P. Berrangé  * Can be invoked with various signatures
568*a1c31486SDaniel P. Berrangé  *
569*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_SYM(sym, prefix, major, minor)
570*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_SYM(sym, prefix, major, minor, micro)
571*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_SYM(sym, prefix, major, minor, _, tag)
572*a1c31486SDaniel P. Berrangé  *  MACHINE_VER_SYM(sym, prefix, major, minor, micro, _, tag)
573*a1c31486SDaniel P. Berrangé  *
574*a1c31486SDaniel P. Berrangé  * Respectively emitting symbols with the format
575*a1c31486SDaniel P. Berrangé  *
576*a1c31486SDaniel P. Berrangé  *   {prefix}_machine_{major}_{minor}_{sym}
577*a1c31486SDaniel P. Berrangé  *   {prefix}_machine_{major}_{minor}_{micro}_{sym}
578*a1c31486SDaniel P. Berrangé  *   {prefix}_machine_{major}_{minor}_{tag}_{sym}
579*a1c31486SDaniel P. Berrangé  *   {prefix}_machine_{major}_{minor}_{micro}_{tag}_{sym}
580*a1c31486SDaniel P. Berrangé  */
581*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_SYM2(sym, prefix, major, minor) \
582*a1c31486SDaniel P. Berrangé     prefix ## _machine_ ## major ## _ ## minor ## _ ## sym
583*a1c31486SDaniel P. Berrangé 
584*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_SYM3(sym, prefix, major, minor, micro) \
585*a1c31486SDaniel P. Berrangé     prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## sym
586*a1c31486SDaniel P. Berrangé 
587*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_SYM4(sym, prefix, major, minor, _unused_, tag) \
588*a1c31486SDaniel P. Berrangé     prefix ## _machine_ ## major ## _ ## minor ## _ ## tag ## _ ## sym
589*a1c31486SDaniel P. Berrangé 
590*a1c31486SDaniel P. Berrangé #define _MACHINE_VER_SYM5(sym, prefix, major, minor, micro, _unused_, tag) \
591*a1c31486SDaniel P. Berrangé     prefix ## _machine_ ## major ## _ ## minor ## _ ## micro ## _ ## tag ## _ ## sym
592*a1c31486SDaniel P. Berrangé 
593*a1c31486SDaniel P. Berrangé #define MACHINE_VER_SYM(sym, prefix, ...) \
594*a1c31486SDaniel P. Berrangé     _MACHINE_VER_PICK(__VA_ARGS__, \
595*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_SYM5, \
596*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_SYM4, \
597*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_SYM3, \
598*a1c31486SDaniel P. Berrangé                       _MACHINE_VER_SYM2) (sym, prefix, __VA_ARGS__)
599*a1c31486SDaniel P. Berrangé 
600*a1c31486SDaniel P. Berrangé 
601ed0b6de3SEduardo Habkost #define DEFINE_MACHINE(namestr, machine_initfn) \
602ed0b6de3SEduardo Habkost     static void machine_initfn##_class_init(ObjectClass *oc, void *data) \
603ed0b6de3SEduardo Habkost     { \
604ed0b6de3SEduardo Habkost         MachineClass *mc = MACHINE_CLASS(oc); \
605ed0b6de3SEduardo Habkost         machine_initfn(mc); \
606ed0b6de3SEduardo Habkost     } \
607ed0b6de3SEduardo Habkost     static const TypeInfo machine_initfn##_typeinfo = { \
608ed0b6de3SEduardo Habkost         .name       = MACHINE_TYPE_NAME(namestr), \
609ed0b6de3SEduardo Habkost         .parent     = TYPE_MACHINE, \
610ed0b6de3SEduardo Habkost         .class_init = machine_initfn##_class_init, \
611ed0b6de3SEduardo Habkost     }; \
612ed0b6de3SEduardo Habkost     static void machine_initfn##_register_types(void) \
613ed0b6de3SEduardo Habkost     { \
614ed0b6de3SEduardo Habkost         type_register_static(&machine_initfn##_typeinfo); \
615ed0b6de3SEduardo Habkost     } \
6160e6aac87SEduardo Habkost     type_init(machine_initfn##_register_types)
617ed0b6de3SEduardo Habkost 
61885fa9acdSPaolo Bonzini extern GlobalProperty hw_compat_9_0[];
61985fa9acdSPaolo Bonzini extern const size_t hw_compat_9_0_len;
62085fa9acdSPaolo Bonzini 
6212b10a676SCornelia Huck extern GlobalProperty hw_compat_8_2[];
6222b10a676SCornelia Huck extern const size_t hw_compat_8_2_len;
6232b10a676SCornelia Huck 
62495f5c89eSCornelia Huck extern GlobalProperty hw_compat_8_1[];
62595f5c89eSCornelia Huck extern const size_t hw_compat_8_1_len;
62695f5c89eSCornelia Huck 
6270259dd3eSCornelia Huck extern GlobalProperty hw_compat_8_0[];
6280259dd3eSCornelia Huck extern const size_t hw_compat_8_0_len;
6290259dd3eSCornelia Huck 
630db723c80SCornelia Huck extern GlobalProperty hw_compat_7_2[];
631db723c80SCornelia Huck extern const size_t hw_compat_7_2_len;
632db723c80SCornelia Huck 
633f514e147SCornelia Huck extern GlobalProperty hw_compat_7_1[];
634f514e147SCornelia Huck extern const size_t hw_compat_7_1_len;
635f514e147SCornelia Huck 
6360ca70366SCornelia Huck extern GlobalProperty hw_compat_7_0[];
6370ca70366SCornelia Huck extern const size_t hw_compat_7_0_len;
6380ca70366SCornelia Huck 
63901854af2SCornelia Huck extern GlobalProperty hw_compat_6_2[];
64001854af2SCornelia Huck extern const size_t hw_compat_6_2_len;
64101854af2SCornelia Huck 
64252e64f5bSYanan Wang extern GlobalProperty hw_compat_6_1[];
64352e64f5bSYanan Wang extern const size_t hw_compat_6_1_len;
64452e64f5bSYanan Wang 
645da7e13c0SCornelia Huck extern GlobalProperty hw_compat_6_0[];
646da7e13c0SCornelia Huck extern const size_t hw_compat_6_0_len;
647da7e13c0SCornelia Huck 
648576a00bdSCornelia Huck extern GlobalProperty hw_compat_5_2[];
649576a00bdSCornelia Huck extern const size_t hw_compat_5_2_len;
650576a00bdSCornelia Huck 
6513ff3c5d3SCornelia Huck extern GlobalProperty hw_compat_5_1[];
6523ff3c5d3SCornelia Huck extern const size_t hw_compat_5_1_len;
6533ff3c5d3SCornelia Huck 
654541aaa1dSCornelia Huck extern GlobalProperty hw_compat_5_0[];
655541aaa1dSCornelia Huck extern const size_t hw_compat_5_0_len;
656541aaa1dSCornelia Huck 
6575f258577SEvgeny Yakovlev extern GlobalProperty hw_compat_4_2[];
6585f258577SEvgeny Yakovlev extern const size_t hw_compat_4_2_len;
6595f258577SEvgeny Yakovlev 
6609aec2e52SCornelia Huck extern GlobalProperty hw_compat_4_1[];
6619aec2e52SCornelia Huck extern const size_t hw_compat_4_1_len;
6629aec2e52SCornelia Huck 
6639bf2650bSCornelia Huck extern GlobalProperty hw_compat_4_0[];
6649bf2650bSCornelia Huck extern const size_t hw_compat_4_0_len;
6659bf2650bSCornelia Huck 
666abd93cc7SMarc-André Lureau extern GlobalProperty hw_compat_3_1[];
667abd93cc7SMarc-André Lureau extern const size_t hw_compat_3_1_len;
668abd93cc7SMarc-André Lureau 
669ddb3235dSMarc-André Lureau extern GlobalProperty hw_compat_3_0[];
670ddb3235dSMarc-André Lureau extern const size_t hw_compat_3_0_len;
671ddb3235dSMarc-André Lureau 
6720d47310bSMarc-André Lureau extern GlobalProperty hw_compat_2_12[];
6730d47310bSMarc-André Lureau extern const size_t hw_compat_2_12_len;
6740d47310bSMarc-André Lureau 
67543df70a9SMarc-André Lureau extern GlobalProperty hw_compat_2_11[];
67643df70a9SMarc-André Lureau extern const size_t hw_compat_2_11_len;
67743df70a9SMarc-André Lureau 
678503224f4SMarc-André Lureau extern GlobalProperty hw_compat_2_10[];
679503224f4SMarc-André Lureau extern const size_t hw_compat_2_10_len;
680503224f4SMarc-André Lureau 
6813e803152SMarc-André Lureau extern GlobalProperty hw_compat_2_9[];
6823e803152SMarc-André Lureau extern const size_t hw_compat_2_9_len;
6833e803152SMarc-André Lureau 
684edc24ccdSMarc-André Lureau extern GlobalProperty hw_compat_2_8[];
685edc24ccdSMarc-André Lureau extern const size_t hw_compat_2_8_len;
686edc24ccdSMarc-André Lureau 
6875a995064SMarc-André Lureau extern GlobalProperty hw_compat_2_7[];
6885a995064SMarc-André Lureau extern const size_t hw_compat_2_7_len;
6895a995064SMarc-André Lureau 
690ff8f261fSMarc-André Lureau extern GlobalProperty hw_compat_2_6[];
691ff8f261fSMarc-André Lureau extern const size_t hw_compat_2_6_len;
692ff8f261fSMarc-André Lureau 
693fe759610SMarc-André Lureau extern GlobalProperty hw_compat_2_5[];
694fe759610SMarc-André Lureau extern const size_t hw_compat_2_5_len;
695fe759610SMarc-André Lureau 
6962f99b9c2SMarc-André Lureau extern GlobalProperty hw_compat_2_4[];
6972f99b9c2SMarc-André Lureau extern const size_t hw_compat_2_4_len;
6982f99b9c2SMarc-André Lureau 
6998995dd90SMarc-André Lureau extern GlobalProperty hw_compat_2_3[];
7008995dd90SMarc-André Lureau extern const size_t hw_compat_2_3_len;
7018995dd90SMarc-André Lureau 
7021c30044eSMarc-André Lureau extern GlobalProperty hw_compat_2_2[];
7031c30044eSMarc-André Lureau extern const size_t hw_compat_2_2_len;
7041c30044eSMarc-André Lureau 
705c4fc5695SMarc-André Lureau extern GlobalProperty hw_compat_2_1[];
706c4fc5695SMarc-André Lureau extern const size_t hw_compat_2_1_len;
707c4fc5695SMarc-André Lureau 
7080d09e41aSPaolo Bonzini #endif
709