From nobody Wed Oct 22 13:13:33 2025 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519850307105954.1567470482165; Wed, 28 Feb 2018 12:38:27 -0800 (PST) Received: from localhost ([::1]:46732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er8Ub-0004fR-QX for importer@patchew.org; Wed, 28 Feb 2018 15:38:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er8PZ-0000ZK-S2 for qemu-devel@nongnu.org; Wed, 28 Feb 2018 15:33:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er8PX-00024U-2Q for qemu-devel@nongnu.org; Wed, 28 Feb 2018 15:33:13 -0500 Received: from chuckie.co.uk ([82.165.15.123]:58472 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 1er8PW-0001yq-N0; Wed, 28 Feb 2018 15:33:10 -0500 Received: from host109-151-5-120.range109-151.btcentralplus.com ([109.151.5.120] 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 1er8Pc-0003Ba-PQ; Wed, 28 Feb 2018 20:33:17 +0000 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, david@gibson.dropbear.id.au Date: Wed, 28 Feb 2018 20:32:35 +0000 Message-Id: <20180228203243.1413-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180228203243.1413-1-mark.cave-ayland@ilande.co.uk> References: <20180228203243.1413-1-mark.cave-ayland@ilande.co.uk> X-SA-Exim-Connect-IP: 109.151.5.120 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] [PATCHv3 04/12] 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 | 32 +++++++++++--------------------- hw/intc/trace-events | 5 +++++ 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/hw/intc/heathrow_pic.c b/hw/intc/heathrow_pic.c index 7bf44e0d86..5fd2b33a12 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,24 +115,23 @@ 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; =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; - } - } -#endif pic =3D &s->pics[1 - (num >> 5)]; irq_bit =3D 1 << (num & 0x1f); + last_level =3D (pic->levels & irq_bit) ? 1 : 0; + if (level) { pic->events |=3D irq_bit & ~pic->level_triggered; pic->levels |=3D irq_bit; } else { pic->levels &=3D ~irq_bit; } + + if (last_level !=3D level) { + trace_heathrow_set_irq(num, level); + } + heathrow_update_irq(s); } =20 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" --=20 2.11.0