aboutsummaryrefslogtreecommitdiff
path: root/xen-all.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-10-11 05:27:15 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2012-10-11 05:27:15 -0300
commit4d9367b76f71c6d938cf8201392abe4bfb1136cb (patch)
tree93a31afc3151c19e4906aed6748e842d8431fb02 /xen-all.c
parent6b414d9fb86527118f3ddb81a1d1a684b3548a9d (diff)
parent8e65440d5f64435c003d32088757f702b86af9b4 (diff)
Merge branch 'upstream-merge'HEADnextmaster
* upstream-merge: (575 commits) ssi: Add slave autoconnect helper MAINTAINERS: Added maintainerships for SSI xilinx_zynq: Added SPI controllers + flashes xilinx_spips: Xilinx Zynq SPI cntrlr device model petalogix-ml605: added SPI controller with n25q128 xilinx_spi: Initial impl. of Xilinx SPI controller m25p80: Initial implementation of SPI flash device hw: Added generic FIFO API. stellaris: Removed SSI mux qdev: allow multiple qdev_init_gpio_in() calls ssi: Added create_slave_no_init() ssi: Implemented CS behaviour ssi: Support for multiple attached devices qemu-barrier: Fix compilation on i386 hosts target-sparc: Optimize conditionals using SUBCC target-sparc: Fall through from not-taken trap target-sparc: Cleanup "global" temporary allocation target-sparc: Use movcond for FMOV*R target-sparc: Use movcond in mulscc target-sparc: Move taddcctv and tsubcctv out of line ... Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'xen-all.c')
-rw-r--r--xen-all.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/xen-all.c b/xen-all.c
index f76b051ee..bcb7ef7c8 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -14,6 +14,7 @@
#include "hw/pc.h"
#include "hw/xen_common.h"
#include "hw/xen_backend.h"
+#include "qmp-commands.h"
#include "range.h"
#include "xen-mapcache.h"
@@ -36,6 +37,7 @@
static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi;
static MemoryRegion *framebuffer;
+static bool xen_in_migration;
/* Compatibility with older version */
#if __XEN_LATEST_INTERFACE_VERSION__ < 0x0003020a
@@ -505,7 +507,8 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
bitmap);
if (rc < 0) {
if (rc != -ENODATA) {
- fprintf(stderr, "xen: track_dirty_vram failed (0x" TARGET_FMT_plx
+ memory_region_set_dirty(framebuffer, 0, size);
+ DPRINTF("xen: track_dirty_vram failed (0x" TARGET_FMT_plx
", 0x" TARGET_FMT_plx "): %s\n",
start_addr, start_addr + size, strerror(-rc));
}
@@ -552,10 +555,14 @@ static void xen_log_sync(MemoryListener *listener, MemoryRegionSection *section)
static void xen_log_global_start(MemoryListener *listener)
{
+ if (xen_enabled()) {
+ xen_in_migration = true;
+ }
}
static void xen_log_global_stop(MemoryListener *listener)
{
+ xen_in_migration = false;
}
static void xen_eventfd_add(MemoryListener *listener,
@@ -588,6 +595,15 @@ static MemoryListener xen_memory_listener = {
.priority = 10,
};
+void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
+{
+ if (enable) {
+ memory_global_dirty_log_start();
+ } else {
+ memory_global_dirty_log_stop();
+ }
+}
+
/* VCPU Operations, MMIO, IO ring ... */
static void xen_reset_vcpu(void *opaque)
@@ -1076,7 +1092,6 @@ static void xen_read_physmap(XenIOState *state)
QLIST_INSERT_HEAD(&state->physmap, physmap, list);
}
free(entries);
- return;
}
int xen_hvm_init(void)
@@ -1213,3 +1228,24 @@ void xen_shutdown_fatal_error(const char *fmt, ...)
/* destroy the domain */
qemu_system_shutdown_request();
}
+
+void xen_modified_memory(ram_addr_t start, ram_addr_t length)
+{
+ if (unlikely(xen_in_migration)) {
+ int rc;
+ ram_addr_t start_pfn, nb_pages;
+
+ if (length == 0) {
+ length = TARGET_PAGE_SIZE;
+ }
+ start_pfn = start >> TARGET_PAGE_BITS;
+ nb_pages = ((start + length + TARGET_PAGE_SIZE - 1) >> TARGET_PAGE_BITS)
+ - start_pfn;
+ rc = xc_hvm_modified_memory(xen_xc, xen_domid, start_pfn, nb_pages);
+ if (rc) {
+ fprintf(stderr,
+ "%s failed for "RAM_ADDR_FMT" ("RAM_ADDR_FMT"): %i, %s\n",
+ __func__, start, nb_pages, rc, strerror(-rc));
+ }
+ }
+}