From mboxrd@z Thu Jan 1 00:00:00 1970 From: Blue Swirl Subject: Re: [Qemu-devel] [PATCH v3 1/5] hpet 'driftfix': add hooks required to detect coalesced interrupts (x86 apic only) Date: Thu, 28 Apr 2011 21:51:50 +0300 Message-ID: References: <1304000700-3640-1-git-send-email-uobergfe@redhat.com> <1304000700-3640-2-git-send-email-uobergfe@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: qemu-devel@nongnu.org, aliguori@us.ibm.com, kvm@vger.kernel.org, jan.kiszka@siemens.com, gcosta@redhat.com, avi@redhat.com To: Ulrich Obergfell Return-path: Received: from mail-qy0-f174.google.com ([209.85.216.174]:54499 "EHLO mail-qy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933369Ab1D1SwL convert rfc822-to-8bit (ORCPT ); Thu, 28 Apr 2011 14:52:11 -0400 Received: by qyk7 with SMTP id 7so2487659qyk.19 for ; Thu, 28 Apr 2011 11:52:10 -0700 (PDT) In-Reply-To: <1304000700-3640-2-git-send-email-uobergfe@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Apr 28, 2011 at 5:24 PM, Ulrich Obergfell = wrote: > '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_delivere= d; > + > =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, QEMUFi= le *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.