From patchwork Fri Jan 20 17:26:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 137072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 423101007D1 for ; Sat, 21 Jan 2012 05:25:55 +1100 (EST) Received: from localhost ([::1]:55785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoIJ4-0005lX-2L for incoming@patchwork.ozlabs.org; Fri, 20 Jan 2012 12:31:18 -0500 Received: from eggs.gnu.org ([140.186.70.92]:34583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoIIG-0004l8-Ct for qemu-devel@nongnu.org; Fri, 20 Jan 2012 12:30:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RoIIA-0006D4-PH for qemu-devel@nongnu.org; Fri, 20 Jan 2012 12:30:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RoIIA-0006CL-Do for qemu-devel@nongnu.org; Fri, 20 Jan 2012 12:30:22 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0KHULOp018489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 20 Jan 2012 12:30:21 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0KHULB1017373; Fri, 20 Jan 2012 12:30:21 -0500 Received: from amt.cnet (vpn1-5-58.ams2.redhat.com [10.36.5.58]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id q0KHUIHK011725; Fri, 20 Jan 2012 12:30:19 -0500 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 6A5DF6523B8; Fri, 20 Jan 2012 15:27:11 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.5/8.14.5/Submit) id q0KHR9ho007251; Fri, 20 Jan 2012 15:27:09 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Fri, 20 Jan 2012 15:26:33 -0200 Message-Id: <343270ea8777fa95ce2c287fc00c2eaa53255265.1327080406.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Jan Kiszka , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 07/20] apic: Introduce apic_report_irq_delivered X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka The in-kernel i8259 and IOAPIC backends for KVM will need this, so encapsulate the shared bits. Signed-off-by: Jan Kiszka --- hw/apic.c | 11 ++++++++--- hw/apic.h | 1 + trace-events | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/apic.c b/hw/apic.c index b9d733c..bec493b 100644 --- a/hw/apic.c +++ b/hw/apic.c @@ -413,6 +413,13 @@ static void apic_update_irq(APICState *s) } } +void apic_report_irq_delivered(int delivered) +{ + apic_irq_delivered += delivered; + + trace_apic_report_irq_delivered(apic_irq_delivered); +} + void apic_reset_irq_delivered(void) { trace_apic_reset_irq_delivered(apic_irq_delivered); @@ -429,9 +436,7 @@ int apic_get_irq_delivered(void) static void apic_set_irq(APICState *s, int vector_num, int trigger_mode) { - apic_irq_delivered += !get_bit(s->irr, vector_num); - - trace_apic_set_irq(apic_irq_delivered); + apic_report_irq_delivered(!get_bit(s->irr, vector_num)); set_bit(s->irr, vector_num); if (trigger_mode) diff --git a/hw/apic.h b/hw/apic.h index a62d83b..8173d8a 100644 --- a/hw/apic.h +++ b/hw/apic.h @@ -10,6 +10,7 @@ int apic_accept_pic_intr(DeviceState *s); void apic_deliver_pic_intr(DeviceState *s, int level); void apic_deliver_nmi(DeviceState *d); int apic_get_interrupt(DeviceState *s); +void apic_report_irq_delivered(int delivered); void apic_reset_irq_delivered(void); int apic_get_irq_delivered(void); void cpu_set_apic_base(DeviceState *s, uint64_t val); diff --git a/trace-events b/trace-events index c18435b..5a260d6 100644 --- a/trace-events +++ b/trace-events @@ -95,9 +95,9 @@ cpu_get_apic_base(uint64_t val) "%016"PRIx64 apic_mem_readl(uint64_t addr, uint32_t val) "%"PRIx64" = %08x" apic_mem_writel(uint64_t addr, uint32_t val) "%"PRIx64" = %08x" # coalescing +apic_report_irq_delivered(int apic_irq_delivered) "coalescing %d" apic_reset_irq_delivered(int apic_irq_delivered) "old coalescing %d" apic_get_irq_delivered(int apic_irq_delivered) "returning coalescing %d" -apic_set_irq(int apic_irq_delivered) "coalescing %d" # hw/cs4231.c cs4231_mem_readl_dreg(uint32_t reg, uint32_t ret) "read dreg %d: 0x%02x"