aboutsummaryrefslogtreecommitdiff
path: root/xen-all.c
diff options
context:
space:
mode:
authorAnthony PERARD <anthony.perard@citrix.com>2012-01-18 12:21:38 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-03-19 18:21:12 +0000
commitcd1ba7de230b3a85fb4dba53bb681b7ea626b4eb (patch)
tree34322fda4fe9cf32e9e6db52485b2c69ee2e99b2 /xen-all.c
parentd1814e08c0409d9f352f9ea7fab377bcee1286b8 (diff)
downloadqemu-cd1ba7de230b3a85fb4dba53bb681b7ea626b4eb.zip
qemu-cd1ba7de230b3a85fb4dba53bb681b7ea626b4eb.tar.gz
qemu-cd1ba7de230b3a85fb4dba53bb681b7ea626b4eb.tar.bz2
xen mapcache: check if memory region has moved.
This patch changes the xen_map_cache behavior. Before trying to map a guest addr, mapcache will look into the list of range of address that have been moved (physmap/set_memory). There is currently one memory space like this, the vram, "moved" from were it's allocated to were the guest will look into. This help to have a succefull migration. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'xen-all.c')
-rw-r--r--xen-all.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/xen-all.c b/xen-all.c
index f2cad82..972cffd 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -225,6 +225,22 @@ static XenPhysmap *get_physmapping(XenIOState *state,
return NULL;
}
+static target_phys_addr_t xen_phys_offset_to_gaddr(target_phys_addr_t start_addr,
+ ram_addr_t size, void *opaque)
+{
+ target_phys_addr_t addr = start_addr & TARGET_PAGE_MASK;
+ XenIOState *xen_io_state = opaque;
+ XenPhysmap *physmap = NULL;
+
+ QLIST_FOREACH(physmap, &xen_io_state->physmap, list) {
+ if (range_covers_byte(physmap->phys_offset, physmap->size, addr)) {
+ return physmap->start_addr;
+ }
+ }
+
+ return start_addr;
+}
+
#if CONFIG_XEN_CTRL_INTERFACE_VERSION >= 340
static int xen_add_to_physmap(XenIOState *state,
target_phys_addr_t start_addr,
@@ -1043,7 +1059,7 @@ int xen_hvm_init(void)
}
/* Init RAM management */
- xen_map_cache_init();
+ xen_map_cache_init(xen_phys_offset_to_gaddr, state);
xen_ram_init(ram_size);
qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);