Xen 2016/06/13

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXXpCeAAoJEIlPj0hw4a6QjjMP/35CEMQRma1kQ2RUk7sEcJLR
 jh0YKhUWBkKcDPj6HRJhMHudHTLTaNGi6z1Ejje0KzX3jLvnZzaPTLiAvEQxQLAg
 pXlTn53kOQE2dKamOF8PHmYJ/dsuPId29tk7qWeezhr6QLDnDnqhhjMl5OdIC2/g
 GKQm/OQ/YEcHWzX7mfwXQlW/HxZNVp8yEhjKFq54+bmGcHUwE//5tZaa8Xrns+di
 cCKD9o2elBdqBt9oh4DLINHJFbaOK5UJvT0H/nrWaFKsZh6bH/LX+xhxTKJHBEmS
 xzzQB6QiCTCxxevgtYhITG7A+pDTcGqhMvs+UC/sbwsn+k17R8CWCtXY05ZqZ8H3
 UfJ44TtlfJtOIJq1euItVsehGWfTjlYd7kRuiCV30khLT+hw8hsbWSooIDD2hWoH
 hKUiLWAh8alWM2yfsu9SVqoj6qgmeYYtsLPlnl7YZ1vVZ5iVsCQn01OJ/n366ksa
 cFnD/zWSyKP2RCiZM5UczAnOiXryHbgkG8XhcNxNHOj4hGuq09sDFOdvyzLVHH+3
 2PBlvgV/JBhFT2boO7leasQDr47vfZon/0OF8Xgcnf3HsUYeiOY2s+PtLbgeCcCP
 PNomVANoRFSkWTZVXn36Y1HZq2NZGSgyvlN0HHWatyOGJ/j7VA9BabxN0QnEvzA9
 9GI9vcoracrGtzezC2Hg
 =kHtD
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20160613-tag' into staging

Xen 2016/06/13

# gpg: Signature made Mon 13 Jun 2016 11:53:18 BST
# gpg:                using RSA key 0x894F8F4870E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
# Primary key fingerprint: D04E 33AB A51F 67BA 07D3  0AEA 894F 8F48 70E1 AE90

* remotes/sstabellini/tags/xen-20160613-tag:
  Introduce "xen-load-devices-state"
  exec: Fix qemu_ram_block_from_host for Xen

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2016-06-13 12:18:17 +01:00
commit 8fdf038722
4 changed files with 79 additions and 1 deletions

2
exec.c
View File

@ -1935,7 +1935,7 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
ram_addr = xen_ram_addr_from_mapcache(ptr); ram_addr = xen_ram_addr_from_mapcache(ptr);
block = qemu_get_ram_block(ram_addr); block = qemu_get_ram_block(ram_addr);
if (block) { if (block) {
*offset = (host - block->host); *offset = ram_addr - block->offset;
} }
rcu_read_unlock(); rcu_read_unlock();
return block; return block;

View File

@ -31,6 +31,7 @@
#include "hw/boards.h" #include "hw/boards.h"
#include "hw/hw.h" #include "hw/hw.h"
#include "hw/qdev.h" #include "hw/qdev.h"
#include "hw/xen/xen.h"
#include "net/net.h" #include "net/net.h"
#include "monitor/monitor.h" #include "monitor/monitor.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
@ -1754,6 +1755,12 @@ qemu_loadvm_section_start_full(QEMUFile *f, MigrationIncomingState *mis)
return -EINVAL; return -EINVAL;
} }
/* Validate if it is a device's state */
if (xen_enabled() && se->is_ram) {
error_report("loadvm: %s RAM loading not allowed on Xen", idstr);
return -EINVAL;
}
/* Add entry */ /* Add entry */
le = g_malloc0(sizeof(*le)); le = g_malloc0(sizeof(*le));
@ -2064,6 +2071,36 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
} }
} }
void qmp_xen_load_devices_state(const char *filename, Error **errp)
{
QEMUFile *f;
QIOChannelFile *ioc;
int ret;
/* Guest must be paused before loading the device state; the RAM state
* will already have been loaded by xc
*/
if (runstate_is_running()) {
error_setg(errp, "Cannot update device state while vm is running");
return;
}
vm_stop(RUN_STATE_RESTORE_VM);
ioc = qio_channel_file_new_path(filename, O_RDONLY | O_BINARY, 0, errp);
if (!ioc) {
return;
}
f = qemu_fopen_channel_input(QIO_CHANNEL(ioc));
migration_incoming_state_new(f);
ret = qemu_loadvm_state(f);
qemu_fclose(f);
if (ret < 0) {
error_setg(errp, QERR_IO_ERROR);
}
migration_incoming_state_destroy();
}
int load_vmstate(const char *name) int load_vmstate(const char *name)
{ {
BlockDriverState *bs, *bs_vm_state; BlockDriverState *bs, *bs_vm_state;

View File

@ -4200,6 +4200,20 @@
{ 'enum': 'ReplayMode', { 'enum': 'ReplayMode',
'data': [ 'none', 'record', 'play' ] } 'data': [ 'none', 'record', 'play' ] }
##
# @xen-load-devices-state:
#
# Load the state of all devices from file. The RAM and the block devices
# of the VM are not loaded by this command.
#
# @filename: the file to load the state of the devices from as binary
# data. See xen-save-devices-state.txt for a description of the binary
# format.
#
# Since: 2.7
##
{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
## ##
# @GICCapability: # @GICCapability:
# #

View File

@ -584,6 +584,33 @@ Example:
"arguments": { "filename": "/tmp/save" } } "arguments": { "filename": "/tmp/save" } }
<- { "return": {} } <- { "return": {} }
EQMP
{
.name = "xen-load-devices-state",
.args_type = "filename:F",
.mhandler.cmd_new = qmp_marshal_xen_load_devices_state,
},
SQMP
xen-load-devices-state
----------------------
Load the state of all devices from file. The RAM and the block devices
of the VM are not loaded by this command.
Arguments:
- "filename": the file to load the state of the devices from as binary
data. See xen-save-devices-state.txt for a description of the binary
format.
Example:
-> { "execute": "xen-load-devices-state",
"arguments": { "filename": "/tmp/resume" } }
<- { "return": {} }
EQMP EQMP
{ {