]> git.proxmox.com Git - mirror_qemu.git/blob - include/hw/boards.h
numa: introduce machine callback for VCPU to node mapping
[mirror_qemu.git] / include / hw / boards.h
1 /* Declarations for use by board files for creating devices. */
2
3 #ifndef HW_BOARDS_H
4 #define HW_BOARDS_H
5
6 #include "qemu/typedefs.h"
7 #include "sysemu/blockdev.h"
8 #include "sysemu/accel.h"
9 #include "hw/qdev.h"
10 #include "qom/object.h"
11
12
13 typedef void QEMUMachineInitFunc(MachineState *ms);
14
15 typedef void QEMUMachineResetFunc(void);
16
17 typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
18
19 typedef int QEMUMachineGetKvmtypeFunc(const char *arg);
20
21 struct QEMUMachine {
22 const char *family; /* NULL iff @name identifies a standalone machtype */
23 const char *name;
24 const char *alias;
25 const char *desc;
26 QEMUMachineInitFunc *init;
27 QEMUMachineResetFunc *reset;
28 QEMUMachineHotAddCPUFunc *hot_add_cpu;
29 QEMUMachineGetKvmtypeFunc *kvm_type;
30 BlockInterfaceType block_default_type;
31 int units_per_default_bus;
32 int max_cpus;
33 unsigned int no_serial:1,
34 no_parallel:1,
35 use_virtcon:1,
36 use_sclp:1,
37 no_floppy:1,
38 no_cdrom:1,
39 no_sdcard:1,
40 has_dynamic_sysbus:1;
41 int is_default;
42 const char *default_machine_opts;
43 const char *default_boot_order;
44 const char *default_display;
45 GlobalProperty *compat_props;
46 const char *hw_version;
47 };
48
49 void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
50 const char *name,
51 uint64_t ram_size);
52
53 int qemu_register_machine(QEMUMachine *m);
54
55 #define TYPE_MACHINE_SUFFIX "-machine"
56 #define TYPE_MACHINE "machine"
57 #undef MACHINE /* BSD defines it and QEMU does not use it */
58 #define MACHINE(obj) \
59 OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
60 #define MACHINE_GET_CLASS(obj) \
61 OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
62 #define MACHINE_CLASS(klass) \
63 OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
64
65 MachineClass *find_default_machine(void);
66 extern MachineState *current_machine;
67
68 bool machine_usb(MachineState *machine);
69 bool machine_iommu(MachineState *machine);
70 bool machine_kernel_irqchip_allowed(MachineState *machine);
71 bool machine_kernel_irqchip_required(MachineState *machine);
72 int machine_kvm_shadow_mem(MachineState *machine);
73 int machine_phandle_start(MachineState *machine);
74 bool machine_dump_guest_core(MachineState *machine);
75 bool machine_mem_merge(MachineState *machine);
76
77 /**
78 * MachineClass:
79 * @qemu_machine: #QEMUMachine
80 * @get_hotplug_handler: this function is called during bus-less
81 * device hotplug. If defined it returns pointer to an instance
82 * of HotplugHandler object, which handles hotplug operation
83 * for a given @dev. It may return NULL if @dev doesn't require
84 * any actions to be performed by hotplug handler.
85 * @cpu_index_to_socket_id:
86 * used to provide @cpu_index to socket number mapping, allowing
87 * a machine to group CPU threads belonging to the same socket/package
88 * Returns: socket number given cpu_index belongs to.
89 */
90 struct MachineClass {
91 /*< private >*/
92 ObjectClass parent_class;
93 /*< public >*/
94
95 const char *family; /* NULL iff @name identifies a standalone machtype */
96 const char *name;
97 const char *alias;
98 const char *desc;
99
100 void (*init)(MachineState *state);
101 void (*reset)(void);
102 void (*hot_add_cpu)(const int64_t id, Error **errp);
103 int (*kvm_type)(const char *arg);
104
105 BlockInterfaceType block_default_type;
106 int units_per_default_bus;
107 int max_cpus;
108 unsigned int no_serial:1,
109 no_parallel:1,
110 use_virtcon:1,
111 use_sclp:1,
112 no_floppy:1,
113 no_cdrom:1,
114 no_sdcard:1,
115 has_dynamic_sysbus:1;
116 int is_default;
117 const char *default_machine_opts;
118 const char *default_boot_order;
119 const char *default_display;
120 GlobalProperty *compat_props;
121 const char *hw_version;
122
123 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
124 DeviceState *dev);
125 unsigned (*cpu_index_to_socket_id)(unsigned cpu_index);
126 };
127
128 /**
129 * MachineState:
130 */
131 struct MachineState {
132 /*< private >*/
133 Object parent_obj;
134 Notifier sysbus_notifier;
135
136 /*< public >*/
137
138 char *accel;
139 bool kernel_irqchip_allowed;
140 bool kernel_irqchip_required;
141 int kvm_shadow_mem;
142 char *dtb;
143 char *dumpdtb;
144 int phandle_start;
145 char *dt_compatible;
146 bool dump_guest_core;
147 bool mem_merge;
148 bool usb;
149 char *firmware;
150 bool iommu;
151 bool suppress_vmdesc;
152
153 ram_addr_t ram_size;
154 ram_addr_t maxram_size;
155 uint64_t ram_slots;
156 const char *boot_order;
157 char *kernel_filename;
158 char *kernel_cmdline;
159 char *initrd_filename;
160 const char *cpu_model;
161 AccelState *accelerator;
162 };
163
164 #endif