]> git.proxmox.com Git - qemu.git/blob - include/sysemu/sysemu.h
scsi: prefer UUID to VM name for the initiator name
[qemu.git] / include / sysemu / sysemu.h
1 #ifndef SYSEMU_H
2 #define SYSEMU_H
3 /* Misc. things related to the system emulator. */
4
5 #include "qemu/typedefs.h"
6 #include "qemu/option.h"
7 #include "qemu/queue.h"
8 #include "qemu/timer.h"
9 #include "qapi-types.h"
10 #include "qemu/notify.h"
11 #include "qemu/main-loop.h"
12
13 /* vl.c */
14
15 extern const char *bios_name;
16
17 extern const char *qemu_name;
18 extern uint8_t qemu_uuid[];
19 int qemu_uuid_parse(const char *str, uint8_t *uuid);
20
21 #define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
22 #define UUID_NONE "00000000-0000-0000-0000-000000000000"
23
24 bool runstate_check(RunState state);
25 void runstate_set(RunState new_state);
26 int runstate_is_running(void);
27 bool runstate_needs_reset(void);
28 typedef struct vm_change_state_entry VMChangeStateEntry;
29 typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
30
31 VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
32 void *opaque);
33 void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
34 void vm_state_notify(int running, RunState state);
35
36 #define VMRESET_SILENT false
37 #define VMRESET_REPORT true
38
39 void vm_start(void);
40 int vm_stop(RunState state);
41 int vm_stop_force_state(RunState state);
42
43 typedef enum WakeupReason {
44 QEMU_WAKEUP_REASON_OTHER = 0,
45 QEMU_WAKEUP_REASON_RTC,
46 QEMU_WAKEUP_REASON_PMTIMER,
47 } WakeupReason;
48
49 void qemu_system_reset_request(void);
50 void qemu_system_suspend_request(void);
51 void qemu_register_suspend_notifier(Notifier *notifier);
52 void qemu_system_wakeup_request(WakeupReason reason);
53 void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
54 void qemu_register_wakeup_notifier(Notifier *notifier);
55 void qemu_system_shutdown_request(void);
56 void qemu_system_powerdown_request(void);
57 void qemu_register_powerdown_notifier(Notifier *notifier);
58 void qemu_system_debug_request(void);
59 void qemu_system_vmstop_request(RunState reason);
60 int qemu_shutdown_requested_get(void);
61 int qemu_reset_requested_get(void);
62 void qemu_system_killed(int signal, pid_t pid);
63 void qemu_devices_reset(void);
64 void qemu_system_reset(bool report);
65
66 void qemu_add_exit_notifier(Notifier *notify);
67 void qemu_remove_exit_notifier(Notifier *notify);
68
69 void qemu_add_machine_init_done_notifier(Notifier *notify);
70
71 void do_savevm(Monitor *mon, const QDict *qdict);
72 int load_vmstate(const char *name);
73 void do_delvm(Monitor *mon, const QDict *qdict);
74 void do_info_snapshots(Monitor *mon, const QDict *qdict);
75
76 void qemu_announce_self(void);
77
78 bool qemu_savevm_state_blocked(Error **errp);
79 void qemu_savevm_state_begin(QEMUFile *f,
80 const MigrationParams *params);
81 int qemu_savevm_state_iterate(QEMUFile *f);
82 void qemu_savevm_state_complete(QEMUFile *f);
83 void qemu_savevm_state_cancel(void);
84 uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size);
85 int qemu_loadvm_state(QEMUFile *f);
86
87 /* SLIRP */
88 void do_info_slirp(Monitor *mon);
89
90 typedef enum DisplayType
91 {
92 DT_DEFAULT,
93 DT_CURSES,
94 DT_SDL,
95 DT_GTK,
96 DT_NOGRAPHIC,
97 DT_NONE,
98 } DisplayType;
99
100 extern int autostart;
101
102 typedef enum {
103 VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
104 } VGAInterfaceType;
105
106 extern int vga_interface_type;
107 #define xenfb_enabled (vga_interface_type == VGA_XENFB)
108
109 extern int graphic_width;
110 extern int graphic_height;
111 extern int graphic_depth;
112 extern DisplayType display_type;
113 extern const char *keyboard_layout;
114 extern int win2k_install_hack;
115 extern int alt_grab;
116 extern int ctrl_grab;
117 extern int smp_cpus;
118 extern int max_cpus;
119 extern int cursor_hide;
120 extern int graphic_rotate;
121 extern int no_quit;
122 extern int no_shutdown;
123 extern int semihosting_enabled;
124 extern int old_param;
125 extern int boot_menu;
126 extern uint8_t *boot_splash_filedata;
127 extern size_t boot_splash_filedata_size;
128 extern uint8_t qemu_extra_params_fw[2];
129 extern QEMUClockType rtc_clock;
130
131 #define MAX_NODES 64
132 #define MAX_CPUMASK_BITS 255
133 extern int nb_numa_nodes;
134 extern uint64_t node_mem[MAX_NODES];
135 extern unsigned long *node_cpumask[MAX_NODES];
136
137 #define MAX_OPTION_ROMS 16
138 typedef struct QEMUOptionRom {
139 const char *name;
140 int32_t bootindex;
141 } QEMUOptionRom;
142 extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
143 extern int nb_option_roms;
144
145 #define MAX_PROM_ENVS 128
146 extern const char *prom_envs[MAX_PROM_ENVS];
147 extern unsigned int nb_prom_envs;
148
149 /* pci-hotplug */
150 void pci_device_hot_add(Monitor *mon, const QDict *qdict);
151 int pci_drive_hot_add(Monitor *mon, const QDict *qdict, DriveInfo *dinfo);
152 void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
153
154 /* generic hotplug */
155 void drive_hot_add(Monitor *mon, const QDict *qdict);
156
157 /* CPU hotplug */
158 void qemu_register_cpu_added_notifier(Notifier *notifier);
159
160 /* pcie aer error injection */
161 void pcie_aer_inject_error_print(Monitor *mon, const QObject *data);
162 int do_pcie_aer_inject_error(Monitor *mon,
163 const QDict *qdict, QObject **ret_data);
164
165 /* serial ports */
166
167 #define MAX_SERIAL_PORTS 4
168
169 extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
170
171 /* parallel ports */
172
173 #define MAX_PARALLEL_PORTS 3
174
175 extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
176
177 void do_usb_add(Monitor *mon, const QDict *qdict);
178 void do_usb_del(Monitor *mon, const QDict *qdict);
179 void usb_info(Monitor *mon, const QDict *qdict);
180
181 void rtc_change_mon_event(struct tm *tm);
182
183 void add_boot_device_path(int32_t bootindex, DeviceState *dev,
184 const char *suffix);
185 char *get_boot_devices_list(size_t *size);
186
187 DeviceState *get_boot_device(uint32_t position);
188
189 QemuOpts *qemu_get_machine_opts(void);
190
191 bool usb_enabled(bool default_usb);
192
193 extern QemuOptsList qemu_drive_opts;
194 extern QemuOptsList qemu_chardev_opts;
195 extern QemuOptsList qemu_device_opts;
196 extern QemuOptsList qemu_netdev_opts;
197 extern QemuOptsList qemu_net_opts;
198 extern QemuOptsList qemu_global_opts;
199 extern QemuOptsList qemu_mon_opts;
200
201 #endif