mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
vmstate: Add support for alias ID
Some legacy users (mostly PC devices) of vmstate_register manage instance IDs on their own, and that unfortunately in a way that is incompatible with automatically generated ones. This so far prevents switching those users to vmstates that are registered by qdev. To establish a migration path, this patch introduces the concept of alias IDs. They can be passed to an extended vmstate registration service, and qdev provides a set service to be used during device init. find_se will consider the alias in addition to the default ID. We can then start generating the default ID automatically and writing it on vmsave, thus converting that format without breaking support for upward migration. The user is required specify the highest vmstate version for which the alias is required. Once this version falls behind the minimum required for a specific vmstate, an assertion triggers to motivate cleaning up the obsolete alias. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
ec86f3e1af
commit
4d2ffa08b6
4 changed files with 39 additions and 5 deletions
|
@ -44,6 +44,8 @@ struct DeviceState {
|
|||
QLIST_HEAD(, BusState) child_bus;
|
||||
int num_child_bus;
|
||||
QLIST_ENTRY(DeviceState) sibling;
|
||||
int instance_id_alias;
|
||||
int alias_required_for_version;
|
||||
};
|
||||
|
||||
typedef void (*bus_dev_printfn)(Monitor *mon, DeviceState *dev, int indent);
|
||||
|
@ -112,6 +114,8 @@ int qdev_device_help(QemuOpts *opts);
|
|||
DeviceState *qdev_device_add(QemuOpts *opts);
|
||||
int qdev_init(DeviceState *dev) QEMU_WARN_UNUSED_RESULT;
|
||||
void qdev_init_nofail(DeviceState *dev);
|
||||
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
|
||||
int required_for_version);
|
||||
int qdev_unplug(DeviceState *dev);
|
||||
void qdev_free(DeviceState *dev);
|
||||
int qdev_simple_unplug_cb(DeviceState *dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue