From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXX4a-0003g5-46 for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:04:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXX4Q-0002Jg-NZ for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:04:40 -0400 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:64258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXX4Q-0002IX-D6 for qemu-devel@nongnu.org; Fri, 26 Sep 2014 11:04:30 -0400 Received: by mail-wi0-f171.google.com with SMTP id ho1so11140995wib.4 for ; Fri, 26 Sep 2014 08:04:24 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <54258069.8050907@redhat.com> Date: Fri, 26 Sep 2014 17:04:09 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1409344310-5441-1-git-send-email-ehabkost@redhat.com> <1409344310-5441-10-git-send-email-ehabkost@redhat.com> In-Reply-To: <1409344310-5441-10-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 09/17] accel: Move Xen registration code to xen-common.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Michael Mueller , "Michael S. Tsirkin" , Marcel Apfelbaum , Alexander Graf , Christian Borntraeger , "Jason J. Herne" , =?windows-1252?Q?Andreas_?= =?windows-1252?Q?F=E4rber?= Il 29/08/2014 22:31, Eduardo Habkost ha scritto: > 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. > > Signed-off-by: Eduardo Habkost > --- > hw/core/accel.c | 18 ------------------ > include/hw/xen/xen.h | 1 - > xen-common-stub.c | 6 ------ > xen-common.c | 25 ++++++++++++++++++++++++- > 4 files changed, 24 insertions(+), 26 deletions(-) > > diff --git a/hw/core/accel.c b/hw/core/accel.c > index 61dafcb..ecd1efa 100644 > --- a/hw/core/accel.c > +++ b/hw/core/accel.c > @@ -132,23 +132,6 @@ static const TypeInfo tcg_accel_type = { > .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) > { > AccelClass *ac = ACCEL_CLASS(oc); > @@ -170,7 +153,6 @@ static void register_accel_types(void) > { > type_register_static(&accel_type); > type_register_static(&tcg_accel_type); > - type_register_static(&xen_accel_type); > type_register_static(&qtest_accel_type); > } > > diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h > index f71f2d8..b0ed04c 100644 > --- a/include/hw/xen/xen.h > +++ b/include/hw/xen/xen.h > @@ -36,7 +36,6 @@ void xen_cmos_set_s3_resume(void *opaque, int irq, int level); > > qemu_irq *xen_interrupt_controller_init(void); > > -int xen_init(MachineClass *mc); > void xenstore_store_pv_console_info(int i, struct CharDriverState *chr); > > #if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY) > diff --git a/xen-common-stub.c b/xen-common-stub.c > index bd56ca2..906f991 100644 > --- a/xen-common-stub.c > +++ b/xen-common-stub.c > @@ -11,9 +11,3 @@ > void xenstore_store_pv_console_info(int i, CharDriverState *chr) > { > } > - > -int xen_init(MachineClass *mc) > -{ > - return -ENOSYS; > -} > - > diff --git a/xen-common.c b/xen-common.c > index f07b35e..f0b34be 100644 > --- a/xen-common.c > +++ b/xen-common.c > @@ -9,6 +9,7 @@ > */ > > #include "hw/xen/xen_backend.h" > +#include "hw/accel.h" > #include "qmp-commands.h" > #include "sysemu/char.h" > > @@ -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); > Reviewed-by: Paolo Bonzini