2007-11-17 20:14:51 +03:00
|
|
|
#ifndef SYSEMU_H
|
|
|
|
#define SYSEMU_H
|
|
|
|
/* Misc. things related to the system emulator. */
|
|
|
|
|
2012-12-17 21:20:00 +04:00
|
|
|
#include "qemu/timer.h"
|
|
|
|
#include "qemu/notify.h"
|
2016-09-21 07:27:22 +03:00
|
|
|
#include "qemu/uuid.h"
|
2009-03-06 02:01:23 +03:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
/* vl.c */
|
2011-07-29 21:26:33 +04:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
extern const char *bios_name;
|
Revert "migration: move only_migratable to MigrationState"
This reverts commit 3df663e575f1876d7f3bc684f80e72fca0703d39.
This reverts commit b605c47b57b58e61a901a50a0762dccf43d94783.
Command line option --only-migratable is for disallowing any
configuration that can block migration.
Initially, --only-migratable set global variable @only_migratable.
Commit 3df663e575 "migration: move only_migratable to MigrationState"
replaced it by MigrationState member @only_migratable. That was a
mistake.
First, it doesn't make sense on the design level. MigrationState
captures the state of an individual migration, but --only-migratable
isn't a property of an individual migration, it's a restriction on
QEMU configuration. With fault tolerance, we could have several
migrations at once. --only-migratable would certainly protect all of
them. Storing it in MigrationState feels inappropriate.
Second, it contributes to a dependency cycle that manifests itself as
a bug now.
Putting @only_migratable into MigrationState means its available only
after migration_object_init().
We can't set it before migration_object_init(), so we delay setting it
with a global property (this is fixup commit b605c47b57 "migration:
fix handling for --only-migratable").
We can't get it before migration_object_init(), so anything that uses
it can only run afterwards.
Since migrate_add_blocker() needs to obey --only-migratable, any code
adding migration blockers can run only afterwards. This contributes
to the following dependency cycle:
* configure_blockdev() must run before machine_set_property()
so machine properties can refer to block backends
* machine_set_property() before configure_accelerator()
so machine properties like kvm-irqchip get applied
* configure_accelerator() before migration_object_init()
so that Xen's accelerator compat properties get applied.
* migration_object_init() before configure_blockdev()
so configure_blockdev() can add migration blockers
The cycle was closed when recent commit cda4aa9a5a0 "Create block
backends before setting machine properties" added the first
dependency, and satisfied it by violating the last one. Broke block
backends that add migration blockers.
Moving @only_migratable into MigrationState was a mistake. Revert it.
This doesn't quite break the "migration_object_init() before
configure_blockdev() dependency, since migrate_add_blocker() still has
another dependency on migration_object_init(). To be addressed the
next commit.
Note that the reverted commit made -only-migratable sugar for -global
migration.only-migratable=on below the hood. Documentation has only
ever mentioned -only-migratable. This commit removes the arcane &
undocumented alternative to -only-migratable again. Nobody should be
using it.
Conflicts:
include/migration/misc.h
migration/migration.c
migration/migration.h
vl.c
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190401090827.20793-3-armbru@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2019-04-01 12:08:24 +03:00
|
|
|
extern int only_migratable;
|
2007-11-17 20:14:51 +03:00
|
|
|
extern const char *qemu_name;
|
2016-09-21 07:27:22 +03:00
|
|
|
extern QemuUUID qemu_uuid;
|
smbios: Make multiple -smbios type= accumulate sanely
Currently, -smbios type=T,NAME=VAL,... adds one field (T,NAME) with
value VAL to fw_cfg for each unique NAME. If NAME occurs multiple
times, the last one's VAL is used (before the QemuOpts conversion, the
first one was used).
Multiple -smbios can add multiple fields with the same (T, NAME).
SeaBIOS reads all of them from fw_cfg, but uses only the first field
(T, NAME). The others are ignored.
"First one wins, subsequent ones get ignored silently" isn't nice. We
commonly let the last option win. Useful, because it lets you
-readconfig first, then selectively override with command line
options.
Clean up -smbios to work the common way. Accumulate the settings,
with later ones overwriting earlier ones. Put the result into fw_cfg
(no more useless duplicates).
Bonus cleanup: qemu_uuid_parse() no longer sets SMBIOS system uuid by
side effect.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-16 17:18:31 +04:00
|
|
|
extern bool qemu_uuid_set;
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2020-05-12 06:01:30 +03:00
|
|
|
void qemu_add_data_dir(const char *path);
|
|
|
|
|
2010-06-04 16:08:07 +04:00
|
|
|
void qemu_add_exit_notifier(Notifier *notify);
|
|
|
|
void qemu_remove_exit_notifier(Notifier *notify);
|
|
|
|
|
2018-03-06 08:33:12 +03:00
|
|
|
extern bool machine_init_done;
|
|
|
|
|
2010-12-08 14:35:08 +03:00
|
|
|
void qemu_add_machine_init_done_notifier(Notifier *notify);
|
2016-06-27 18:38:32 +03:00
|
|
|
void qemu_remove_machine_init_done_notifier(Notifier *notify);
|
2010-12-08 14:35:08 +03:00
|
|
|
|
2009-07-28 01:17:51 +04:00
|
|
|
extern int autostart;
|
2009-07-30 14:15:02 +04:00
|
|
|
|
|
|
|
typedef enum {
|
2010-04-27 13:50:11 +04:00
|
|
|
VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
|
2014-09-10 16:28:48 +04:00
|
|
|
VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO,
|
2015-10-29 00:19:58 +03:00
|
|
|
VGA_TYPE_MAX,
|
2009-07-30 14:15:02 +04:00
|
|
|
} VGAInterfaceType;
|
|
|
|
|
|
|
|
extern int vga_interface_type;
|
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
extern int graphic_width;
|
|
|
|
extern int graphic_height;
|
|
|
|
extern int graphic_depth;
|
2014-11-20 11:49:44 +03:00
|
|
|
extern int display_opengl;
|
2007-11-17 20:14:51 +03:00
|
|
|
extern const char *keyboard_layout;
|
|
|
|
extern int win2k_install_hack;
|
|
|
|
extern int alt_grab;
|
2009-09-18 00:48:04 +04:00
|
|
|
extern int ctrl_grab;
|
2007-11-17 20:14:51 +03:00
|
|
|
extern int graphic_rotate;
|
2010-05-12 01:07:04 +04:00
|
|
|
extern int no_shutdown;
|
2007-11-17 20:14:51 +03:00
|
|
|
extern int old_param;
|
2009-07-02 02:19:02 +04:00
|
|
|
extern int boot_menu;
|
2014-10-07 12:00:05 +04:00
|
|
|
extern bool boot_strict;
|
2011-07-27 14:04:55 +04:00
|
|
|
extern uint8_t *boot_splash_filedata;
|
2015-11-05 21:11:22 +03:00
|
|
|
extern bool enable_mlock;
|
2018-06-22 22:22:05 +03:00
|
|
|
extern bool enable_cpu_pm;
|
2013-08-21 19:03:04 +04:00
|
|
|
extern QEMUClockType rtc_clock;
|
2007-11-17 20:14:51 +03:00
|
|
|
|
|
|
|
#define MAX_OPTION_ROMS 16
|
2010-12-08 14:35:07 +03:00
|
|
|
typedef struct QEMUOptionRom {
|
|
|
|
const char *name;
|
|
|
|
int32_t bootindex;
|
|
|
|
} QEMUOptionRom;
|
|
|
|
extern QEMUOptionRom option_rom[MAX_OPTION_ROMS];
|
2007-11-17 20:14:51 +03:00
|
|
|
extern int nb_option_roms;
|
|
|
|
|
|
|
|
#define MAX_PROM_ENVS 128
|
|
|
|
extern const char *prom_envs[MAX_PROM_ENVS];
|
|
|
|
extern unsigned int nb_prom_envs;
|
|
|
|
|
2010-12-24 06:14:14 +03:00
|
|
|
/* pcie aer error injection */
|
2015-03-05 19:48:49 +03:00
|
|
|
void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict);
|
2010-12-24 06:14:14 +03:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
/* serial ports */
|
|
|
|
|
2018-04-20 17:52:42 +03:00
|
|
|
/* Return the Chardev for serial port i, or NULL if none */
|
|
|
|
Chardev *serial_hd(int i);
|
2018-04-20 17:52:49 +03:00
|
|
|
/* return the number of serial ports defined by the user. serial_hd(i)
|
|
|
|
* will always return NULL for any i which is greater than or equal to this.
|
|
|
|
*/
|
|
|
|
int serial_max_hds(void);
|
2018-04-20 17:52:42 +03:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
/* parallel ports */
|
|
|
|
|
|
|
|
#define MAX_PARALLEL_PORTS 3
|
|
|
|
|
2016-12-07 16:20:22 +03:00
|
|
|
extern Chardev *parallel_hds[MAX_PARALLEL_PORTS];
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2015-02-06 16:18:24 +03:00
|
|
|
void hmp_info_usb(Monitor *mon, const QDict *qdict);
|
2007-11-17 20:14:51 +03:00
|
|
|
|
2010-12-08 14:35:05 +03:00
|
|
|
void add_boot_device_path(int32_t bootindex, DeviceState *dev,
|
|
|
|
const char *suffix);
|
2018-08-10 15:40:27 +03:00
|
|
|
char *get_boot_devices_list(size_t *size);
|
2012-09-02 23:25:28 +04:00
|
|
|
|
2013-04-26 06:12:49 +04:00
|
|
|
DeviceState *get_boot_device(uint32_t position);
|
2014-10-07 12:00:06 +04:00
|
|
|
void check_boot_index(int32_t bootindex, Error **errp);
|
2014-10-07 12:00:07 +04:00
|
|
|
void del_boot_device_path(DeviceState *dev, const char *suffix);
|
2014-10-07 12:00:11 +04:00
|
|
|
void device_add_bootindex_property(Object *obj, int32_t *bootindex,
|
|
|
|
const char *name, const char *suffix,
|
2020-05-05 18:29:23 +03:00
|
|
|
DeviceState *dev);
|
2014-12-03 19:49:46 +03:00
|
|
|
void restore_boot_order(void *opaque);
|
2014-12-03 20:11:39 +03:00
|
|
|
void validate_bootdevices(const char *devices, Error **errp);
|
2019-10-16 19:41:40 +03:00
|
|
|
void add_boot_device_lchs(DeviceState *dev, const char *suffix,
|
|
|
|
uint32_t lcyls, uint32_t lheads, uint32_t lsecs);
|
|
|
|
void del_boot_device_lchs(DeviceState *dev, const char *suffix);
|
2019-10-16 19:41:44 +03:00
|
|
|
char *get_boot_devices_lchs_list(size_t *size);
|
2014-12-03 19:49:46 +03:00
|
|
|
|
2015-09-04 21:37:09 +03:00
|
|
|
/* handler to set the boot_device order for a specific type of MachineClass */
|
2014-12-03 22:04:02 +03:00
|
|
|
typedef void QEMUBootSetHandler(void *opaque, const char *boot_order,
|
|
|
|
Error **errp);
|
2014-12-03 19:49:46 +03:00
|
|
|
void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque);
|
2014-12-03 21:20:58 +03:00
|
|
|
void qemu_boot_set(const char *boot_order, Error **errp);
|
2013-04-26 06:12:49 +04:00
|
|
|
|
2013-07-04 17:09:19 +04:00
|
|
|
QemuOpts *qemu_get_machine_opts(void);
|
|
|
|
|
2015-01-06 16:29:12 +03:00
|
|
|
bool defaults_enabled(void);
|
2012-09-02 23:25:28 +04:00
|
|
|
|
2020-02-20 07:10:58 +03:00
|
|
|
void qemu_init(int argc, char **argv, char **envp);
|
|
|
|
void qemu_main_loop(void);
|
|
|
|
void qemu_cleanup(void);
|
|
|
|
|
2013-11-09 08:15:47 +04:00
|
|
|
extern QemuOptsList qemu_legacy_drive_opts;
|
|
|
|
extern QemuOptsList qemu_common_drive_opts;
|
2012-11-26 19:03:42 +04:00
|
|
|
extern QemuOptsList qemu_drive_opts;
|
2016-10-06 12:33:17 +03:00
|
|
|
extern QemuOptsList bdrv_runtime_opts;
|
2012-11-26 19:03:42 +04:00
|
|
|
extern QemuOptsList qemu_chardev_opts;
|
|
|
|
extern QemuOptsList qemu_device_opts;
|
|
|
|
extern QemuOptsList qemu_netdev_opts;
|
2018-02-21 13:18:36 +03:00
|
|
|
extern QemuOptsList qemu_nic_opts;
|
2012-11-26 19:03:42 +04:00
|
|
|
extern QemuOptsList qemu_net_opts;
|
|
|
|
extern QemuOptsList qemu_global_opts;
|
2019-05-13 16:43:57 +03:00
|
|
|
extern QemuOptsList qemu_semihosting_config_opts;
|
2012-11-26 19:03:42 +04:00
|
|
|
|
2007-11-17 20:14:51 +03:00
|
|
|
#endif
|