]> git.proxmox.com Git - qemu.git/blame_incremental - sysemu.h
RunState: Rename enum values as generated by the QAPI
[qemu.git] / sysemu.h
... / ...
CommitLineData
1#ifndef SYSEMU_H
2#define SYSEMU_H
3/* Misc. things related to the system emulator. */
4
5#include "qemu-common.h"
6#include "qemu-option.h"
7#include "qemu-queue.h"
8#include "qemu-timer.h"
9#include "notify.h"
10
11/* vl.c */
12
13typedef enum {
14 RUN_STATE_DEBUG, /* qemu is running under gdb */
15 RUN_STATE_INMIGRATE, /* paused waiting for an incoming migration */
16 RUN_STATE_INTERNAL_ERROR, /* paused due to an internal error */
17 RUN_STATE_IO_ERROR, /* paused due to an I/O error */
18 RUN_STATE_PAUSED, /* paused by the user (ie. the 'stop' command) */
19 RUN_STATE_POSTMIGRATE, /* paused following a successful migration */
20 RUN_STATE_PRELAUNCH, /* qemu was started with -S and haven't started */
21 RUN_STATE_FINISH_MIGRATE, /* paused preparing to finish migrate */
22 RUN_STATE_RESTORE_VM, /* paused restoring the VM state */
23 RUN_STATE_RUNNING, /* qemu is running */
24 RUN_STATE_SAVE_VM, /* paused saving VM state */
25 RUN_STATE_SHUTDOWN, /* guest shut down and -no-shutdown is in use */
26 RUN_STATE_WATCHDOG, /* watchdog fired and qemu is configured to pause */
27 RUN_STATE_MAX
28} RunState;
29
30extern const char *bios_name;
31
32extern const char *qemu_name;
33extern uint8_t qemu_uuid[];
34int qemu_uuid_parse(const char *str, uint8_t *uuid);
35#define UUID_FMT "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"
36
37void runstate_init(void);
38bool runstate_check(RunState state);
39void runstate_set(RunState new_state);
40int runstate_is_running(void);
41const char *runstate_as_string(void);
42typedef struct vm_change_state_entry VMChangeStateEntry;
43typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
44
45VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
46 void *opaque);
47void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
48void vm_state_notify(int running, RunState state);
49
50#define VMRESET_SILENT false
51#define VMRESET_REPORT true
52
53void vm_start(void);
54void vm_stop(RunState state);
55
56void qemu_system_reset_request(void);
57void qemu_system_shutdown_request(void);
58void qemu_system_powerdown_request(void);
59void qemu_system_debug_request(void);
60void qemu_system_vmstop_request(RunState reason);
61int qemu_shutdown_requested_get(void);
62int qemu_reset_requested_get(void);
63int qemu_shutdown_requested(void);
64int qemu_reset_requested(void);
65int qemu_powerdown_requested(void);
66void qemu_system_killed(int signal, pid_t pid);
67void qemu_kill_report(void);
68extern qemu_irq qemu_system_powerdown;
69void qemu_system_reset(bool report);
70
71void qemu_add_exit_notifier(Notifier *notify);
72void qemu_remove_exit_notifier(Notifier *notify);
73
74void qemu_add_machine_init_done_notifier(Notifier *notify);
75
76void do_savevm(Monitor *mon, const QDict *qdict);
77int load_vmstate(const char *name);
78void do_delvm(Monitor *mon, const QDict *qdict);
79void do_info_snapshots(Monitor *mon);
80
81void qemu_announce_self(void);
82
83int main_loop_wait(int nonblocking);
84
85bool qemu_savevm_state_blocked(Monitor *mon);
86int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable,
87 int shared);
88int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f);
89int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f);
90void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f);
91int qemu_loadvm_state(QEMUFile *f);
92
93/* SLIRP */
94void do_info_slirp(Monitor *mon);
95
96typedef enum DisplayType
97{
98 DT_DEFAULT,
99 DT_CURSES,
100 DT_SDL,
101 DT_NOGRAPHIC,
102 DT_NONE,
103} DisplayType;
104
105extern int autostart;
106extern int bios_size;
107
108typedef enum {
109 VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
110} VGAInterfaceType;
111
112extern int vga_interface_type;
113#define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS)
114#define std_vga_enabled (vga_interface_type == VGA_STD)
115#define xenfb_enabled (vga_interface_type == VGA_XENFB)
116#define vmsvga_enabled (vga_interface_type == VGA_VMWARE)
117#define qxl_enabled (vga_interface_type == VGA_QXL)
118
119extern int graphic_width;
120extern int graphic_height;
121extern int graphic_depth;
122extern uint8_t irq0override;
123extern DisplayType display_type;
124extern const char *keyboard_layout;
125extern int win2k_install_hack;
126extern int rtc_td_hack;
127extern int alt_grab;
128extern int ctrl_grab;
129extern int usb_enabled;
130extern int smp_cpus;
131extern int max_cpus;
132extern int cursor_hide;
133extern int graphic_rotate;
134extern int no_quit;
135extern int no_shutdown;
136extern int semihosting_enabled;
137extern int old_param;
138extern int boot_menu;
139extern uint8_t *boot_splash_filedata;
140extern int boot_splash_filedata_size;
141extern uint8_t qemu_extra_params_fw[2];
142extern QEMUClock *rtc_clock;
143
144#define MAX_NODES 64
145extern int nb_numa_nodes;
146extern uint64_t node_mem[MAX_NODES];
147extern uint64_t node_cpumask[MAX_NODES];
148
149#define MAX_OPTION_ROMS 16
150typedef struct QEMUOptionRom {
151 const char *name;
152 int32_t bootindex;
153} QEMUOptionRom;
154extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
155extern int nb_option_roms;
156
157#define MAX_PROM_ENVS 128
158extern const char *prom_envs[MAX_PROM_ENVS];
159extern unsigned int nb_prom_envs;
160
161/* pci-hotplug */
162void pci_device_hot_add(Monitor *mon, const QDict *qdict);
163void drive_hot_add(Monitor *mon, const QDict *qdict);
164void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict);
165
166/* pcie aer error injection */
167void pcie_aer_inject_error_print(Monitor *mon, const QObject *data);
168int do_pcie_aer_inejct_error(Monitor *mon,
169 const QDict *qdict, QObject **ret_data);
170
171/* serial ports */
172
173#define MAX_SERIAL_PORTS 4
174
175extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
176
177/* parallel ports */
178
179#define MAX_PARALLEL_PORTS 3
180
181extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
182
183void do_usb_add(Monitor *mon, const QDict *qdict);
184void do_usb_del(Monitor *mon, const QDict *qdict);
185void usb_info(Monitor *mon);
186
187void rtc_change_mon_event(struct tm *tm);
188
189void register_devices(void);
190
191void add_boot_device_path(int32_t bootindex, DeviceState *dev,
192 const char *suffix);
193char *get_boot_devices_list(uint32_t *size);
194#endif