From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34606) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWRGS-0006p1-4w for qemu-devel@nongnu.org; Sun, 28 Apr 2013 09:03:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWRGQ-0002VS-Ok for qemu-devel@nongnu.org; Sun, 28 Apr 2013 09:03:36 -0400 Received: from mout.web.de ([212.227.15.4]:64512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWRGQ-0002UP-FG for qemu-devel@nongnu.org; Sun, 28 Apr 2013 09:03:34 -0400 Message-ID: <517D1E19.1030905@web.de> Date: Sun, 28 Apr 2013 15:03:21 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <1367148131-1440-1-git-send-email-afaerber@suse.de> In-Reply-To: <1367148131-1440-1-git-send-email-afaerber@suse.de> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2CICTDAVHEXGKMPNJBJHN" Subject: Re: [Qemu-devel] [PATCH RFC qom-cpu-next] apic: QOM'ify APICCommonState casts List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Cc: imammedo@redhat.com, gleb@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws, ehabkost@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2CICTDAVHEXGKMPNJBJHN Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 2013-04-28 13:22, Andreas F=C3=A4rber wrote: > Necessary to change the name of ICCDevice's parent object field. >=20 > Signed-off-by: Andreas F=C3=A4rber > --- > Could any of the APIC experts please review whether I'm touching any h= ot path? > Not sure if this was a mix of pre- and post-QOM code or intentional...= Thanks. How "hot" does it have to be before we notice the type check overhead? Did anyone already measure this, given that they are getting very common now? But none of the touched functions are used during normal operation when the KVM APIC is active. With emulated APIC, they are frequently used, of course. Jan >=20 > hw/i386/kvm/apic.c | 4 ++-- > hw/intc/apic.c | 20 +++++++++++--------- > hw/intc/apic_common.c | 10 +++++----- > include/hw/cpu/icc_bus.h | 2 +- > 4 files changed, 19 insertions(+), 17 deletions(-) >=20 > diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c > index 8f80425..0fe31ae 100644 > --- a/hw/i386/kvm/apic.c > +++ b/hw/i386/kvm/apic.c > @@ -27,7 +27,7 @@ static inline uint32_t kvm_apic_get_reg(struct kvm_la= pic_state *kapic, > =20 > void kvm_put_apic_state(DeviceState *d, struct kvm_lapic_state *kapic)= > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > int i; > =20 > memset(kapic, 0, sizeof(*kapic)); > @@ -53,7 +53,7 @@ void kvm_put_apic_state(DeviceState *d, struct kvm_la= pic_state *kapic) > =20 > void kvm_get_apic_state(DeviceState *d, struct kvm_lapic_state *kapic)= > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > int i, v; > =20 > s->id =3D kvm_apic_get_reg(kapic, 0x2) >> 24; > diff --git a/hw/intc/apic.c b/hw/intc/apic.c > index 756dff0..f171620 100644 > --- a/hw/intc/apic.c > +++ b/hw/intc/apic.c > @@ -173,7 +173,7 @@ static void apic_local_deliver(APICCommonState *s, = int vector) > =20 > void apic_deliver_pic_intr(DeviceState *d, int level) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > =20 > if (level) { > apic_local_deliver(s, APIC_LVT_LINT0); > @@ -484,7 +484,7 @@ static void apic_startup(APICCommonState *s, int ve= ctor_num) > =20 > void apic_sipi(DeviceState *d) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > =20 > cpu_reset_interrupt(CPU(s->cpu), CPU_INTERRUPT_SIPI); > =20 > @@ -498,7 +498,7 @@ static void apic_deliver(DeviceState *d, uint8_t de= st, uint8_t dest_mode, > uint8_t delivery_mode, uint8_t vector_num, > uint8_t trigger_mode) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > uint32_t deliver_bitmask[MAX_APIC_WORDS]; > int dest_shorthand =3D (s->icr[0] >> 18) & 3; > APICCommonState *apic_iter; > @@ -544,16 +544,18 @@ static void apic_deliver(DeviceState *d, uint8_t = dest, uint8_t dest_mode, > =20 > static bool apic_check_pic(APICCommonState *s) > { > - if (!apic_accept_pic_intr(&s->busdev.qdev) || !pic_get_output(isa_= pic)) { > + DeviceState *dev =3D DEVICE(s); > + > + if (!apic_accept_pic_intr(dev) || !pic_get_output(isa_pic)) { > return false; > } > - apic_deliver_pic_intr(&s->busdev.qdev, 1); > + apic_deliver_pic_intr(dev, 1); > return true; > } > =20 > int apic_get_interrupt(DeviceState *d) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > int intno; > =20 > /* if the APIC is installed or enabled, we let the 8259 handle the= > @@ -587,7 +589,7 @@ int apic_get_interrupt(DeviceState *d) > =20 > int apic_accept_pic_intr(DeviceState *d) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > uint32_t lvt0; > =20 > if (!s) > @@ -666,7 +668,7 @@ static uint32_t apic_mem_readl(void *opaque, hwaddr= addr) > if (!d) { > return 0; > } > - s =3D DO_UPCAST(APICCommonState, busdev.qdev, d); > + s =3D APIC_COMMON(d); > =20 > index =3D (addr >> 4) & 0xff; > switch(index) { > @@ -769,7 +771,7 @@ static void apic_mem_writel(void *opaque, hwaddr ad= dr, uint32_t val) > if (!d) { > return; > } > - s =3D DO_UPCAST(APICCommonState, busdev.qdev, d); > + s =3D APIC_COMMON(d); > =20 > trace_apic_mem_writel(addr, val); > =20 > diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c > index b03e904..0087a14 100644 > --- a/hw/intc/apic_common.c > +++ b/hw/intc/apic_common.c > @@ -82,7 +82,7 @@ uint8_t cpu_get_apic_tpr(DeviceState *d) > =20 > void apic_enable_tpr_access_reporting(DeviceState *d, bool enable) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > APICCommonClass *info =3D APIC_COMMON_GET_CLASS(s); > =20 > apic_report_tpr_access =3D enable; > @@ -93,7 +93,7 @@ void apic_enable_tpr_access_reporting(DeviceState *d,= bool enable) > =20 > void apic_enable_vapic(DeviceState *d, hwaddr paddr) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > APICCommonClass *info =3D APIC_COMMON_GET_CLASS(s); > =20 > s->vapic_paddr =3D paddr; > @@ -103,7 +103,7 @@ void apic_enable_vapic(DeviceState *d, hwaddr paddr= ) > void apic_handle_tpr_access_report(DeviceState *d, target_ulong ip, > TPRAccess access) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > =20 > vapic_report_tpr_access(s->vapic, CPU(s->cpu), ip, access); > } > @@ -172,7 +172,7 @@ bool apic_next_timer(APICCommonState *s, int64_t cu= rrent_time) > =20 > void apic_init_reset(DeviceState *d) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > int i; > =20 > if (!s) { > @@ -215,7 +215,7 @@ void apic_designate_bsp(DeviceState *d) > =20 > static void apic_reset_common(DeviceState *d) > { > - APICCommonState *s =3D DO_UPCAST(APICCommonState, busdev.qdev, d);= > + APICCommonState *s =3D APIC_COMMON(d); > APICCommonClass *info =3D APIC_COMMON_GET_CLASS(s); > bool bsp; > =20 > diff --git a/include/hw/cpu/icc_bus.h b/include/hw/cpu/icc_bus.h > index b550070..f2c8a50 100644 > --- a/include/hw/cpu/icc_bus.h > +++ b/include/hw/cpu/icc_bus.h > @@ -51,7 +51,7 @@ typedef struct ICCBus { > */ > typedef struct ICCDevice { > /*< private >*/ > - DeviceState qdev; > + DeviceState parent_obj; > /*< public >*/ > } ICCDevice; > =20 >=20 ------enig2CICTDAVHEXGKMPNJBJHN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlF9Hh0ACgkQitSsb3rl5xQnhQCfeCYIf9/RGGTqqoFNTJVKNCHH TZ8An2Ri62IYcG+5nQyyedwOYQVEVQsj =Fb64 -----END PGP SIGNATURE----- ------enig2CICTDAVHEXGKMPNJBJHN--