From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Akihiko Odaki" <akihiko.odaki@daynix.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 17/22] hw/ide/macio: switch from using qemu_allocate_irq() to qdev input GPIOs
Date: Tue, 2 Jul 2024 07:01:07 +0200 [thread overview]
Message-ID: <20240702050112.35907-18-philmd@linaro.org> (raw)
In-Reply-To: <20240702050112.35907-1-philmd@linaro.org>
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This prevents the IRQs from being leaked when the macio IDE device is used.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240628160334.653168-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/misc/macio/macio.h | 7 +++++--
hw/ide/macio.c | 10 ++++++----
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h
index 2b54da6b31..16aa95b876 100644
--- a/include/hw/misc/macio/macio.h
+++ b/include/hw/misc/macio/macio.h
@@ -80,8 +80,6 @@ struct MACIOIDEState {
uint32_t channel;
qemu_irq real_ide_irq;
qemu_irq real_dma_irq;
- qemu_irq ide_irq;
- qemu_irq dma_irq;
MemoryRegion mem;
IDEBus bus;
@@ -92,6 +90,11 @@ struct MACIOIDEState {
uint32_t irq_reg;
};
+#define MACIO_IDE_PMAC_NIRQS 2
+
+#define MACIO_IDE_PMAC_DMA_IRQ 0
+#define MACIO_IDE_PMAC_IDE_IRQ 1
+
void macio_ide_init_drives(MACIOIDEState *ide, DriveInfo **hd_table);
void macio_ide_register_dma(MACIOIDEState *ide);
diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index aca90d04f0..e84bf2c9f6 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -420,7 +420,8 @@ static void macio_ide_realizefn(DeviceState *dev, Error **errp)
{
MACIOIDEState *s = MACIO_IDE(dev);
- ide_bus_init_output_irq(&s->bus, s->ide_irq);
+ ide_bus_init_output_irq(&s->bus,
+ qdev_get_gpio_in(dev, MACIO_IDE_PMAC_IDE_IRQ));
/* Register DMA callbacks */
s->dma.ops = &dbdma_ops;
@@ -456,8 +457,8 @@ 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_ide_irq, s, 0);
- s->ide_irq = qemu_allocate_irq(pmac_ide_irq, s, 1);
+
+ qdev_init_gpio_in(DEVICE(obj), pmac_ide_irq, MACIO_IDE_PMAC_NIRQS);
object_property_add_link(obj, "dbdma", TYPE_MAC_DBDMA,
(Object **) &s->dbdma,
@@ -508,7 +509,8 @@ 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,
+ qdev_get_gpio_in(DEVICE(s), MACIO_IDE_PMAC_DMA_IRQ),
pmac_ide_transfer, pmac_ide_flush, s);
}
--
2.41.0
next prev parent reply other threads:[~2024-07-02 5:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 5:00 [PULL 00/22] Misc HW patches for 2024-07-02 Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 01/22] hw/net/spapr: prevent potential NULL dereference Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 02/22] include/hw: add helpers for defining versioned machine types Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 03/22] hw/arm: convert 'virt' machine definitions to use new macros Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 04/22] hw/s390x: convert 'ccw' " Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 05/22] hw/ppc: convert 'spapr' " Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 06/22] hw/m68k: convert 'virt' " Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 07/22] hw/i386: convert 'i440fx' " Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 08/22] hw/i386: convert 'q35' " Philippe Mathieu-Daudé
2024-07-02 5:00 ` [PULL 09/22] include/hw: add macros for deprecation & removal of versioned machines Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 10/22] include/hw: temporarily disable deletion of versioned machine types Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 11/22] hw: set deprecation info for all " Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 12/22] hw: skip registration of outdated " Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 13/22] hw/ppc: remove obsolete manual deprecation reason string of spapr machines Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 14/22] hw/i386: remove obsolete manual deprecation reason string of i440fx machines Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 15/22] docs: document special exception for machine type deprecation & removal Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 16/22] system/physmem: Fix reference to dump-guest-core Philippe Mathieu-Daudé
2024-07-02 5:01 ` Philippe Mathieu-Daudé [this message]
2024-07-02 5:01 ` [PULL 18/22] hvf: Drop ifdef for macOS versions older than 12.0 Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 19/22] audio: " Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 20/22] block/file-posix: " Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 21/22] net/vmnet: " Philippe Mathieu-Daudé
2024-07-02 5:01 ` [PULL 22/22] Remove inclusion of hw/hw.h from files that don't need it Philippe Mathieu-Daudé
2024-07-02 16:50 ` [PULL 00/22] Misc HW patches for 2024-07-02 Richard Henderson
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=20240702050112.35907-18-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=akihiko.odaki@daynix.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).