Received: from eggs.gnu.org ([2001:4830:134:3::10]:43428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmFFc-0004XL-D8 for qemu-devel@nongnu.org; Tue, 20 Sep 2016 03:13:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmFFY-0003q5-1J for qemu-devel@nongnu.org; Tue, 20 Sep 2016 03:13:55 -0400 Received: from 17.mo5.mail-out.ovh.net ([46.105.56.132]:48033) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmFFX-0003pm-OX for qemu-devel@nongnu.org; Tue, 20 Sep 2016 03:13:51 -0400 Received: from player763.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 2D9371005131 for ; Tue, 20 Sep 2016 09:13:50 +0200 (CEST) References: <1474266577-11704-1-git-send-email-nikunj@linux.vnet.ibm.com> <1474266577-11704-7-git-send-email-nikunj@linux.vnet.ibm.com> <87r38frtw1.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> <19c378eb-33d7-3e61-ec53-3de5ea40f407@kaod.org> <87lgynrsm0.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Tue, 20 Sep 2016 09:13:45 +0200 MIME-Version: 1.0 In-Reply-To: <87lgynrsm0.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v4 6/9] ppc/xics: Split ICS into ics-base and ics class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikunj A Dadhania , qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Cc: qemu-devel@nongnu.org On 09/20/2016 08:29 AM, Nikunj A Dadhania wrote: > C=C3=A9dric Le Goater writes: >=20 >> On 09/20/2016 08:02 AM, Nikunj A Dadhania wrote: >>> C=C3=A9dric Le Goater writes: >>> >>>> On 09/19/2016 08:29 AM, Nikunj A Dadhania wrote: >>>>> From: Benjamin Herrenschmidt >>>>> >>>>> The existing implementation remains same and ics-base is introduced= . The >>>>> type name "ics" is retained, and all the related functions renamed = as >>>>> ics_simple_* >>>>> >>>>> This will allow different implementations for the source controller= s >>>>> such as the MSI support of PHB3 on Power8 which uses in-memory stat= e >>>>> tables for example. >>>> >>>> A couple of issues below regarding the class helpers, >>>> >>>>> Signed-off-by: Benjamin Herrenschmidt >>>>> Signed-off-by: Nikunj A Dadhania >>>>> --- >>>>> hw/intc/trace-events | 10 ++-- >>>>> hw/intc/xics.c | 143 +++++++++++++++++++++++++++++++-------= ------------ >>>>> hw/intc/xics_kvm.c | 10 ++-- >>>>> hw/intc/xics_spapr.c | 28 +++++----- >>>>> include/hw/ppc/xics.h | 23 +++++--- >>>>> 5 files changed, 131 insertions(+), 83 deletions(-) >>>>> @@ -224,9 +224,32 @@ static const TypeInfo xics_common_info =3D { >>>>> #define XISR(ss) (((ss)->xirr) & XISR_MASK) >>>>> #define CPPR(ss) (((ss)->xirr) >> 24) >>>>> =20 >>>>> -static void ics_reject(ICSState *ics, int nr); >>>>> -static void ics_resend(ICSState *ics, int server); >>>>> -static void ics_eoi(ICSState *ics, int nr); >>>>> +static void ics_reject(ICSState *ics, uint32_t nr) >>>>> +{ >>>>> + ICSStateClass *k =3D ICS_GET_CLASS(ics); >>>> >>>> Shouldn't that be ICS_BASE_GET_CLASS() >>> >>> The class hierarchy is something like this: >>> >>> ICS_BASE -> ICS_SIMPLE -> ICS_KVM >> >> yes. but if we called ics_* with an instance of an ics class which is= =20 >> not a ICS_SIMPLE class that will break. >=20 > Correct >=20 >> ICSStateClass is the baseclass, whenever we call methods on a ICSState= *=20 >> object, we should use the method defines in ICSStateClass. >=20 > Hmm, in that case I need to initialize base class methods in > instance_init of ics_simple yes but this is done, no ? I see :=20 static void ics_simple_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); ICSStateClass *isc =3D ICS_BASE_CLASS(klass); dc->realize =3D ics_simple_realize; dc->vmsd =3D &vmstate_ics_simple; dc->reset =3D ics_simple_reset; isc->post_load =3D ics_simple_post_load; isc->reject =3D ics_simple_reject; isc->resend =3D ics_simple_resend; isc->eoi =3D ics_simple_eoi; } Thanks, C.=20