From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFWJw-0002A3-6h for qemu-devel@nongnu.org; Thu, 28 Apr 2011 14:52:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFWJv-0002Kk-5i for qemu-devel@nongnu.org; Thu, 28 Apr 2011 14:52:12 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:40325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFWJv-0002Kg-3a for qemu-devel@nongnu.org; Thu, 28 Apr 2011 14:52:11 -0400 Received: by qyk36 with SMTP id 36so2686531qyk.4 for ; Thu, 28 Apr 2011 11:52:10 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1304000700-3640-2-git-send-email-uobergfe@redhat.com> References: <1304000700-3640-1-git-send-email-uobergfe@redhat.com> <1304000700-3640-2-git-send-email-uobergfe@redhat.com> From: Blue Swirl Date: Thu, 28 Apr 2011 21:51:50 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 1/5] hpet 'driftfix': add hooks required to detect coalesced interrupts (x86 apic only) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ulrich Obergfell Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, jan.kiszka@siemens.com, qemu-devel@nongnu.org, gcosta@redhat.com, avi@redhat.com On Thu, Apr 28, 2011 at 5:24 PM, Ulrich Obergfell wro= te: > 'target_get_irq_delivered' and 'target_reset_irq_delivered' contain > entry addresses of functions that are utilized by update_irq() to > detect coalesced interrupts. apic code loads these pointers during > initialization. I'm not so happy with this approach, but probably then the i386 dependencies can be removed from RTC and it can be compiled only once for all targets. > This change can be replaced if a generic feedback infrastructure to > track coalesced IRQs for periodic, clock providing devices becomes > available. > > Signed-off-by: Ulrich Obergfell > --- > =C2=A0hw/apic.c | =C2=A0 =C2=A04 ++++ > =C2=A0sysemu.h =C2=A0| =C2=A0 =C2=A03 +++ > =C2=A0vl.c =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A03 +++ > =C2=A03 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/hw/apic.c b/hw/apic.c > index a45b57f..eb0f6d9 100644 > --- a/hw/apic.c > +++ b/hw/apic.c > @@ -24,6 +24,7 @@ > =C2=A0#include "sysbus.h" > =C2=A0#include "trace.h" > =C2=A0#include "kvm.h" > +#include "sysemu.h" > > =C2=A0/* APIC Local Vector Table */ > =C2=A0#define APIC_LVT_TIMER =C2=A0 0 > @@ -1143,6 +1144,9 @@ static SysBusDeviceInfo apic_info =3D { > > =C2=A0static void apic_register_devices(void) > =C2=A0{ > + =C2=A0 =C2=A0target_get_irq_delivered =3D apic_get_irq_delivered; > + =C2=A0 =C2=A0target_reset_irq_delivered =3D apic_reset_irq_delivered; > + > =C2=A0 =C2=A0 sysbus_register_withprop(&apic_info); > =C2=A0} > > diff --git a/sysemu.h b/sysemu.h > index 07d85cd..75b0139 100644 > --- a/sysemu.h > +++ b/sysemu.h > @@ -98,6 +98,9 @@ int qemu_savevm_state_complete(Monitor *mon, QEMUFile *= f); > =C2=A0void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f); > =C2=A0int qemu_loadvm_state(QEMUFile *f); > > +extern int (*target_get_irq_delivered)(void); > +extern void (*target_reset_irq_delivered)(void); > + > =C2=A0/* SLIRP */ > =C2=A0void do_info_slirp(Monitor *mon); > > diff --git a/vl.c b/vl.c > index 0c24e07..7bab315 100644 > --- a/vl.c > +++ b/vl.c > @@ -233,6 +233,9 @@ const char *prom_envs[MAX_PROM_ENVS]; > =C2=A0const char *nvram =3D NULL; > =C2=A0int boot_menu; > > +int (*target_get_irq_delivered)(void) =3D 0; > +void (*target_reset_irq_delivered)(void) =3D 0; Instead of initializing with 0 (should be actually NULL in C), please define stub functions, which are used by default. Then the users don't need to check for NULL pointers.