From patchwork Fri May 20 07:13:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Obergfell X-Patchwork-Id: 802322 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4K7DMFM021107 for ; Fri, 20 May 2011 07:13:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933748Ab1ETHNK (ORCPT ); Fri, 20 May 2011 03:13:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22935 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933731Ab1ETHNJ (ORCPT ); Fri, 20 May 2011 03:13:09 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4K7D5t3018152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 20 May 2011 03:13:06 -0400 Received: from localhost.localdomain (vpn1-7-144.ams2.redhat.com [10.36.7.144]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4K7Cxq2003713; Fri, 20 May 2011 03:13:03 -0400 From: Ulrich Obergfell To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, uobergfe@redhat.com, gcosta@redhat.com, avi@redhat.com, mtosatti@redhat.com, zamsden@redhat.com, aliguori@us.ibm.com, jan.kiszka@siemens.com Subject: [PATCH v5 1/5] hpet 'driftfix': add hooks required to detect coalesced interrupts (x86 apic only) Date: Fri, 20 May 2011 09:13:19 +0200 Message-Id: <1305875603-3104-2-git-send-email-uobergfe@redhat.com> In-Reply-To: <1305875603-3104-1-git-send-email-uobergfe@redhat.com> References: <1305875603-3104-1-git-send-email-uobergfe@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 20 May 2011 07:13:24 +0000 (UTC) 'target_get_irq_delivered' and 'target_reset_irq_delivered' point to functions that are called by update_irq() to detect coalesced interrupts. Initially they point to stub functions which pretend successful interrupt injection. apic code calls two registration functions to replace the stubs with apic_get_irq_delivered() and apic_reset_irq_delivered(). 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 --- hw/apic.c | 4 ++++ hw/pc.h | 13 +++++++++++++ vl.c | 13 +++++++++++++ 3 files changed, 30 insertions(+), 0 deletions(-) diff --git a/hw/apic.c b/hw/apic.c index a45b57f..94b1d15 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -17,6 +17,7 @@ * License along with this library; if not, see */ #include "hw.h" +#include "pc.h" #include "apic.h" #include "ioapic.h" #include "qemu-timer.h" @@ -1143,6 +1144,9 @@ static SysBusDeviceInfo apic_info = { static void apic_register_devices(void) { + register_target_get_irq_delivered(apic_get_irq_delivered); + register_target_reset_irq_delivered(apic_reset_irq_delivered); + sysbus_register_withprop(&apic_info); } diff --git a/hw/pc.h b/hw/pc.h index bc8fcec..7511f28 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -7,6 +7,19 @@ #include "fdc.h" #include "net.h" +extern int (*target_get_irq_delivered)(void); +extern void (*target_reset_irq_delivered)(void); + +static inline void register_target_get_irq_delivered(int (*func)(void)) +{ + target_get_irq_delivered = func; +} + +static inline void register_target_reset_irq_delivered(void (*func)(void)) +{ + target_reset_irq_delivered = func; +} + /* PC-style peripherals (also used by other machines). */ /* serial.c */ diff --git a/vl.c b/vl.c index 73e147f..456e320 100644 --- a/vl.c +++ b/vl.c @@ -232,6 +232,19 @@ const char *prom_envs[MAX_PROM_ENVS]; const char *nvram = NULL; int boot_menu; +static int target_get_irq_delivered_stub(void) +{ + return 1; +} + +static void target_reset_irq_delivered_stub(void) +{ + return; +} + +int (*target_get_irq_delivered)(void) = target_get_irq_delivered_stub; +void (*target_reset_irq_delivered)(void) = target_reset_irq_delivered_stub; + typedef struct FWBootEntry FWBootEntry; struct FWBootEntry {