]> git.proxmox.com Git - mirror_qemu.git/blame - include/sysemu/sysemu.h
Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2018-02-07-v4' into staging
[mirror_qemu.git] / include / sysemu / sysemu.h
CommitLineData
87ecb68b
PB
1#ifndef SYSEMU_H
2#define SYSEMU_H
3/* Misc. things related to the system emulator. */
4
1de7afc9
PB
5#include "qemu/queue.h"
6#include "qemu/timer.h"
1de7afc9
PB
7#include "qemu/notify.h"
8#include "qemu/main-loop.h"
8c85901e 9#include "qemu/bitmap.h"
9c5ce8db 10#include "qemu/uuid.h"
dfabb8b9 11#include "qom/object.h"
376253ec 12
87ecb68b 13/* vl.c */
1dfb4dd9 14
87ecb68b 15extern const char *bios_name;
87ecb68b 16extern const char *qemu_name;
9c5ce8db 17extern QemuUUID qemu_uuid;
fc3b3295 18extern bool qemu_uuid_set;
87ecb68b 19
f5bbfba1
LC
20bool runstate_check(RunState state);
21void runstate_set(RunState new_state);
1354869c 22int runstate_is_running(void);
ede085b3 23bool runstate_needs_reset(void);
5e0f1940 24bool runstate_store(char *str, size_t size);
87ecb68b 25typedef struct vm_change_state_entry VMChangeStateEntry;
1dfb4dd9 26typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
87ecb68b
PB
27
28VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
29 void *opaque);
30void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
1dfb4dd9 31void vm_state_notify(int running, RunState state);
e07bbac5 32
aedbe192
EB
33/* Enumeration of various causes for shutdown. */
34typedef enum ShutdownCause {
35 SHUTDOWN_CAUSE_NONE, /* No shutdown request pending */
36 SHUTDOWN_CAUSE_HOST_ERROR, /* An error prevents further use of guest */
37 SHUTDOWN_CAUSE_HOST_QMP, /* Reaction to a QMP command, like 'quit' */
38 SHUTDOWN_CAUSE_HOST_SIGNAL, /* Reaction to a signal, such as SIGINT */
39 SHUTDOWN_CAUSE_HOST_UI, /* Reaction to UI event, like window close */
40 SHUTDOWN_CAUSE_GUEST_SHUTDOWN,/* Guest shutdown/suspend request, via
41 ACPI or other hardware-specific means */
42 SHUTDOWN_CAUSE_GUEST_RESET, /* Guest reset request, and command line
43 turns that into a shutdown */
44 SHUTDOWN_CAUSE_GUEST_PANIC, /* Guest panicked, and command line turns
45 that into a shutdown */
46 SHUTDOWN_CAUSE__MAX,
47} ShutdownCause;
e063eb1f 48
08fba7ac
EB
49static inline bool shutdown_caused_by_guest(ShutdownCause cause)
50{
51 return cause >= SHUTDOWN_CAUSE_GUEST_SHUTDOWN;
52}
e063eb1f 53
87ecb68b 54void vm_start(void);
2d76e823 55int vm_prepare_start(void);
56983463
KW
56int vm_stop(RunState state);
57int vm_stop_force_state(RunState state);
87ecb68b 58
95b363b5 59typedef enum WakeupReason {
4bc78a87
LJ
60 /* Always keep QEMU_WAKEUP_REASON_NONE = 0 */
61 QEMU_WAKEUP_REASON_NONE = 0,
62aeb0f7 62 QEMU_WAKEUP_REASON_RTC,
6595abc0 63 QEMU_WAKEUP_REASON_PMTIMER,
4bc78a87 64 QEMU_WAKEUP_REASON_OTHER,
95b363b5
GH
65} WakeupReason;
66
cf83f140 67void qemu_system_reset_request(ShutdownCause reason);
95b363b5
GH
68void qemu_system_suspend_request(void);
69void qemu_register_suspend_notifier(Notifier *notifier);
70void qemu_system_wakeup_request(WakeupReason reason);
71void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
72void qemu_register_wakeup_notifier(Notifier *notifier);
cf83f140 73void qemu_system_shutdown_request(ShutdownCause reason);
87ecb68b 74void qemu_system_powerdown_request(void);
a9552c8e 75void qemu_register_powerdown_notifier(Notifier *notifier);
8cf71710 76void qemu_system_debug_request(void);
1dfb4dd9 77void qemu_system_vmstop_request(RunState reason);
74892d24 78void qemu_system_vmstop_request_prepare(void);
2d76e823 79bool qemu_vmstop_requested(RunState *r);
aedbe192
EB
80ShutdownCause qemu_shutdown_requested_get(void);
81ShutdownCause qemu_reset_requested_get(void);
f64622c4 82void qemu_system_killed(int signal, pid_t pid);
aedbe192 83void qemu_system_reset(ShutdownCause reason);
c86f106b 84void qemu_system_guest_panicked(GuestPanicInformation *info);
87ecb68b 85
fd42deeb
GH
86void qemu_add_exit_notifier(Notifier *notify);
87void qemu_remove_exit_notifier(Notifier *notify);
88
4cab946a 89void qemu_add_machine_init_done_notifier(Notifier *notify);
b86eacb8 90void qemu_remove_machine_init_done_notifier(Notifier *notify);
4cab946a 91
210f41ba
AL
92void qemu_announce_self(void);
93
d399f677 94extern int autostart;
86176759
ZA
95
96typedef enum {
a19cbfb3 97 VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
a94f0c5c 98 VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO,
8c9a2b71 99 VGA_TYPE_MAX,
86176759
ZA
100} VGAInterfaceType;
101
102extern int vga_interface_type;
86176759 103#define xenfb_enabled (vga_interface_type == VGA_XENFB)
86176759 104
87ecb68b
PB
105extern int graphic_width;
106extern int graphic_height;
107extern int graphic_depth;
da076ffe 108extern int display_opengl;
87ecb68b
PB
109extern const char *keyboard_layout;
110extern int win2k_install_hack;
111extern int alt_grab;
0ca9f8a4 112extern int ctrl_grab;
04ff1a39 113extern int no_frame;
87ecb68b 114extern int smp_cpus;
c0dd1099 115extern unsigned int max_cpus;
87ecb68b
PB
116extern int cursor_hide;
117extern int graphic_rotate;
118extern int no_quit;
a691d41a 119extern int no_shutdown;
87ecb68b 120extern int old_param;
95387491 121extern int boot_menu;
bc74112f 122extern bool boot_strict;
3d3b8303 123extern uint8_t *boot_splash_filedata;
d09acb9b 124extern size_t boot_splash_filedata_size;
58b7c17e 125extern bool enable_mlock;
3d3b8303 126extern uint8_t qemu_extra_params_fw[2];
884f17c2 127extern QEMUClockType rtc_clock;
e1c57ab8
PB
128extern const char *mem_path;
129extern int mem_prealloc;
87ecb68b 130
45e30bf3 131#define MAX_NODES 128
6a3042b2 132#define NUMA_NODE_UNASSIGNED MAX_NODES
0f203430
HC
133#define NUMA_DISTANCE_MIN 10
134#define NUMA_DISTANCE_DEFAULT 20
135#define NUMA_DISTANCE_MAX 254
136#define NUMA_DISTANCE_UNREACHABLE 255
d2995916 137
87ecb68b 138#define MAX_OPTION_ROMS 16
2e55e842
GN
139typedef struct QEMUOptionRom {
140 const char *name;
141 int32_t bootindex;
142} QEMUOptionRom;
143extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
87ecb68b
PB
144extern int nb_option_roms;
145
87ecb68b
PB
146#define MAX_PROM_ENVS 128
147extern const char *prom_envs[MAX_PROM_ENVS];
148extern unsigned int nb_prom_envs;
87ecb68b 149
dd97aa8a 150/* generic hotplug */
3e5a50d6 151void hmp_drive_add(Monitor *mon, const QDict *qdict);
dd97aa8a 152
2ae63bda 153/* pcie aer error injection */
04e00c92 154void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
2ae63bda 155
87ecb68b
PB
156/* serial ports */
157
158#define MAX_SERIAL_PORTS 4
159
0ec7b3e7 160extern Chardev *serial_hds[MAX_SERIAL_PORTS];
87ecb68b
PB
161
162/* parallel ports */
163
164#define MAX_PARALLEL_PORTS 3
165
0ec7b3e7 166extern Chardev *parallel_hds[MAX_PARALLEL_PORTS];
87ecb68b 167
1ce6be24 168void hmp_info_usb(Monitor *mon, const QDict *qdict);
87ecb68b 169
1ca4d09a
GN
170void add_boot_device_path(int32_t bootindex, DeviceState *dev,
171 const char *suffix);
30e32af7 172char *get_boot_devices_list(size_t *size, bool ignore_suffixes);
094b287f 173
7dc5af55 174DeviceState *get_boot_device(uint32_t position);
694fb857 175void check_boot_index(int32_t bootindex, Error **errp);
9d27572d 176void del_boot_device_path(DeviceState *dev, const char *suffix);
12da3097
GA
177void device_add_bootindex_property(Object *obj, int32_t *bootindex,
178 const char *name, const char *suffix,
179 DeviceState *dev, Error **errp);
9816833d 180void restore_boot_order(void *opaque);
703008e8 181void validate_bootdevices(const char *devices, Error **errp);
9816833d 182
3b53e45f 183/* handler to set the boot_device order for a specific type of MachineClass */
ddcd5531
GA
184typedef void QEMUBootSetHandler(void *opaque, const char *boot_order,
185 Error **errp);
9816833d 186void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
f1839938 187void qemu_boot_set(const char *boot_order, Error **errp);
7dc5af55 188
7f9d6e54
MA
189QemuOpts *qemu_get_machine_opts(void);
190
f8b6f8ed 191bool defaults_enabled(void);
094b287f 192
968854c8
AK
193extern QemuOptsList qemu_legacy_drive_opts;
194extern QemuOptsList qemu_common_drive_opts;
4d454574 195extern QemuOptsList qemu_drive_opts;
c5f3014b 196extern QemuOptsList bdrv_runtime_opts;
4d454574
PB
197extern QemuOptsList qemu_chardev_opts;
198extern QemuOptsList qemu_device_opts;
199extern QemuOptsList qemu_netdev_opts;
200extern QemuOptsList qemu_net_opts;
201extern QemuOptsList qemu_global_opts;
202extern QemuOptsList qemu_mon_opts;
203
87ecb68b 204#endif