xref: /openbmc/qemu/include/hw/boards.h (revision 97ec4d21)
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"
9940e43aaSClaudio Fontana #include "qemu/accel.h"
108ac25c84SMarkus Armbruster #include "qapi/qapi-types-machine.h"
110b8fa32fSMarkus Armbruster #include "qemu/module.h"
1236d20cb2SMarcel Apfelbaum #include "qom/object.h"
132e5b09fdSMarkus Armbruster #include "hw/core/cpu.h"
140d09e41aSPaolo Bonzini 
15dfabb8b9SPaolo Bonzini #define TYPE_MACHINE_SUFFIX "-machine"
16c84a8f01SEduardo Habkost 
17c84a8f01SEduardo Habkost /* Machine class name that needs to be used for class-name-based machine
18c84a8f01SEduardo Habkost  * type lookup to work.
19c84a8f01SEduardo Habkost  */
20c84a8f01SEduardo Habkost #define MACHINE_TYPE_NAME(machinename) (machinename TYPE_MACHINE_SUFFIX)
21c84a8f01SEduardo Habkost 
2236d20cb2SMarcel Apfelbaum #define TYPE_MACHINE "machine"
23c8897e8eSMarcel Apfelbaum #undef MACHINE  /* BSD defines it and QEMU does not use it */
24a489d195SEduardo Habkost OBJECT_DECLARE_TYPE(MachineState, MachineClass, MACHINE)
2536d20cb2SMarcel Apfelbaum 
260056ae24SMarcel Apfelbaum extern MachineState *current_machine;
270056ae24SMarcel Apfelbaum 
28482dfe9aSIgor Mammedov void machine_run_board_init(MachineState *machine);
29*97ec4d21SPaolo Bonzini void machine_boot_parse(MachineState *ms, QemuOpts *opts, Error **errp);
305e97b623SMarcel Apfelbaum bool machine_usb(MachineState *machine);
316cabe7faSMarcel Apfelbaum int machine_phandle_start(MachineState *machine);
3247c8ca53SMarcel Apfelbaum bool machine_dump_guest_core(MachineState *machine);
3375cc7f01SMarcel Apfelbaum bool machine_mem_merge(MachineState *machine);
34f2d672c2SIgor Mammedov HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine);
357c88e65dSIgor Mammedov void machine_set_cpu_numa_node(MachineState *machine,
367c88e65dSIgor Mammedov                                const CpuInstanceProperties *props,
377c88e65dSIgor Mammedov                                Error **errp);
383e2f1498SPhilippe Mathieu-Daudé void machine_parse_smp_config(MachineState *ms,
393e2f1498SPhilippe Mathieu-Daudé                               const SMPConfiguration *config, Error **errp);
405e97b623SMarcel Apfelbaum 
41387c0e8bSPeter Maydell /**
42387c0e8bSPeter Maydell  * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices
43387c0e8bSPeter Maydell  * @mc: Machine class
44387c0e8bSPeter Maydell  * @type: type to allow (should be a subtype of TYPE_SYS_BUS_DEVICE)
45387c0e8bSPeter Maydell  *
46387c0e8bSPeter Maydell  * Add the QOM type @type to the list of devices of which are subtypes
47387c0e8bSPeter Maydell  * of TYPE_SYS_BUS_DEVICE but which are still permitted to be dynamically
48387c0e8bSPeter Maydell  * created (eg by the user on the command line with -device).
49387c0e8bSPeter Maydell  * By default if the user tries to create any devices on the command line
50387c0e8bSPeter Maydell  * that are subtypes of TYPE_SYS_BUS_DEVICE they will get an error message;
51387c0e8bSPeter Maydell  * for the special cases which are permitted for this machine model, the
52387c0e8bSPeter Maydell  * machine model class init code must call this function to add them
53387c0e8bSPeter Maydell  * to the list of specifically permitted devices.
54387c0e8bSPeter Maydell  */
550bd1909dSEduardo Habkost void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type);
56387c0e8bSPeter Maydell 
570fb124dbSPeter Maydell /**
58b5fdf410SDamien Hedde  * device_type_is_dynamic_sysbus: Check if type is an allowed sysbus device
59b5fdf410SDamien Hedde  * type for the machine class.
60b5fdf410SDamien Hedde  * @mc: Machine class
61b5fdf410SDamien Hedde  * @type: type to check (should be a subtype of TYPE_SYS_BUS_DEVICE)
62b5fdf410SDamien Hedde  *
63b5fdf410SDamien Hedde  * Returns: true if @type is a type in the machine's list of
64b5fdf410SDamien Hedde  * dynamically pluggable sysbus devices; otherwise false.
65b5fdf410SDamien Hedde  *
66b5fdf410SDamien Hedde  * Check if the QOM type @type is in the list of allowed sysbus device
67b5fdf410SDamien Hedde  * types (see machine_class_allowed_dynamic_sysbus_dev()).
68b5fdf410SDamien Hedde  * Note that if @type has a parent type in the list, it is allowed too.
69b5fdf410SDamien Hedde  */
70b5fdf410SDamien Hedde bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type);
71b5fdf410SDamien Hedde 
72b5fdf410SDamien Hedde /**
730fb124dbSPeter Maydell  * device_is_dynamic_sysbus: test whether device is a dynamic sysbus device
740fb124dbSPeter Maydell  * @mc: Machine class
750fb124dbSPeter Maydell  * @dev: device to check
760fb124dbSPeter Maydell  *
770fb124dbSPeter Maydell  * Returns: true if @dev is a sysbus device on the machine's list
780fb124dbSPeter Maydell  * of dynamically pluggable sysbus devices; otherwise false.
790fb124dbSPeter Maydell  *
800fb124dbSPeter Maydell  * This function checks whether @dev is a valid dynamic sysbus device,
810fb124dbSPeter Maydell  * by first confirming that it is a sysbus device and then checking it
820fb124dbSPeter Maydell  * against the list of permitted dynamic sysbus devices which has been
830fb124dbSPeter Maydell  * set up by the machine using machine_class_allow_dynamic_sysbus_dev().
840fb124dbSPeter Maydell  *
850fb124dbSPeter Maydell  * It is valid to call this with something that is not a subclass of
860fb124dbSPeter Maydell  * TYPE_SYS_BUS_DEVICE; the function will return false in this case.
870fb124dbSPeter Maydell  * This allows hotplug callback functions to be written as:
880fb124dbSPeter Maydell  *     if (device_is_dynamic_sysbus(mc, dev)) {
890fb124dbSPeter Maydell  *         handle dynamic sysbus case;
900fb124dbSPeter Maydell  *     } else if (some other kind of hotplug) {
910fb124dbSPeter Maydell  *         handle that;
920fb124dbSPeter Maydell  *     }
930fb124dbSPeter Maydell  */
940fb124dbSPeter Maydell bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev);
950fb124dbSPeter Maydell 
9682b911aaSIgor Mammedov /*
9782b911aaSIgor Mammedov  * Checks that backend isn't used, preps it for exclusive usage and
9882b911aaSIgor Mammedov  * returns migratable MemoryRegion provided by backend.
9982b911aaSIgor Mammedov  */
10082b911aaSIgor Mammedov MemoryRegion *machine_consume_memdev(MachineState *machine,
10182b911aaSIgor Mammedov                                      HostMemoryBackend *backend);
1020bd1909dSEduardo Habkost 
10336d20cb2SMarcel Apfelbaum /**
1043811ef14SIgor Mammedov  * CPUArchId:
1053811ef14SIgor Mammedov  * @arch_id - architecture-dependent CPU ID of present or possible CPU
1063811ef14SIgor Mammedov  * @cpu - pointer to corresponding CPU object if it's present on NULL otherwise
107d342eb76SIgor Mammedov  * @type - QOM class name of possible @cpu object
108c67ae933SIgor Mammedov  * @props - CPU object properties, initialized by board
109f2d672c2SIgor Mammedov  * #vcpus_count - number of threads provided by @cpu object
1103811ef14SIgor Mammedov  */
111a44432b4SMarkus Armbruster typedef struct CPUArchId {
1123811ef14SIgor Mammedov     uint64_t arch_id;
113f2d672c2SIgor Mammedov     int64_t vcpus_count;
114c67ae933SIgor Mammedov     CpuInstanceProperties props;
1158aba3842SIgor Mammedov     Object *cpu;
116d342eb76SIgor Mammedov     const char *type;
1173811ef14SIgor Mammedov } CPUArchId;
1183811ef14SIgor Mammedov 
1193811ef14SIgor Mammedov /**
1203811ef14SIgor Mammedov  * CPUArchIdList:
1213811ef14SIgor Mammedov  * @len - number of @CPUArchId items in @cpus array
1223811ef14SIgor Mammedov  * @cpus - array of present or possible CPUs for current machine configuration
1233811ef14SIgor Mammedov  */
1243811ef14SIgor Mammedov typedef struct {
1253811ef14SIgor Mammedov     int len;
126880a7817SPhilippe Mathieu-Daudé     CPUArchId cpus[];
1273811ef14SIgor Mammedov } CPUArchIdList;
1283811ef14SIgor Mammedov 
1293811ef14SIgor Mammedov /**
130e4a97a89SYanan Wang  * SMPCompatProps:
1312b526199SYanan Wang  * @prefer_sockets - whether sockets are preferred over cores in smp parsing
132e4a97a89SYanan Wang  * @dies_supported - whether dies are supported by the machine
133864c3b5cSYanan Wang  * @clusters_supported - whether clusters are supported by the machine
134e4a97a89SYanan Wang  */
135e4a97a89SYanan Wang typedef struct {
1362b526199SYanan Wang     bool prefer_sockets;
137e4a97a89SYanan Wang     bool dies_supported;
138864c3b5cSYanan Wang     bool clusters_supported;
139e4a97a89SYanan Wang } SMPCompatProps;
140e4a97a89SYanan Wang 
141e4a97a89SYanan Wang /**
14236d20cb2SMarcel Apfelbaum  * MachineClass:
14308fe6824SThomas Huth  * @deprecation_reason: If set, the machine is marked as deprecated. The
14408fe6824SThomas Huth  *    string should provide some clear information about what to use instead.
14572649619SEmilio G. Cota  * @max_cpus: maximum number of CPUs supported. Default: 1
14672649619SEmilio G. Cota  * @min_cpus: minimum number of CPUs supported. Default: 1
14772649619SEmilio G. Cota  * @default_cpus: number of CPUs instantiated if none are specified. Default: 1
148ea0ac7f6SPhilippe Mathieu-Daudé  * @is_default:
149ea0ac7f6SPhilippe Mathieu-Daudé  *    If true QEMU will use this machine by default if no '-M' option is given.
150b7454548SIgor Mammedov  * @get_hotplug_handler: this function is called during bus-less
151b7454548SIgor Mammedov  *    device hotplug. If defined it returns pointer to an instance
152b7454548SIgor Mammedov  *    of HotplugHandler object, which handles hotplug operation
153b7454548SIgor Mammedov  *    for a given @dev. It may return NULL if @dev doesn't require
154b7454548SIgor Mammedov  *    any actions to be performed by hotplug handler.
155ea089eebSIgor Mammedov  * @cpu_index_to_instance_props:
156ea089eebSIgor Mammedov  *    used to provide @cpu_index to socket/core/thread number mapping, allowing
157ea089eebSIgor Mammedov  *    legacy code to perform maping from cpu_index to topology properties
158ea089eebSIgor Mammedov  *    Returns: tuple of socket/core/thread ids given cpu_index belongs to.
15957924bcdSIgor Mammedov  *    used to provide @cpu_index to socket number mapping, allowing
16057924bcdSIgor Mammedov  *    a machine to group CPU threads belonging to the same socket/package
16157924bcdSIgor Mammedov  *    Returns: socket number given cpu_index belongs to.
162fac862ffSEduardo Habkost  * @hw_version:
163fac862ffSEduardo Habkost  *    Value of QEMU_VERSION when the machine was added to QEMU.
164fac862ffSEduardo Habkost  *    Set only by old machines because they need to keep
165fac862ffSEduardo Habkost  *    compatibility on code that exposed QEMU_VERSION to guests in
166fac862ffSEduardo Habkost  *    the past (and now use qemu_hw_version()).
1673811ef14SIgor Mammedov  * @possible_cpu_arch_ids:
1683811ef14SIgor Mammedov  *    Returns an array of @CPUArchId architecture-dependent CPU IDs
1693811ef14SIgor Mammedov  *    which includes CPU IDs for present and possible to hotplug CPUs.
1703811ef14SIgor Mammedov  *    Caller is responsible for freeing returned list.
17179e07936SIgor Mammedov  * @get_default_cpu_node_id:
17279e07936SIgor Mammedov  *    returns default board specific node_id value for CPU slot specified by
17379e07936SIgor Mammedov  *    index @idx in @ms->possible_cpus[]
174c5514d0eSIgor Mammedov  * @has_hotpluggable_cpus:
175c5514d0eSIgor Mammedov  *    If true, board supports CPUs creation with -device/device_add.
1766063d4c0SIgor Mammedov  * @default_cpu_type:
1776063d4c0SIgor Mammedov  *    specifies default CPU_TYPE, which will be used for parsing target
1786063d4c0SIgor Mammedov  *    specific features and for creating CPUs if CPU name wasn't provided
1796063d4c0SIgor Mammedov  *    explicitly at CLI
18020bccb82SPeter Maydell  * @minimum_page_bits:
18120bccb82SPeter Maydell  *    If non-zero, the board promises never to create a CPU with a page size
18220bccb82SPeter Maydell  *    smaller than this, so QEMU can use a more efficient larger page
18320bccb82SPeter Maydell  *    size than the target architecture's minimum. (Attempting to create
18420bccb82SPeter Maydell  *    such a CPU will fail.) Note that changing this is a migration
18520bccb82SPeter Maydell  *    compatibility break for the machine.
186ed860129SPeter Maydell  * @ignore_memory_transaction_failures:
187ed860129SPeter Maydell  *    If this is flag is true then the CPU will ignore memory transaction
188ed860129SPeter Maydell  *    failures which should cause the CPU to take an exception due to an
189ed860129SPeter Maydell  *    access to an unassigned physical address; the transaction will instead
190ed860129SPeter Maydell  *    return zero (for a read) or be ignored (for a write). This should be
191ed860129SPeter Maydell  *    set only by legacy board models which rely on the old RAZ/WI behaviour
192ed860129SPeter Maydell  *    for handling devices that QEMU does not yet model. New board models
193ed860129SPeter Maydell  *    should instead use "unimplemented-device" for all memory ranges where
194ed860129SPeter Maydell  *    the guest will attempt to probe for a device that QEMU doesn't
195ed860129SPeter Maydell  *    implement and a stub device is required.
196dc0ca80eSEric Auger  * @kvm_type:
197dc0ca80eSEric Auger  *    Return the type of KVM corresponding to the kvm-type string option or
198dc0ca80eSEric Auger  *    computed based on other criteria such as the host kernel capabilities.
199516fc0a0SAndrew Jones  *    kvm-type may be NULL if it is not needed.
200cd5ff833SIgor Mammedov  * @numa_mem_supported:
201cd5ff833SIgor Mammedov  *    true if '--numa node.mem' option is supported and false otherwise
202d2321d31SPeter Xu  * @hotplug_allowed:
203d2321d31SPeter Xu  *    If the hook is provided, then it'll be called for each device
204d2321d31SPeter Xu  *    hotplug to check whether the device hotplug is allowed.  Return
205d2321d31SPeter Xu  *    true to grant allowance or false to reject the hotplug.  When
206d2321d31SPeter Xu  *    false is returned, an error must be set to show the reason of
207d2321d31SPeter Xu  *    the rejection.  If the hook is not provided, all hotplug will be
208d2321d31SPeter Xu  *    allowed.
209900c0ba3SIgor Mammedov  * @default_ram_id:
210900c0ba3SIgor Mammedov  *    Specifies inital RAM MemoryRegion name to be used for default backend
211900c0ba3SIgor Mammedov  *    creation if user explicitly hasn't specified backend with "memory-backend"
212900c0ba3SIgor Mammedov  *    property.
213900c0ba3SIgor Mammedov  *    It also will be used as a way to optin into "-m" option support.
214900c0ba3SIgor Mammedov  *    If it's not set by board, '-m' will be ignored and generic code will
215900c0ba3SIgor Mammedov  *    not create default RAM MemoryRegion.
2165c30ef93SChristian Borntraeger  * @fixup_ram_size:
2175c30ef93SChristian Borntraeger  *    Amends user provided ram size (with -m option) using machine
2185c30ef93SChristian Borntraeger  *    specific algorithm. To be used by old machine types for compat
2195c30ef93SChristian Borntraeger  *    purposes only.
2205c30ef93SChristian Borntraeger  *    Applies only to default memory backend, i.e., explicit memory backend
2215c30ef93SChristian Borntraeger  *    wasn't used.
22236d20cb2SMarcel Apfelbaum  */
22336d20cb2SMarcel Apfelbaum struct MachineClass {
22436d20cb2SMarcel Apfelbaum     /*< private >*/
22536d20cb2SMarcel Apfelbaum     ObjectClass parent_class;
22636d20cb2SMarcel Apfelbaum     /*< public >*/
22736d20cb2SMarcel Apfelbaum 
2282709f263SLaszlo Ersek     const char *family; /* NULL iff @name identifies a standalone machtype */
2298ea75371SMarc-André Lureau     char *name;
23000b4fbe2SMarcel Apfelbaum     const char *alias;
23100b4fbe2SMarcel Apfelbaum     const char *desc;
23208fe6824SThomas Huth     const char *deprecation_reason;
23300b4fbe2SMarcel Apfelbaum 
2343ef96221SMarcel Apfelbaum     void (*init)(MachineState *state);
235a0628599SLike Xu     void (*reset)(MachineState *state);
2364b5e06c9SNicholas Piggin     void (*wakeup)(MachineState *state);
237dc0ca80eSEric Auger     int (*kvm_type)(MachineState *machine, const char *arg);
23800b4fbe2SMarcel Apfelbaum 
23900b4fbe2SMarcel Apfelbaum     BlockInterfaceType block_default_type;
24016026518SJohn Snow     int units_per_default_bus;
24100b4fbe2SMarcel Apfelbaum     int max_cpus;
24272649619SEmilio G. Cota     int min_cpus;
24372649619SEmilio G. Cota     int default_cpus;
24400b4fbe2SMarcel Apfelbaum     unsigned int no_serial:1,
24500b4fbe2SMarcel Apfelbaum         no_parallel:1,
24600b4fbe2SMarcel Apfelbaum         no_floppy:1,
24700b4fbe2SMarcel Apfelbaum         no_cdrom:1,
24833cd52b5SAlexander Graf         no_sdcard:1,
249bab47d9aSGerd Hoffmann         pci_allow_0_address:1,
250bab47d9aSGerd Hoffmann         legacy_fw_cfg_order:1;
251ea0ac7f6SPhilippe Mathieu-Daudé     bool is_default;
25200b4fbe2SMarcel Apfelbaum     const char *default_machine_opts;
25300b4fbe2SMarcel Apfelbaum     const char *default_boot_order;
2546f00494aSGerd Hoffmann     const char *default_display;
255b66bbee3SMarc-André Lureau     GPtrArray *compat_props;
25600b4fbe2SMarcel Apfelbaum     const char *hw_version;
257076b35b5SNikunj A Dadhania     ram_addr_t default_ram_size;
2586063d4c0SIgor Mammedov     const char *default_cpu_type;
259b2fc91dbSPeter Xu     bool default_kernel_irqchip_split;
26071ae9e94SEduardo Habkost     bool option_rom_has_mr;
26171ae9e94SEduardo Habkost     bool rom_file_has_mr;
26220bccb82SPeter Maydell     int minimum_page_bits;
263c5514d0eSIgor Mammedov     bool has_hotpluggable_cpus;
264ed860129SPeter Maydell     bool ignore_memory_transaction_failures;
26555641213SLaurent Vivier     int numa_mem_align_shift;
266c9cf636dSAlistair Francis     const char **valid_cpu_types;
2670bd1909dSEduardo Habkost     strList *allowed_dynamic_sysbus_devices;
2687b8be49dSDou Liyang     bool auto_enable_numa_with_memhp;
269195784a0SDavid Hildenbrand     bool auto_enable_numa_with_memdev;
270907aac2fSMark Cave-Ayland     bool ignore_boot_device_suffixes;
2717fccf2a0SCorey Minyard     bool smbus_no_migration_support;
272f6a0d06bSEric Auger     bool nvdimm_supported;
273cd5ff833SIgor Mammedov     bool numa_mem_supported;
2740533ef5fSTao Xu     bool auto_enable_numa;
275e4a97a89SYanan Wang     SMPCompatProps smp_props;
276900c0ba3SIgor Mammedov     const char *default_ram_id;
277b7454548SIgor Mammedov 
278b7454548SIgor Mammedov     HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
279b7454548SIgor Mammedov                                            DeviceState *dev);
280d2321d31SPeter Xu     bool (*hotplug_allowed)(MachineState *state, DeviceState *dev,
281d2321d31SPeter Xu                             Error **errp);
282ea089eebSIgor Mammedov     CpuInstanceProperties (*cpu_index_to_instance_props)(MachineState *machine,
283ea089eebSIgor Mammedov                                                          unsigned cpu_index);
28480e5db30SIgor Mammedov     const CPUArchIdList *(*possible_cpu_arch_ids)(MachineState *machine);
28579e07936SIgor Mammedov     int64_t (*get_default_cpu_node_id)(const MachineState *ms, int idx);
2865c30ef93SChristian Borntraeger     ram_addr_t (*fixup_ram_size)(ram_addr_t size);
28736d20cb2SMarcel Apfelbaum };
28836d20cb2SMarcel Apfelbaum 
28936d20cb2SMarcel Apfelbaum /**
290e017da37SDavid Hildenbrand  * DeviceMemoryState:
291b0c14ec4SDavid Hildenbrand  * @base: address in guest physical address space where the memory
292b0c14ec4SDavid Hildenbrand  * address space for memory devices starts
293b0c14ec4SDavid Hildenbrand  * @mr: address space container for memory devices
294b0c14ec4SDavid Hildenbrand  */
295e017da37SDavid Hildenbrand typedef struct DeviceMemoryState {
296b0c14ec4SDavid Hildenbrand     hwaddr base;
297b0c14ec4SDavid Hildenbrand     MemoryRegion mr;
298e017da37SDavid Hildenbrand } DeviceMemoryState;
299b0c14ec4SDavid Hildenbrand 
300b0c14ec4SDavid Hildenbrand /**
301edeeec91SLike Xu  * CpuTopology:
302edeeec91SLike Xu  * @cpus: the number of present logical processors on the machine
3038cb30e3aSBabu Moger  * @sockets: the number of sockets on the machine
304003f230eSYanan Wang  * @dies: the number of dies in one socket
305864c3b5cSYanan Wang  * @clusters: the number of clusters in one die
306864c3b5cSYanan Wang  * @cores: the number of cores in one cluster
307003f230eSYanan Wang  * @threads: the number of threads in one core
308edeeec91SLike Xu  * @max_cpus: the maximum number of logical processors on the machine
309edeeec91SLike Xu  */
310edeeec91SLike Xu typedef struct CpuTopology {
311edeeec91SLike Xu     unsigned int cpus;
312003f230eSYanan Wang     unsigned int sockets;
31367872eb8SPaolo Bonzini     unsigned int dies;
314864c3b5cSYanan Wang     unsigned int clusters;
315edeeec91SLike Xu     unsigned int cores;
316edeeec91SLike Xu     unsigned int threads;
317edeeec91SLike Xu     unsigned int max_cpus;
318edeeec91SLike Xu } CpuTopology;
319edeeec91SLike Xu 
320edeeec91SLike Xu /**
32136d20cb2SMarcel Apfelbaum  * MachineState:
32236d20cb2SMarcel Apfelbaum  */
32336d20cb2SMarcel Apfelbaum struct MachineState {
32436d20cb2SMarcel Apfelbaum     /*< private >*/
32536d20cb2SMarcel Apfelbaum     Object parent_obj;
32633cd52b5SAlexander Graf 
32736d20cb2SMarcel Apfelbaum     /*< public >*/
32836d20cb2SMarcel Apfelbaum 
329a6487d37SAlex Bennée     void *fdt;
33036d20cb2SMarcel Apfelbaum     char *dtb;
33136d20cb2SMarcel Apfelbaum     char *dumpdtb;
33236d20cb2SMarcel Apfelbaum     int phandle_start;
33336d20cb2SMarcel Apfelbaum     char *dt_compatible;
33436d20cb2SMarcel Apfelbaum     bool dump_guest_core;
33536d20cb2SMarcel Apfelbaum     bool mem_merge;
33636d20cb2SMarcel Apfelbaum     bool usb;
337c6e76503SPaolo Bonzini     bool usb_disabled;
33836d20cb2SMarcel Apfelbaum     char *firmware;
339a52a7fdfSLe Tan     bool iommu;
3409850c604SAlexander Graf     bool suppress_vmdesc;
341cfc58cf3SEduardo Habkost     bool enable_graphics;
342e0292d7cSDavid Gibson     ConfidentialGuestSupport *cgs;
343aa8b1839SIgor Mammedov     char *ram_memdev_id;
34482b911aaSIgor Mammedov     /*
34582b911aaSIgor Mammedov      * convenience alias to ram_memdev_id backend memory region
34682b911aaSIgor Mammedov      * or to numa container memory region
34782b911aaSIgor Mammedov      */
34882b911aaSIgor Mammedov     MemoryRegion *ram;
349e017da37SDavid Hildenbrand     DeviceMemoryState *device_memory;
35036d20cb2SMarcel Apfelbaum 
3513ef96221SMarcel Apfelbaum     ram_addr_t ram_size;
352c270fb9eSIgor Mammedov     ram_addr_t maxram_size;
353c270fb9eSIgor Mammedov     uint64_t   ram_slots;
354*97ec4d21SPaolo Bonzini     BootConfiguration boot_config;
3556b1b1440SMarcel Apfelbaum     char *kernel_filename;
3566b1b1440SMarcel Apfelbaum     char *kernel_cmdline;
3576b1b1440SMarcel Apfelbaum     char *initrd_filename;
3586063d4c0SIgor Mammedov     const char *cpu_type;
359ac2da55eSEduardo Habkost     AccelState *accelerator;
36038690a1cSIgor Mammedov     CPUArchIdList *possible_cpus;
361edeeec91SLike Xu     CpuTopology smp;
362f6a0d06bSEric Auger     struct NVDIMMState *nvdimms_state;
363aa570207STao Xu     struct NumaState *numa_state;
36436d20cb2SMarcel Apfelbaum };
36536d20cb2SMarcel Apfelbaum 
366ed0b6de3SEduardo Habkost #define DEFINE_MACHINE(namestr, machine_initfn) \
367ed0b6de3SEduardo Habkost     static void machine_initfn##_class_init(ObjectClass *oc, void *data) \
368ed0b6de3SEduardo Habkost     { \
369ed0b6de3SEduardo Habkost         MachineClass *mc = MACHINE_CLASS(oc); \
370ed0b6de3SEduardo Habkost         machine_initfn(mc); \
371ed0b6de3SEduardo Habkost     } \
372ed0b6de3SEduardo Habkost     static const TypeInfo machine_initfn##_typeinfo = { \
373ed0b6de3SEduardo Habkost         .name       = MACHINE_TYPE_NAME(namestr), \
374ed0b6de3SEduardo Habkost         .parent     = TYPE_MACHINE, \
375ed0b6de3SEduardo Habkost         .class_init = machine_initfn##_class_init, \
376ed0b6de3SEduardo Habkost     }; \
377ed0b6de3SEduardo Habkost     static void machine_initfn##_register_types(void) \
378ed0b6de3SEduardo Habkost     { \
379ed0b6de3SEduardo Habkost         type_register_static(&machine_initfn##_typeinfo); \
380ed0b6de3SEduardo Habkost     } \
3810e6aac87SEduardo Habkost     type_init(machine_initfn##_register_types)
382ed0b6de3SEduardo Habkost 
3830ca70366SCornelia Huck extern GlobalProperty hw_compat_7_0[];
3840ca70366SCornelia Huck extern const size_t hw_compat_7_0_len;
3850ca70366SCornelia Huck 
38601854af2SCornelia Huck extern GlobalProperty hw_compat_6_2[];
38701854af2SCornelia Huck extern const size_t hw_compat_6_2_len;
38801854af2SCornelia Huck 
38952e64f5bSYanan Wang extern GlobalProperty hw_compat_6_1[];
39052e64f5bSYanan Wang extern const size_t hw_compat_6_1_len;
39152e64f5bSYanan Wang 
392da7e13c0SCornelia Huck extern GlobalProperty hw_compat_6_0[];
393da7e13c0SCornelia Huck extern const size_t hw_compat_6_0_len;
394da7e13c0SCornelia Huck 
395576a00bdSCornelia Huck extern GlobalProperty hw_compat_5_2[];
396576a00bdSCornelia Huck extern const size_t hw_compat_5_2_len;
397576a00bdSCornelia Huck 
3983ff3c5d3SCornelia Huck extern GlobalProperty hw_compat_5_1[];
3993ff3c5d3SCornelia Huck extern const size_t hw_compat_5_1_len;
4003ff3c5d3SCornelia Huck 
401541aaa1dSCornelia Huck extern GlobalProperty hw_compat_5_0[];
402541aaa1dSCornelia Huck extern const size_t hw_compat_5_0_len;
403541aaa1dSCornelia Huck 
4045f258577SEvgeny Yakovlev extern GlobalProperty hw_compat_4_2[];
4055f258577SEvgeny Yakovlev extern const size_t hw_compat_4_2_len;
4065f258577SEvgeny Yakovlev 
4079aec2e52SCornelia Huck extern GlobalProperty hw_compat_4_1[];
4089aec2e52SCornelia Huck extern const size_t hw_compat_4_1_len;
4099aec2e52SCornelia Huck 
4109bf2650bSCornelia Huck extern GlobalProperty hw_compat_4_0[];
4119bf2650bSCornelia Huck extern const size_t hw_compat_4_0_len;
4129bf2650bSCornelia Huck 
413abd93cc7SMarc-André Lureau extern GlobalProperty hw_compat_3_1[];
414abd93cc7SMarc-André Lureau extern const size_t hw_compat_3_1_len;
415abd93cc7SMarc-André Lureau 
416ddb3235dSMarc-André Lureau extern GlobalProperty hw_compat_3_0[];
417ddb3235dSMarc-André Lureau extern const size_t hw_compat_3_0_len;
418ddb3235dSMarc-André Lureau 
4190d47310bSMarc-André Lureau extern GlobalProperty hw_compat_2_12[];
4200d47310bSMarc-André Lureau extern const size_t hw_compat_2_12_len;
4210d47310bSMarc-André Lureau 
42243df70a9SMarc-André Lureau extern GlobalProperty hw_compat_2_11[];
42343df70a9SMarc-André Lureau extern const size_t hw_compat_2_11_len;
42443df70a9SMarc-André Lureau 
425503224f4SMarc-André Lureau extern GlobalProperty hw_compat_2_10[];
426503224f4SMarc-André Lureau extern const size_t hw_compat_2_10_len;
427503224f4SMarc-André Lureau 
4283e803152SMarc-André Lureau extern GlobalProperty hw_compat_2_9[];
4293e803152SMarc-André Lureau extern const size_t hw_compat_2_9_len;
4303e803152SMarc-André Lureau 
431edc24ccdSMarc-André Lureau extern GlobalProperty hw_compat_2_8[];
432edc24ccdSMarc-André Lureau extern const size_t hw_compat_2_8_len;
433edc24ccdSMarc-André Lureau 
4345a995064SMarc-André Lureau extern GlobalProperty hw_compat_2_7[];
4355a995064SMarc-André Lureau extern const size_t hw_compat_2_7_len;
4365a995064SMarc-André Lureau 
437ff8f261fSMarc-André Lureau extern GlobalProperty hw_compat_2_6[];
438ff8f261fSMarc-André Lureau extern const size_t hw_compat_2_6_len;
439ff8f261fSMarc-André Lureau 
440fe759610SMarc-André Lureau extern GlobalProperty hw_compat_2_5[];
441fe759610SMarc-André Lureau extern const size_t hw_compat_2_5_len;
442fe759610SMarc-André Lureau 
4432f99b9c2SMarc-André Lureau extern GlobalProperty hw_compat_2_4[];
4442f99b9c2SMarc-André Lureau extern const size_t hw_compat_2_4_len;
4452f99b9c2SMarc-André Lureau 
4468995dd90SMarc-André Lureau extern GlobalProperty hw_compat_2_3[];
4478995dd90SMarc-André Lureau extern const size_t hw_compat_2_3_len;
4488995dd90SMarc-André Lureau 
4491c30044eSMarc-André Lureau extern GlobalProperty hw_compat_2_2[];
4501c30044eSMarc-André Lureau extern const size_t hw_compat_2_2_len;
4511c30044eSMarc-André Lureau 
452c4fc5695SMarc-André Lureau extern GlobalProperty hw_compat_2_1[];
453c4fc5695SMarc-André Lureau extern const size_t hw_compat_2_1_len;
454c4fc5695SMarc-André Lureau 
4550d09e41aSPaolo Bonzini #endif
456