From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW7pv-0006FQ-JH for qemu-devel@nongnu.org; Sat, 27 Apr 2013 12:18:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UW7ps-0002WL-9W for qemu-devel@nongnu.org; Sat, 27 Apr 2013 12:18:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36840 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW7ps-0002W4-0S for qemu-devel@nongnu.org; Sat, 27 Apr 2013 12:18:52 -0400 Message-ID: <517BFA67.6070405@suse.de> Date: Sat, 27 Apr 2013 18:18:47 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1366898737-6201-1-git-send-email-imammedo@redhat.com> <1366898737-6201-6-git-send-email-imammedo@redhat.com> In-Reply-To: <1366898737-6201-6-git-send-email-imammedo@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 05/15] target-i386: introduce ICC bus/device/bridge List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, ehabkost@redhat.com, mst@redhat.com, stefano.stabellini@eu.citrix.com, qemu-devel@nongnu.org, quintela@redhat.com, anthony.perard@citrix.com, pbonzini@redhat.com Am 25.04.2013 16:05, schrieb Igor Mammedov: > Provides hotplug-able bus for APIC and CPU. >=20 > * icc-bridge will serve as a parent for icc-bus and provide > mmio mapping services to child icc-devices. > * icc-device will replace SysBusDevice as a parent of APIC > and IOAPIC devices. >=20 > Signed-off-by: Igor Mammedov > --- > v3: > * mv include/hw/i386/icc_bus.h into include/hw/cpu/ > * various style fixes > * embed icc-bus inside icc-bridge and use qbus_create_inplace() > * update MAINTAINERS with new files > v2: > * Rebase on top the last HW reorganization series. > * Move hw/icc_bus.c into hw/cpu/ and hw/icc_bus.h include/hw/i386/ > --- > MAINTAINERS | 6 ++ > default-configs/i386-softmmu.mak | 1 + > default-configs/x86_64-softmmu.mak | 1 + > hw/cpu/Makefile.objs | 1 + > hw/cpu/icc_bus.c | 104 ++++++++++++++++++++++++++++= ++++++++ > hw/i386/pc_piix.c | 7 +++ > hw/i386/pc_q35.c | 7 +++ > include/hw/cpu/icc_bus.h | 58 ++++++++++++++++++++ > 8 files changed, 185 insertions(+), 0 deletions(-) > create mode 100644 hw/cpu/icc_bus.c > create mode 100644 include/hw/cpu/icc_bus.h Thanks, queued on qom-cpu-next (with changes below): https://github.com/afaerber/qemu-cpu/commits/qom-cpu-next In particular since this is a new file I've taken the liberty to tidy the header a bit; and since you had changed initfn -> init I renamed realizefn alongside and normalized Error** argument. When I converted the CPUs to QOM there were protests against the use of k / klass and the compromise was to use oc, dc, etc., thus idc here. Doing this temporarily on -next in case I run into non-trivial rebase problems later on. Andreas diff --git a/hw/cpu/icc_bus.c b/hw/cpu/icc_bus.c index f6091b9..2db42b1 100644 --- a/hw/cpu/icc_bus.c +++ b/hw/cpu/icc_bus.c @@ -1,5 +1,5 @@ /* icc_bus.c - * emulate x86 ICC(Interrupt Controller Communications) bus + * emulate x86 ICC (Interrupt Controller Communications) bus * * Copyright (c) 2013 Red Hat, Inc * @@ -23,6 +23,7 @@ #include "hw/sysbus.h" /* icc-bridge implementation */ + static void icc_bus_init(Object *obj) { BusState *b =3D BUS(obj); @@ -37,18 +38,18 @@ static const TypeInfo icc_bus_info =3D { .instance_init =3D icc_bus_init, }; + /* icc-device implementation */ -static void icc_device_realizefn(DeviceState *dev, Error **err) + +static void icc_device_realize(DeviceState *dev, Error **errp) { ICCDevice *id =3D ICC_DEVICE(dev); ICCDeviceClass *k =3D ICC_DEVICE_GET_CLASS(id); - Error *local_err =3D NULL; if (k->init) { if (k->init(id) < 0) { - error_setg(&local_err, "%s initialization failed.", + error_setg(errp, "%s initialization failed.", object_get_typename(OBJECT(dev))); - error_propagate(err, local_err); } } } @@ -57,7 +58,7 @@ static void icc_device_class_init(ObjectClass *klass, void *da ta) { DeviceClass *k =3D DEVICE_CLASS(klass); - k->realize =3D icc_device_realizefn; + k->realize =3D icc_device_realize; k->bus_type =3D TYPE_ICC_BUS; } @@ -70,10 +71,14 @@ static const TypeInfo icc_device_info =3D { .class_init =3D icc_device_class_init, }; + /* icc-bridge implementation */ + typedef struct ICCBridgeState { /*< private >*/ SysBusDevice parent_obj; + /*< public >*/ + ICCBus icc_bus; } ICCBridgeState; diff --git a/include/hw/cpu/icc_bus.h b/include/hw/cpu/icc_bus.h index a0abc21..db252c7 100644 --- a/include/hw/cpu/icc_bus.h +++ b/include/hw/cpu/icc_bus.h @@ -1,5 +1,5 @@ /* icc_bus.h - * emulate x86 ICC(Interrupt Controller Communications) bus + * emulate x86 ICC (Interrupt Controller Communications) bus * * Copyright (c) 2013 Red Hat, Inc * @@ -28,21 +28,42 @@ #ifndef CONFIG_USER_ONLY +/** + * ICCBus: + * + * ICC bus + */ typedef struct ICCBus { /*< private >*/ BusState parent_obj; + /*< public >*/ } ICCBus; #define ICC_BUS(obj) OBJECT_CHECK(ICCBus, (obj), TYPE_ICC_BUS) +/** + * ICCDevice: + * + * ICC device + */ typedef struct ICCDevice { + /*< private >*/ + DeviceState parent_obj; /*< public >*/ - DeviceState qdev; } ICCDevice; +/** + * ICCDeviceClass: + * @init: Initialization callback for derived classes. + * + * ICC device class + */ typedef struct ICCDeviceClass { + /*< private >*/ DeviceClass parent_class; - int (*init)(ICCDevice *dev); + /*< public >*/ + + int (*init)(ICCDevice *dev); /* TODO replace with QOM realize */ } ICCDeviceClass; #define TYPE_ICC_DEVICE "icc-device" diff --git a/hw/cpu/icc_bus.c b/hw/cpu/icc_bus.c index 2db42b1..a89bbb3 100644 --- a/hw/cpu/icc_bus.c +++ b/hw/cpu/icc_bus.c @@ -56,10 +56,10 @@ static void icc_device_realize(DeviceState *dev, Error **errp) static void icc_device_class_init(ObjectClass *klass, void *data) { - DeviceClass *k =3D DEVICE_CLASS(klass); + DeviceClass *dc =3D DEVICE_CLASS(klass); - k->realize =3D icc_device_realize; - k->bus_type =3D TYPE_ICC_BUS; + dc->realize =3D icc_device_realize; + dc->bus_type =3D TYPE_ICC_BUS; } static const TypeInfo icc_device_info =3D { diff --git a/hw/cpu/icc_bus.c b/hw/cpu/icc_bus.c index a89bbb3..1d5e646 100644 --- a/hw/cpu/icc_bus.c +++ b/hw/cpu/icc_bus.c @@ -44,19 +44,19 @@ static const TypeInfo icc_bus_info =3D { static void icc_device_realize(DeviceState *dev, Error **errp) { ICCDevice *id =3D ICC_DEVICE(dev); - ICCDeviceClass *k =3D ICC_DEVICE_GET_CLASS(id); + ICCDeviceClass *idc =3D ICC_DEVICE_GET_CLASS(id); - if (k->init) { - if (k->init(id) < 0) { + if (idc->init) { + if (idc->init(id) < 0) { error_setg(errp, "%s initialization failed.", object_get_typename(OBJECT(dev))); } } } -static void icc_device_class_init(ObjectClass *klass, void *data) +static void icc_device_class_init(ObjectClass *oc, void *data) { - DeviceClass *dc =3D DEVICE_CLASS(klass); + DeviceClass *dc =3D DEVICE_CLASS(oc); dc->realize =3D icc_device_realize; dc->bus_type =3D TYPE_ICC_BUS; --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg