aboutsummaryrefslogtreecommitdiff
path: root/hw/xen
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-11-13 10:56:53 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-12-17 19:32:27 +0100
commit46472d82322d0af23c7074c1101a791b5a27ca46 (patch)
treeabb8efdc8c80feeca312e22b7443f943ca1904b3 /hw/xen
parentfe174132478b4e7b0086f2305a511fd94c9aca8b (diff)
xen: convert "-machine igd-passthru" to an accelerator property
The first machine property to fall is Xen's Intel integrated graphics passthrough. The "-machine igd-passthru" option does not set anymore a property on the machine object, but desugars to a GlobalProperty on accelerator objects. The setter is very simple, since the value ends up in a global variable, so this patch also provides an example before the more complicated cases that follow it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/xen')
-rw-r--r--hw/xen/xen-common.c18
-rw-r--r--hw/xen/xen_pt.c2
2 files changed, 20 insertions, 0 deletions
diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
index 5284b0dec1..15650d7f6a 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/xen-common.c
@@ -11,7 +11,9 @@
#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
+#include "qapi/error.h"
#include "hw/xen/xen-legacy-backend.h"
+#include "hw/xen/xen_pt.h"
#include "chardev/char.h"
#include "sysemu/accel.h"
#include "sysemu/runstate.h"
@@ -124,6 +126,16 @@ static void xen_change_state_handler(void *opaque, int running,
}
}
+static bool xen_get_igd_gfx_passthru(Object *obj, Error **errp)
+{
+ return has_igd_gfx_passthru;
+}
+
+static void xen_set_igd_gfx_passthru(Object *obj, bool value, Error **errp)
+{
+ has_igd_gfx_passthru = value;
+}
+
static void xen_setup_post(MachineState *ms, AccelState *accel)
{
int rc;
@@ -177,6 +189,12 @@ static void xen_accel_class_init(ObjectClass *oc, void *data)
ac->compat_props = g_ptr_array_new();
compat_props_add(ac->compat_props, compat, G_N_ELEMENTS(compat));
+
+ object_class_property_add_bool(oc, "igd-passthru",
+ xen_get_igd_gfx_passthru, xen_set_igd_gfx_passthru,
+ &error_abort);
+ object_class_property_set_description(oc, "igd-passthru",
+ "Set on/off to enable/disable igd passthrou", &error_abort);
}
#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c
index 8fbaf2eae9..9e767d4244 100644
--- a/hw/xen/xen_pt.c
+++ b/hw/xen/xen_pt.c
@@ -65,6 +65,8 @@
#include "qemu/range.h"
#include "exec/address-spaces.h"
+bool has_igd_gfx_passthru;
+
#define XEN_PT_NR_IRQS (256)
static uint8_t xen_pt_mapped_machine_irq[XEN_PT_NR_IRQS] = {0};