mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
782c3f2939
commit
b152b05a35
18
accel.c
18
accel.c
|
@ -132,23 +132,6 @@ static const TypeInfo tcg_accel_type = {
|
||||||
.class_init = tcg_accel_class_init,
|
.class_init = tcg_accel_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void xen_accel_class_init(ObjectClass *oc, void *data)
|
|
||||||
{
|
|
||||||
AccelClass *ac = ACCEL_CLASS(oc);
|
|
||||||
ac->name = "Xen";
|
|
||||||
ac->available = xen_available;
|
|
||||||
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 qtest_accel_class_init(ObjectClass *oc, void *data)
|
static void qtest_accel_class_init(ObjectClass *oc, void *data)
|
||||||
{
|
{
|
||||||
AccelClass *ac = ACCEL_CLASS(oc);
|
AccelClass *ac = ACCEL_CLASS(oc);
|
||||||
|
@ -170,7 +153,6 @@ static void register_accel_types(void)
|
||||||
{
|
{
|
||||||
type_register_static(&accel_type);
|
type_register_static(&accel_type);
|
||||||
type_register_static(&tcg_accel_type);
|
type_register_static(&tcg_accel_type);
|
||||||
type_register_static(&xen_accel_type);
|
|
||||||
type_register_static(&qtest_accel_type);
|
type_register_static(&qtest_accel_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ void xen_cmos_set_s3_resume(void *opaque, int irq, int level);
|
||||||
|
|
||||||
qemu_irq *xen_interrupt_controller_init(void);
|
qemu_irq *xen_interrupt_controller_init(void);
|
||||||
|
|
||||||
int xen_init(MachineClass *mc);
|
|
||||||
void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
|
void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);
|
||||||
|
|
||||||
#if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
|
#if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
|
||||||
|
|
|
@ -11,9 +11,3 @@
|
||||||
void xenstore_store_pv_console_info(int i, CharDriverState *chr)
|
void xenstore_store_pv_console_info(int i, CharDriverState *chr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int xen_init(MachineClass *mc)
|
|
||||||
{
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
25
xen-common.c
25
xen-common.c
|
@ -11,6 +11,7 @@
|
||||||
#include "hw/xen/xen_backend.h"
|
#include "hw/xen/xen_backend.h"
|
||||||
#include "qmp-commands.h"
|
#include "qmp-commands.h"
|
||||||
#include "sysemu/char.h"
|
#include "sysemu/char.h"
|
||||||
|
#include "sysemu/accel.h"
|
||||||
|
|
||||||
//#define DEBUG_XEN
|
//#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);
|
xen_xc = xen_xc_interface_open(0, 0, 0);
|
||||||
if (xen_xc == XC_HANDLER_INITIAL_VALUE) {
|
if (xen_xc == XC_HANDLER_INITIAL_VALUE) {
|
||||||
|
@ -121,3 +122,25 @@ int xen_init(MachineClass *mc)
|
||||||
return 0;
|
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);
|
||||||
|
|
Loading…
Reference in New Issue