]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/boards.h
spapr: skip configuration section during migration of older machines
[mirror_qemu.git] / include / hw / boards.h
CommitLineData
87ecb68b
PB
1/* Declarations for use by board files for creating devices. */
2
3#ifndef HW_BOARDS_H
4#define HW_BOARDS_H
5
f1e29879 6#include "qemu/typedefs.h"
9c17d615 7#include "sysemu/blockdev.h"
ac2da55e 8#include "sysemu/accel.h"
83c9f4ca 9#include "hw/qdev.h"
36d20cb2 10#include "qom/object.h"
b6b61144 11
dfabb8b9
PB
12void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
13 const char *name,
14 uint64_t ram_size);
15
dfabb8b9 16#define TYPE_MACHINE_SUFFIX "-machine"
c84a8f01
EH
17
18/* Machine class name that needs to be used for class-name-based machine
19 * type lookup to work.
20 */
21#define MACHINE_TYPE_NAME(machinename) (machinename TYPE_MACHINE_SUFFIX)
22
36d20cb2 23#define TYPE_MACHINE "machine"
c8897e8e 24#undef MACHINE /* BSD defines it and QEMU does not use it */
36d20cb2
MA
25#define MACHINE(obj) \
26 OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
27#define MACHINE_GET_CLASS(obj) \
28 OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
29#define MACHINE_CLASS(klass) \
30 OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
31
0056ae24
MA
32MachineClass *find_default_machine(void);
33extern MachineState *current_machine;
34
5e97b623 35bool machine_usb(MachineState *machine);
d8870d02
MA
36bool machine_kernel_irqchip_allowed(MachineState *machine);
37bool machine_kernel_irqchip_required(MachineState *machine);
32c18a2d 38bool machine_kernel_irqchip_split(MachineState *machine);
4689b77b 39int machine_kvm_shadow_mem(MachineState *machine);
6cabe7fa 40int machine_phandle_start(MachineState *machine);
47c8ca53 41bool machine_dump_guest_core(MachineState *machine);
75cc7f01 42bool machine_mem_merge(MachineState *machine);
5e97b623 43
36d20cb2
MA
44/**
45 * MachineClass:
b7454548
IM
46 * @get_hotplug_handler: this function is called during bus-less
47 * device hotplug. If defined it returns pointer to an instance
48 * of HotplugHandler object, which handles hotplug operation
49 * for a given @dev. It may return NULL if @dev doesn't require
50 * any actions to be performed by hotplug handler.
57924bcd
IM
51 * @cpu_index_to_socket_id:
52 * used to provide @cpu_index to socket number mapping, allowing
53 * a machine to group CPU threads belonging to the same socket/package
54 * Returns: socket number given cpu_index belongs to.
fac862ff
EH
55 * @hw_version:
56 * Value of QEMU_VERSION when the machine was added to QEMU.
57 * Set only by old machines because they need to keep
58 * compatibility on code that exposed QEMU_VERSION to guests in
59 * the past (and now use qemu_hw_version()).
36d20cb2
MA
60 */
61struct MachineClass {
62 /*< private >*/
63 ObjectClass parent_class;
64 /*< public >*/
65
2709f263 66 const char *family; /* NULL iff @name identifies a standalone machtype */
00b4fbe2
MA
67 const char *name;
68 const char *alias;
69 const char *desc;
70
3ef96221 71 void (*init)(MachineState *state);
00b4fbe2
MA
72 void (*reset)(void);
73 void (*hot_add_cpu)(const int64_t id, Error **errp);
74 int (*kvm_type)(const char *arg);
75
76 BlockInterfaceType block_default_type;
16026518 77 int units_per_default_bus;
00b4fbe2
MA
78 int max_cpus;
79 unsigned int no_serial:1,
80 no_parallel:1,
81 use_virtcon:1,
82 use_sclp:1,
83 no_floppy:1,
84 no_cdrom:1,
33cd52b5 85 no_sdcard:1,
92055797 86 has_dynamic_sysbus:1,
e4024630 87 pci_allow_0_address:1;
00b4fbe2
MA
88 int is_default;
89 const char *default_machine_opts;
90 const char *default_boot_order;
6f00494a 91 const char *default_display;
00b4fbe2
MA
92 GlobalProperty *compat_props;
93 const char *hw_version;
076b35b5 94 ram_addr_t default_ram_size;
71ae9e94
EH
95 bool option_rom_has_mr;
96 bool rom_file_has_mr;
b7454548
IM
97
98 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
99 DeviceState *dev);
57924bcd 100 unsigned (*cpu_index_to_socket_id)(unsigned cpu_index);
36d20cb2
MA
101};
102
103/**
104 * MachineState:
105 */
106struct MachineState {
107 /*< private >*/
108 Object parent_obj;
33cd52b5
AG
109 Notifier sysbus_notifier;
110
36d20cb2
MA
111 /*< public >*/
112
113 char *accel;
d8870d02
MA
114 bool kernel_irqchip_allowed;
115 bool kernel_irqchip_required;
32c18a2d 116 bool kernel_irqchip_split;
36d20cb2 117 int kvm_shadow_mem;
36d20cb2
MA
118 char *dtb;
119 char *dumpdtb;
120 int phandle_start;
121 char *dt_compatible;
122 bool dump_guest_core;
123 bool mem_merge;
124 bool usb;
c6e76503 125 bool usb_disabled;
79814179 126 bool igd_gfx_passthru;
36d20cb2 127 char *firmware;
a52a7fdf 128 bool iommu;
9850c604 129 bool suppress_vmdesc;
36d20cb2 130
3ef96221 131 ram_addr_t ram_size;
c270fb9e
IM
132 ram_addr_t maxram_size;
133 uint64_t ram_slots;
3ef96221 134 const char *boot_order;
6b1b1440
MA
135 char *kernel_filename;
136 char *kernel_cmdline;
137 char *initrd_filename;
3ef96221 138 const char *cpu_model;
ac2da55e 139 AccelState *accelerator;
36d20cb2
MA
140};
141
ed0b6de3
EH
142#define DEFINE_MACHINE(namestr, machine_initfn) \
143 static void machine_initfn##_class_init(ObjectClass *oc, void *data) \
144 { \
145 MachineClass *mc = MACHINE_CLASS(oc); \
146 machine_initfn(mc); \
147 } \
148 static const TypeInfo machine_initfn##_typeinfo = { \
149 .name = MACHINE_TYPE_NAME(namestr), \
150 .parent = TYPE_MACHINE, \
151 .class_init = machine_initfn##_class_init, \
152 }; \
153 static void machine_initfn##_register_types(void) \
154 { \
155 type_register_static(&machine_initfn##_typeinfo); \
156 } \
157 machine_init(machine_initfn##_register_types)
158
877f8931
DG
159#define SET_MACHINE_COMPAT(m, COMPAT) \
160 do { \
161 static GlobalProperty props[] = { \
162 COMPAT \
163 { /* end of list */ } \
164 }; \
165 (m)->compat_props = props; \
166 } while (0)
167
87ecb68b 168#endif