aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/xen/xen-hvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/i386/xen/xen-hvm.c')
-rw-r--r--hw/i386/xen/xen-hvm.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 006d219..ceb2242 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -10,10 +10,12 @@
#include "qemu/osdep.h"
#include "qemu/units.h"
+#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-migration.h"
#include "trace.h"
+#include "hw/hw.h"
#include "hw/i386/pc.h"
#include "hw/irq.h"
#include "hw/i386/apic-msidef.h"
@@ -24,6 +26,10 @@
#include "hw/xen/arch_hvm.h"
#include <xen/hvm/e820.h>
#include "exec/target_page.h"
+#include "target/i386/cpu.h"
+#include "system/runstate.h"
+#include "system/xen-mapcache.h"
+#include "system/xen.h"
static MemoryRegion ram_640k, ram_lo, ram_hi;
static MemoryRegion *framebuffer;
@@ -584,6 +590,26 @@ static void xen_wakeup_notifier(Notifier *notifier, void *data)
xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0);
}
+static bool xen_check_stubdomain(struct xs_handle *xsh)
+{
+ char *dm_path = g_strdup_printf(
+ "/local/domain/%d/image/device-model-domid", xen_domid);
+ char *val;
+ int32_t dm_domid;
+ bool is_stubdom = false;
+
+ val = xs_read(xsh, 0, dm_path, NULL);
+ if (val) {
+ if (sscanf(val, "%d", &dm_domid) == 1) {
+ is_stubdom = dm_domid != 0;
+ }
+ free(val);
+ }
+
+ g_free(dm_path);
+ return is_stubdom;
+}
+
void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
{
MachineState *ms = MACHINE(pcms);
@@ -594,7 +620,11 @@ void xen_hvm_init_pc(PCMachineState *pcms, MemoryRegion **ram_memory)
state = g_new0(XenIOState, 1);
- xen_register_ioreq(state, max_cpus, &xen_memory_listener);
+ xen_register_ioreq(state, max_cpus,
+ HVM_IOREQSRV_BUFIOREQ_ATOMIC,
+ &xen_memory_listener);
+
+ xen_is_stubdomain = xen_check_stubdomain(state->xenstore);
QLIST_INIT(&xen_physmap);
xen_read_physmap(state);
@@ -728,6 +758,4 @@ void arch_handle_ioreq(XenIOState *state, ioreq_t *req)
default:
hw_error("Invalid ioreq type 0x%x\n", req->type);
}
-
- return;
}