From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: "Eduardo Habkost" <eduardo@habkost.net>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Yanan Wang" <wangyanan55@huawei.com>,
"John Snow" <jsnow@redhat.com>,
"BALATON Zoltan" <balaton@eik.bme.hu>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Peter Xu" <peterx@redhat.com>, "Fabiano Rosas" <farosas@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
qemu-ppc@nongnu.org, Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: [PATCH v2 03/15] hw/ide: Remove internal DMA qemu_irq
Date: Thu, 27 Jun 2024 22:37:46 +0900 [thread overview]
Message-ID: <20240627-san-v2-3-750bb0946dbd@daynix.com> (raw)
In-Reply-To: <20240627-san-v2-0-750bb0946dbd@daynix.com>
A function pointer is sufficient for internal usage. Replacing qemu_irq
with one fixes the leak of qemu_irq.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
include/hw/ppc/mac_dbdma.h | 5 +++--
hw/ide/macio.c | 11 +++++++----
hw/misc/macio/mac_dbdma.c | 10 +++++-----
3 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h
index 4a3f644516b3..1e1973c39580 100644
--- a/include/hw/ppc/mac_dbdma.h
+++ b/include/hw/ppc/mac_dbdma.h
@@ -32,6 +32,7 @@
typedef struct DBDMA_io DBDMA_io;
typedef void (*DBDMA_flush)(DBDMA_io *io);
+typedef void (*DBDMA_irq)(DBDMA_io *io);
typedef void (*DBDMA_rw)(DBDMA_io *io);
typedef void (*DBDMA_end)(DBDMA_io *io);
struct DBDMA_io {
@@ -154,7 +155,7 @@ typedef struct dbdma_cmd {
typedef struct DBDMA_channel {
int channel;
uint32_t regs[DBDMA_REGS];
- qemu_irq irq;
+ DBDMA_irq irq;
DBDMA_io io;
DBDMA_rw rw;
DBDMA_flush flush;
@@ -172,7 +173,7 @@ typedef struct DBDMAState DBDMAState;
/* Externally callable functions */
-void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,
+void DBDMA_register_channel(void *dbdma, int nchan, DBDMA_irq irq,
DBDMA_rw rw, DBDMA_flush flush,
void *opaque);
void DBDMA_kick(DBDMAState *dbdma);
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index 9c96a857a7c1..425b670a52a9 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -427,9 +427,8 @@ static void macio_ide_realizefn(DeviceState *dev, Error **errp)
s->bus.dma = &s->dma;
}
-static void pmac_irq(void *opaque, int n, int level)
+static void pmac_irq(MACIOIDEState *s, int n, int level)
{
- MACIOIDEState *s = opaque;
uint32_t mask = 0x80000000u >> n;
/* We need to reflect the IRQ state in the irq register */
@@ -446,6 +445,11 @@ static void pmac_irq(void *opaque, int n, int level)
}
}
+static void pmac_dma_irq(DBDMA_io *io)
+{
+ pmac_irq(io->opaque, 0, 1);
+}
+
static void pmac_ide_irq(void *opaque, int n, int level)
{
pmac_irq(opaque, 1, level);
@@ -461,7 +465,6 @@ static void macio_ide_initfn(Object *obj)
sysbus_init_mmio(d, &s->mem);
sysbus_init_irq(d, &s->real_ide_irq);
sysbus_init_irq(d, &s->real_dma_irq);
- s->dma_irq = qemu_allocate_irq(pmac_irq, s, 0);
qdev_init_gpio_in_named_with_opaque(DEVICE(obj), pmac_ide_irq, s, NULL, 1);
object_property_add_link(obj, "dbdma", TYPE_MAC_DBDMA,
@@ -513,7 +516,7 @@ void macio_ide_init_drives(MACIOIDEState *s, DriveInfo **hd_table)
void macio_ide_register_dma(MACIOIDEState *s)
{
- DBDMA_register_channel(s->dbdma, s->channel, s->dma_irq,
+ DBDMA_register_channel(s->dbdma, s->channel, pmac_dma_irq,
pmac_ide_transfer, pmac_ide_flush, s);
}
diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
index 2a528ea08caf..3450105ad851 100644
--- a/hw/misc/macio/mac_dbdma.c
+++ b/hw/misc/macio/mac_dbdma.c
@@ -114,7 +114,7 @@ static void kill_channel(DBDMA_channel *ch)
ch->regs[DBDMA_STATUS] |= DEAD;
ch->regs[DBDMA_STATUS] &= ~ACTIVE;
- qemu_irq_raise(ch->irq);
+ ch->irq(&ch->io);
}
static void conditional_interrupt(DBDMA_channel *ch)
@@ -133,7 +133,7 @@ static void conditional_interrupt(DBDMA_channel *ch)
case INTR_NEVER: /* don't interrupt */
return;
case INTR_ALWAYS: /* always interrupt */
- qemu_irq_raise(ch->irq);
+ ch->irq(&ch->io);
DBDMA_DPRINTFCH(ch, "%s: raise\n", __func__);
return;
}
@@ -148,13 +148,13 @@ static void conditional_interrupt(DBDMA_channel *ch)
switch(intr) {
case INTR_IFSET: /* intr if condition bit is 1 */
if (cond) {
- qemu_irq_raise(ch->irq);
+ ch->irq(&ch->io);
DBDMA_DPRINTFCH(ch, "%s: raise\n", __func__);
}
return;
case INTR_IFCLR: /* intr if condition bit is 0 */
if (!cond) {
- qemu_irq_raise(ch->irq);
+ ch->irq(&ch->io);
DBDMA_DPRINTFCH(ch, "%s: raise\n", __func__);
}
return;
@@ -562,7 +562,7 @@ void DBDMA_kick(DBDMAState *dbdma)
qemu_bh_schedule(dbdma->bh);
}
-void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,
+void DBDMA_register_channel(void *dbdma, int nchan, DBDMA_irq irq,
DBDMA_rw rw, DBDMA_flush flush,
void *opaque)
{
--
2.45.2
next prev parent reply other threads:[~2024-06-27 13:41 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-27 13:37 [PATCH v2 00/15] Fix check-qtest-ppc64 sanitizer errors Akihiko Odaki
2024-06-27 13:37 ` [PATCH v2 01/15] cpu: Free cpu_ases Akihiko Odaki
2024-06-28 15:12 ` Peter Maydell
2024-06-27 13:37 ` [PATCH v2 02/15] hw/ide: Convert macio ide_irq into GPIO line Akihiko Odaki
2024-06-28 7:19 ` Mark Cave-Ayland
2024-06-27 13:37 ` Akihiko Odaki [this message]
2024-06-28 7:23 ` [PATCH v2 03/15] hw/ide: Remove internal DMA qemu_irq Mark Cave-Ayland
2024-06-27 13:37 ` [PATCH v2 04/15] hw/isa/vt82c686: Define a GPIO line between vt82c686 and i8259 Akihiko Odaki
2024-06-28 7:27 ` Mark Cave-Ayland
2024-06-29 7:38 ` Akihiko Odaki
2024-06-29 8:04 ` Akihiko Odaki
2024-06-29 13:08 ` BALATON Zoltan
2024-07-01 10:32 ` Akihiko Odaki
2024-06-27 13:37 ` [PATCH v2 05/15] spapr: Free stdout path Akihiko Odaki
2024-06-27 13:37 ` [PATCH v2 06/15] ppc/vof: Fix unaligned FDT property access Akihiko Odaki
2024-06-28 15:20 ` Peter Maydell
2024-06-29 3:16 ` David Gibson
2024-07-04 11:54 ` Nicholas Piggin
2024-07-04 12:15 ` Peter Maydell
2024-07-05 1:18 ` Nicholas Piggin
2024-07-05 1:41 ` David Gibson
2024-07-05 4:40 ` Nicholas Piggin
2024-07-05 5:12 ` David Gibson
2024-07-05 7:50 ` Nicholas Piggin
2024-07-06 9:07 ` Akihiko Odaki
2024-07-06 10:37 ` Peter Maydell
2024-07-06 23:46 ` David Gibson
2024-07-08 7:49 ` Nicholas Piggin
2024-07-08 15:59 ` Peter Maydell
2024-07-09 7:46 ` David Gibson
2024-07-09 7:41 ` David Gibson
2024-07-05 1:33 ` David Gibson
2024-06-27 13:37 ` [PATCH v2 07/15] hw/virtio: Free vqs after vhost_dev_cleanup() Akihiko Odaki
2024-06-27 13:37 ` [PATCH v2 08/15] migration: Free removed SaveStateEntry Akihiko Odaki
2024-08-02 12:47 ` (subset) " Fabiano Rosas
2024-06-27 13:37 ` [PATCH v2 09/15] memory: Do not create circular reference with subregion Akihiko Odaki
2024-07-02 17:44 ` Peter Xu
2024-07-06 11:59 ` Akihiko Odaki
2024-07-08 8:06 ` Philippe Mathieu-Daudé
2024-07-08 8:41 ` Akihiko Odaki
2024-07-08 16:40 ` Peter Xu
2024-07-11 8:38 ` Akihiko Odaki
2024-08-22 17:10 ` Peter Maydell
2024-08-22 21:01 ` Peter Xu
2024-08-23 6:17 ` Akihiko Odaki
2024-06-27 13:37 ` [PATCH v2 10/15] tests/qtest: Use qtest_add_data_func_full() Akihiko Odaki
2024-07-02 6:14 ` Thomas Huth
2024-06-27 13:37 ` [PATCH v2 11/15] tests/qtest: Free unused QMP response Akihiko Odaki
2024-06-27 13:37 ` [PATCH v2 12/15] tests/qtest: Free old machine variable name Akihiko Odaki
2024-06-28 15:21 ` Peter Maydell
2024-06-27 13:37 ` [PATCH v2 13/15] tests/qtest: Delete previous boot file Akihiko Odaki
2024-07-02 7:31 ` Thomas Huth
2024-07-04 11:41 ` Akihiko Odaki
2024-06-27 13:37 ` [PATCH v2 14/15] tests/qtest: Free paths Akihiko Odaki
2024-06-27 13:37 ` [PATCH v2 15/15] tests/qtest: Free GThread Akihiko Odaki
2024-06-28 15:24 ` Peter Maydell
2024-07-01 20:11 ` [PATCH v2 00/15] Fix check-qtest-ppc64 sanitizer errors Michael S. Tsirkin
2024-07-01 22:23 ` BALATON Zoltan
2024-07-02 6:23 ` Thomas Huth
2024-07-04 11:37 ` Nicholas Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240627-san-v2-3-750bb0946dbd@daynix.com \
--to=akihiko.odaki@daynix.com \
--cc=aik@ozlabs.ru \
--cc=alex.bennee@linaro.org \
--cc=balaton@eik.bme.hu \
--cc=danielhb413@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=harshpb@linux.ibm.com \
--cc=jiaxun.yang@flygoat.com \
--cc=jsnow@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
--cc=wangyanan55@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).