]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/boards.h
spapr_pci: emit hotplug add/remove events during hotplug
[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
5f072e1f 12
3ef96221 13typedef void QEMUMachineInitFunc(MachineState *ms);
87ecb68b 14
be522029
DG
15typedef void QEMUMachineResetFunc(void);
16
b4fc7b43
IM
17typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
18
135a129a
AK
19typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
20
e689f7c6 21struct QEMUMachine {
87ecb68b
PB
22 const char *name;
23 const char *desc;
24 QEMUMachineInitFunc *init;
135a129a 25 QEMUMachineGetKvmtypeFunc *kvm_type;
2d0d2837 26 BlockInterfaceType block_default_type;
b2097003 27 int max_cpus;
d48f4fa6 28 unsigned int
33cd52b5
AG
29 no_sdcard:1,
30 has_dynamic_sysbus:1;
0c257437 31 int is_default;
67b724e6 32 const char *default_machine_opts;
c1654732 33 const char *default_boot_order;
e689f7c6 34};
87ecb68b 35
dfabb8b9
PB
36void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
37 const char *name,
38 uint64_t ram_size);
39
87ecb68b 40int qemu_register_machine(QEMUMachine *m);
6f338c34 41
dfabb8b9 42#define TYPE_MACHINE_SUFFIX "-machine"
36d20cb2 43#define TYPE_MACHINE "machine"
c8897e8e 44#undef MACHINE /* BSD defines it and QEMU does not use it */
36d20cb2
MA
45#define MACHINE(obj) \
46 OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
47#define MACHINE_GET_CLASS(obj) \
48 OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
49#define MACHINE_CLASS(klass) \
50 OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
51
0056ae24
MA
52MachineClass *find_default_machine(void);
53extern MachineState *current_machine;
54
5e97b623 55bool machine_usb(MachineState *machine);
8caff636 56bool machine_iommu(MachineState *machine);
d8870d02
MA
57bool machine_kernel_irqchip_allowed(MachineState *machine);
58bool machine_kernel_irqchip_required(MachineState *machine);
4689b77b 59int machine_kvm_shadow_mem(MachineState *machine);
6cabe7fa 60int machine_phandle_start(MachineState *machine);
47c8ca53 61bool machine_dump_guest_core(MachineState *machine);
75cc7f01 62bool machine_mem_merge(MachineState *machine);
5e97b623 63
36d20cb2
MA
64/**
65 * MachineClass:
66 * @qemu_machine: #QEMUMachine
b7454548
IM
67 * @get_hotplug_handler: this function is called during bus-less
68 * device hotplug. If defined it returns pointer to an instance
69 * of HotplugHandler object, which handles hotplug operation
70 * for a given @dev. It may return NULL if @dev doesn't require
71 * any actions to be performed by hotplug handler.
57924bcd
IM
72 * @cpu_index_to_socket_id:
73 * used to provide @cpu_index to socket number mapping, allowing
74 * a machine to group CPU threads belonging to the same socket/package
75 * Returns: socket number given cpu_index belongs to.
36d20cb2
MA
76 */
77struct MachineClass {
78 /*< private >*/
79 ObjectClass parent_class;
80 /*< public >*/
81
2709f263 82 const char *family; /* NULL iff @name identifies a standalone machtype */
00b4fbe2
MA
83 const char *name;
84 const char *alias;
85 const char *desc;
86
3ef96221 87 void (*init)(MachineState *state);
00b4fbe2
MA
88 void (*reset)(void);
89 void (*hot_add_cpu)(const int64_t id, Error **errp);
90 int (*kvm_type)(const char *arg);
91
92 BlockInterfaceType block_default_type;
16026518 93 int units_per_default_bus;
00b4fbe2
MA
94 int max_cpus;
95 unsigned int no_serial:1,
96 no_parallel:1,
97 use_virtcon:1,
98 use_sclp:1,
99 no_floppy:1,
100 no_cdrom:1,
33cd52b5
AG
101 no_sdcard:1,
102 has_dynamic_sysbus:1;
00b4fbe2
MA
103 int is_default;
104 const char *default_machine_opts;
105 const char *default_boot_order;
6f00494a 106 const char *default_display;
00b4fbe2
MA
107 GlobalProperty *compat_props;
108 const char *hw_version;
b7454548
IM
109
110 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
111 DeviceState *dev);
57924bcd 112 unsigned (*cpu_index_to_socket_id)(unsigned cpu_index);
36d20cb2
MA
113};
114
115/**
116 * MachineState:
117 */
118struct MachineState {
119 /*< private >*/
120 Object parent_obj;
33cd52b5
AG
121 Notifier sysbus_notifier;
122
36d20cb2
MA
123 /*< public >*/
124
125 char *accel;
d8870d02
MA
126 bool kernel_irqchip_allowed;
127 bool kernel_irqchip_required;
36d20cb2 128 int kvm_shadow_mem;
36d20cb2
MA
129 char *dtb;
130 char *dumpdtb;
131 int phandle_start;
132 char *dt_compatible;
133 bool dump_guest_core;
134 bool mem_merge;
135 bool usb;
c6e76503 136 bool usb_disabled;
36d20cb2 137 char *firmware;
a52a7fdf 138 bool iommu;
9850c604 139 bool suppress_vmdesc;
36d20cb2 140
3ef96221 141 ram_addr_t ram_size;
c270fb9e
IM
142 ram_addr_t maxram_size;
143 uint64_t ram_slots;
3ef96221 144 const char *boot_order;
6b1b1440
MA
145 char *kernel_filename;
146 char *kernel_cmdline;
147 char *initrd_filename;
3ef96221 148 const char *cpu_model;
ac2da55e 149 AccelState *accelerator;
36d20cb2
MA
150};
151
87ecb68b 152#endif