aboutsummaryrefslogtreecommitdiff
path: root/xen-common.c
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2014-09-26 17:45:25 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2014-10-04 08:59:15 +0200
commitb152b05a35acc0ff3da5648fd5cb97136853838c (patch)
tree848ab76e85003e03c5053b49f2a2086c2505337c /xen-common.c
parent782c3f2939a8faefa4c5a324dfb472a534048510 (diff)
downloadqemu-b152b05a35acc0ff3da5648fd5cb97136853838c.zip
qemu-b152b05a35acc0ff3da5648fd5cb97136853838c.tar.gz
qemu-b152b05a35acc0ff3da5648fd5cb97136853838c.tar.bz2
accel: Move Xen registration code to xen-common.c
Note that this has an user-visible side-effect: instead of reporting "Xen is not supported for this target", QEMU binaries not supporting Xen will report "xen accelerator does not exist". As xen_available() always return 1 when CONFIG_XEN is enabled, we don't need to set AccelClass.available anymore. xen_enabled() is not being removed yet, but only because vl.c is still using it. This also allows us to make xen_init() static. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'xen-common.c')
-rw-r--r--xen-common.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/xen-common.c b/xen-common.c
index f07b35e..acc64d5 100644
--- a/xen-common.c
+++ b/xen-common.c
@@ -11,6 +11,7 @@
#include "hw/xen/xen_backend.h"
#include "qmp-commands.h"
#include "sysemu/char.h"
+#include "sysemu/accel.h"
//#define DEBUG_XEN
@@ -109,7 +110,7 @@ static void xen_change_state_handler(void *opaque, int running,
}
}
-int xen_init(MachineClass *mc)
+static int xen_init(MachineClass *mc)
{
xen_xc = xen_xc_interface_open(0, 0, 0);
if (xen_xc == XC_HANDLER_INITIAL_VALUE) {
@@ -121,3 +122,25 @@ int xen_init(MachineClass *mc)
return 0;
}
+static void xen_accel_class_init(ObjectClass *oc, void *data)
+{
+ AccelClass *ac = ACCEL_CLASS(oc);
+ ac->name = "Xen";
+ ac->init = xen_init;
+ ac->allowed = &xen_allowed;
+}
+
+#define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen")
+
+static const TypeInfo xen_accel_type = {
+ .name = TYPE_XEN_ACCEL,
+ .parent = TYPE_ACCEL,
+ .class_init = xen_accel_class_init,
+};
+
+static void xen_type_init(void)
+{
+ type_register_static(&xen_accel_type);
+}
+
+type_init(xen_type_init);