From nobody Mon Feb 9 18:17:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519064860454475.53769912554003; Mon, 19 Feb 2018 10:27:40 -0800 (PST) Received: from localhost ([::1]:51756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1enq9z-0004J8-Jz for importer@patchew.org; Mon, 19 Feb 2018 13:27:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44279) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1enq2c-0006jw-1e for qemu-devel@nongnu.org; Mon, 19 Feb 2018 13:19:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1enq2a-0007lm-Na for qemu-devel@nongnu.org; Mon, 19 Feb 2018 13:19:53 -0500 Received: from chuckie.co.uk ([82.165.15.123]:41980 helo=s16892447.onlinehome-server.info) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1enq2a-0007df-EP; Mon, 19 Feb 2018 13:19:52 -0500 Received: from host109-156-184-151.range109-156.btcentralplus.com ([109.156.184.151] helo=kentang.home) by s16892447.onlinehome-server.info with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1enq2g-0002GT-CC; Mon, 19 Feb 2018 18:19:59 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Mon, 19 Feb 2018 18:19:15 +0000 Message-Id: <20180219181922.21586-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180219181922.21586-1-mark.cave-ayland@ilande.co.uk> References: <20180219181922.21586-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.156.184.151 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk X-SA-Exim-Version: 4.2.1 (built Sun, 08 Jan 2012 02:45:44 +0000) X-SA-Exim-Scanned: Yes (on s16892447.onlinehome-server.info) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 82.165.15.123 Subject: [Qemu-devel] [PATCH 04/11] heathrow: convert to trace-events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Mark Cave-Ayland --- hw/intc/heathrow_pic.c | 31 ++++++++++++------------------- hw/intc/trace-events | 5 +++++ include/hw/intc/heathrow_pic.h | 1 + 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/hw/intc/heathrow_pic.c b/hw/intc/heathrow_pic.c index 7bf44e0d86..afe0b08cbb 100644 --- a/hw/intc/heathrow_pic.c +++ b/hw/intc/heathrow_pic.c @@ -26,16 +26,7 @@ #include "hw/hw.h" #include "hw/ppc/mac.h" #include "hw/intc/heathrow_pic.h" - -/* debug PIC */ -//#define DEBUG_PIC - -#ifdef DEBUG_PIC -#define PIC_DPRINTF(fmt, ...) \ - do { printf("PIC: " fmt , ## __VA_ARGS__); } while (0) -#else -#define PIC_DPRINTF(fmt, ...) -#endif +#include "trace.h" =20 static inline int heathrow_check_irq(HeathrowPICState *pic) { @@ -61,7 +52,7 @@ static void heathrow_write(void *opaque, hwaddr addr, unsigned int n; =20 n =3D ((addr & 0xfff) - 0x10) >> 4; - PIC_DPRINTF("writel: " TARGET_FMT_plx " %u: %08x\n", addr, n, value); + trace_heathrow_write(addr, n, value); if (n >=3D 2) return; pic =3D &s->pics[n]; @@ -109,7 +100,7 @@ static uint64_t heathrow_read(void *opaque, hwaddr addr, break; } } - PIC_DPRINTF("readl: " TARGET_FMT_plx " %u: %08x\n", addr, n, value); + trace_heathrow_read(addr, n, value); return value; } =20 @@ -124,16 +115,18 @@ static void heathrow_set_irq(void *opaque, int num, i= nt level) HeathrowState *s =3D opaque; HeathrowPICState *pic; unsigned int irq_bit; + int last_level =3D (s->last_levels & (num << 1UL)) ? 1 : 0; =20 -#if defined(DEBUG) - { - static int last_level[64]; - if (last_level[num] !=3D level) { - PIC_DPRINTF("set_irq: num=3D0x%02x level=3D%d\n", num, level); - last_level[num] =3D level; + if (last_level !=3D level) { + trace_heathrow_set_irq(num, level); + + if (level) { + s->last_levels |=3D (num << 1UL); + } else { + s->last_levels &=3D ~(num << 1UL); } } -#endif + pic =3D &s->pics[1 - (num >> 5)]; irq_bit =3D 1 << (num & 0x1f); if (level) { diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 4092d2825e..55e8c2570c 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -186,3 +186,8 @@ nvic_complete_irq(int irq, bool secure) "NVIC complete = IRQ %d (secure %d)" nvic_set_irq_level(int irq, int level) "NVIC external irq %d level set to = %d" nvic_sysreg_read(uint64_t addr, uint32_t value, unsigned size) "NVIC sysre= g read addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u" nvic_sysreg_write(uint64_t addr, uint32_t value, unsigned size) "NVIC sysr= eg write addr 0x%" PRIx64 " data 0x%" PRIx32 " size %u" + +# hw/intc/heathrow_pic.c +heathrow_write(uint64_t addr, unsigned int n, uint64_t value) "0x%"PRIx64"= %u: 0x%"PRIx64 +heathrow_read(uint64_t addr, unsigned int n, uint64_t value) "0x%"PRIx64" = %u: 0x%"PRIx64 +heathrow_set_irq(int num, int level) "set_irq: num=3D0x%02x level=3D%d" diff --git a/include/hw/intc/heathrow_pic.h b/include/hw/intc/heathrow_pic.h index bc3ffaab87..878a0f7cdb 100644 --- a/include/hw/intc/heathrow_pic.h +++ b/include/hw/intc/heathrow_pic.h @@ -42,6 +42,7 @@ typedef struct HeathrowState { MemoryRegion mem; HeathrowPICState pics[2]; qemu_irq *irqs; + uint64_t last_levels; } HeathrowState; =20 #define HEATHROW_NUM_IRQS 64 --=20 2.11.0