qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 064/126] hw/isa: Factor isa_bus_get_irq() out of isa_get_irq()
Date: Mon, 27 Feb 2023 15:01:11 +0100	[thread overview]
Message-ID: <20230227140213.35084-55-philmd@linaro.org> (raw)
In-Reply-To: <20230227140213.35084-1-philmd@linaro.org>

isa_get_irq() was added in commit 3a38d437ca
("Add isa_reserve_irq()" Fri Aug 14 11:36:15 2009) as:

    a temporary interface to be used to allocate ISA IRQs for
    devices which have not yet been converted to qdev, and for
    special cases which are not suited for qdev conversions,
    such as the 'ferr'.

We still use it 14 years later, using the global 'isabus'
singleton. In order to get rid of such *temporary* interface,
extract isa_bus_get_irq() which can take any ISABus* object.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230215161641.32663-3-philmd@linaro.org>
---
 hw/isa/isa-bus.c     | 14 ++++++++++----
 include/hw/isa/isa.h |  8 ++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index 80d8fb4c5b..a289eccfb1 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -72,6 +72,13 @@ void isa_bus_register_input_irqs(ISABus *bus, qemu_irq *irqs_in)
     bus->irqs_in = irqs_in;
 }
 
+qemu_irq isa_bus_get_irq(ISABus *bus, unsigned irqnum)
+{
+    assert(irqnum < ISA_NUM_IRQS);
+    assert(bus->irqs_in);
+    return bus->irqs_in[irqnum];
+}
+
 /*
  * isa_get_irq() returns the corresponding input qemu_irq entry for the i8259.
  *
@@ -81,14 +88,13 @@ void isa_bus_register_input_irqs(ISABus *bus, qemu_irq *irqs_in)
 qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq)
 {
     assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus);
-    assert(isairq < ISA_NUM_IRQS);
-    return isabus->irqs_in[isairq];
+    return isa_bus_get_irq(isabus, isairq);
 }
 
 void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq)
 {
-    qemu_irq irq = isa_get_irq(isadev, isairq);
-    qdev_connect_gpio_out(DEVICE(isadev), gpioirq, irq);
+    qemu_irq input_irq = isa_get_irq(isadev, isairq);
+    qdev_connect_gpio_out(DEVICE(isadev), gpioirq, input_irq);
 }
 
 void isa_bus_dma(ISABus *bus, IsaDma *dma8, IsaDma *dma16)
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index 3a60f6afa6..40d6224a4e 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -72,6 +72,14 @@ ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space,
 void isa_bus_register_input_irqs(ISABus *bus, qemu_irq *irqs_in);
 void isa_bus_dma(ISABus *bus, IsaDma *dma8, IsaDma *dma16);
 IsaDma *isa_bus_get_dma(ISABus *bus, int nchan);
+/**
+ * isa_bus_get_irq: Return input IRQ on ISA bus.
+ * @bus: the #ISABus to plug ISA devices on.
+ * @irqnum: the ISA IRQ number.
+ *
+ * Return IRQ @irqnum from the PIC associated on ISA @bus.
+ */
+qemu_irq isa_bus_get_irq(ISABus *bus, unsigned irqnum);
 ISADevice *isa_new(const char *name);
 ISADevice *isa_try_new(const char *name);
 bool isa_realize_and_unref(ISADevice *dev, ISABus *bus, Error **errp);
-- 
2.38.1



  parent reply	other threads:[~2023-02-27 14:45 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 14:00 [RESEND PULL 000/126] Buildsys / QOM / QDev / UI patches for 2023-02-27 Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 011/126] target/hppa: Extract system helpers to sys_helper.c Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 012/126] target/alpha: Remove obsolete STATUS document Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 013/126] target/loongarch/cpu: Remove unused "sysbus.h" header Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 014/126] target/loongarch/cpu: Restrict "memory.h" header to sysemu Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 015/126] target/ppc/internal: Restrict MMU declarations " Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 016/126] target/ppc/kvm: Remove unused "sysbus.h" header Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 017/126] target/ppc: Fix warning with clang-15 Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 018/126] target/riscv/cpu: Move Floating-Point fields closer Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 019/126] target/sparc/sysemu: Remove pointless CONFIG_USER_ONLY guard Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 020/126] target/xtensa/cpu: Include missing "memory.h" header Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 021/126] target/tricore: Remove unused fields from CPUTriCoreState Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 022/126] qom/object_interfaces: Fix QAPI headers included Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 023/126] trace: Do not try to include QMP commands in user emulation binaries Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 024/126] exec: Remove unused 'qemu/timer.h' timer Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 025/126] tcg: Silent -Wmissing-field-initializers warning Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 026/126] tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 027/126] accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 028/126] accel/xen: Remove dead code Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 029/126] accel/kvm: Silent -Wmissing-field-initializers warning Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 030/126] sysemu/kvm: Remove CONFIG_USER_ONLY guard Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 031/126] replay: Extract core API to 'exec/replay-core.h' Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 032/126] tests/unit: Restrict machine-smp.c test to system emulation Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 033/126] softmmu: Silent -Wmissing-field-initializers warning Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 034/126] softmmu: Extract watchpoint API from physmem.c Philippe Mathieu-Daudé
2023-03-23  8:54   ` Philippe Mathieu-Daudé
2023-03-23  9:00     ` David Hildenbrand
2023-02-27 14:00 ` [PULL 035/126] qemu/typedefs: Sort in case-insensitive alphabetical order (again) Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 036/126] hw/nubus/nubus-device: Fix memory leak in nubus_device_realize Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 037/126] hw/qdev: Constify DeviceState* argument of qdev_get_parent_bus() Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 038/126] hw/cpu: Extend CPUState::cluster_index documentation Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 039/126] hw/i386/x86: Reduce init_topo_info() scope Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 040/126] hw/i386/ich9: Rename Q35_MASK to ICH9_MASK Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 041/126] hw/isa/lpc_ich9: Unexport PIRQ functions Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 042/126] hw/isa/lpc_ich9: Eliminate ICH9LPCState::isa_bus Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 043/126] hw/i2c/smbus_ich9: Move ich9_smb_set_irq() in front of ich9_smbus_realize() Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 044/126] hw/i2c/smbus_ich9: Inline ich9_smb_init() and remove it Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 045/126] hw/i386/pc_q35: Allow for setting properties before realizing TYPE_ICH9_LPC_DEVICE Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 046/126] hw/isa/lpc_ich9: Connect PM stuff to LPC internally Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 047/126] hw/isa/lpc_ich9: Remove redundant ich9_lpc_reset() invocation Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 048/126] hw/i386/ich9: Remove redundant GSI_NUM_PINS Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 049/126] hw: Move ioapic*.h to intc/ Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 050/126] hw/i386/ich9: Clean up includes Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 051/126] hw: Move ich9.h to southbridge/ Philippe Mathieu-Daudé
2023-02-27 14:00 ` [PULL 052/126] hw/pci: Fix a typo Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 053/126] hw/intc/i8259: Document i8259_init() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 054/126] hw/isa/i82378: Rename output IRQ as 'cpu_intr' Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 055/126] hw/isa/i82378: Remove intermediate IRQ forwarder Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 056/126] hw/isa/vt82c686: " Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 057/126] hw/sparc64/sun4u: Keep reference to ISA input IRQs in EbusState Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 058/126] hw/isa: Remove empty ISADeviceClass structure Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 059/126] hw/isa: Reorder to separate ISABus* vs ISADevice* functions Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 060/126] hw/isa: Un-inline isa_bus_from_device() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 061/126] hw/isa: Rename isa_bus_irqs() -> isa_bus_register_input_irqs() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 062/126] hw/isa: Use isa_address_space_io() to reduce access on global 'isabus' Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 063/126] hw/isa: Rename isa_get_dma() -> isa_bus_get_dma() Philippe Mathieu-Daudé
2023-02-27 14:01 ` Philippe Mathieu-Daudé [this message]
2023-02-27 14:01 ` [PULL 065/126] hw: Replace isa_get_irq() by isa_bus_get_irq() when ISABus is available Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 066/126] hw/rtc/mc146818rtc: Rename RTCState -> MC146818RtcState Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 067/126] hw/rtc/mc146818rtc: Pass MC146818RtcState instead of ISADevice argument Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 068/126] hw/rtc: Rename rtc_[get|set]_memory -> mc146818rtc_[get|set]_cmos_data Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 069/126] hw/timer/hpet: Include missing 'hw/qdev-properties.h' header Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 070/126] hw/audio/hda-codec: Avoid forward-declaring HDAAudioState Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 071/126] hw/audio/es1370: Avoid forward-declaring ES1370State Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 072/126] hw/audio/es1370: Replace container_of() by ES1370() QOM cast macro Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 073/126] hw/audio/ac97: Replace container_of() by AC97() " Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 074/126] hw/audio/ac97: Split off some definitions to a header Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 075/126] hw/usb/dev-smartcard-reader: Avoid forward-declaring CCIDBus Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 076/126] hw/usb/u2f: Declare QOM macros using OBJECT_DECLARE_TYPE() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 077/126] hw/usb/ohci: Include missing 'sysbus.h' header Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 078/126] hw/usb/ohci: Use OHCIState type definition Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 079/126] hw/usb/ohci: Code style fix comments Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 080/126] hw/usb/ohci: Code style fix white space errors Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 081/126] hw/usb/ohci: Code style fix missing braces and extra parenthesis Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 082/126] hw/usb/ohci: Move a function next to where it is used Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 083/126] hw/usb/ohci: Add trace points for register access Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 084/126] hw/usb/ohci: Fix typo Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 085/126] hw/usb/uhci: Declare QOM macros using OBJECT_DECLARE_TYPE() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 086/126] hw/usb/uhci: Replace container_of() by UHCI_GET_CLASS() QOM macro Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 087/126] hw/usb/xhci-nec: Declare QOM macros for NEC_XHCI Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 088/126] hw/usb/xhci-nec: Replace container_of() by NEC_XHCI() QOM cast macro Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 089/126] hw/display/sm501: Embed OHCI QOM child in chipset Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 090/126] hw/display/sm501: Alias 'dma-offset' QOM property in chipset object Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 091/126] hw/display/sm501: Implement more 2D raster operations Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 092/126] hw/display/sm501: Add fallbacks to pixman routines Philippe Mathieu-Daudé
2023-04-04 17:44   ` Peter Maydell
2023-04-04 19:25     ` BALATON Zoltan
2023-04-04 20:12       ` Peter Maydell
2023-02-27 14:01 ` [PULL 093/126] hw/ppc/sam460ex: Correctly set MAL properties Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 094/126] block/vvfat: Remove pointless check of NDEBUG Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 095/126] scripts/checkpatch.pl: Do not allow assert(0) Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 096/126] MAINTAINERS: Mark IDE and Floppy as "Odd Fixes" Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 097/126] hw/i386/xen: Remove unused 'hw/ide.h' include from header Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 098/126] hw/ide/ahci: Trace ncq write command as write instead of read Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 099/126] hw/ide/mmio: Use CamelCase for MMIO_IDE state name Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 100/126] hw/ide/mmio: Extract TYPE_MMIO_IDE declarations to 'hw/ide/mmio.h' Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 101/126] hw/ide/isa: Extract TYPE_ISA_IDE declarations to 'hw/ide/isa.h' Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 102/126] hw/ide/isa: Remove intermediate ISAIDEState::irq variable Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 103/126] hw/ide/atapi: Restrict 'scsi/constants.h' inclusion Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 104/126] hw/ide: Remove unused 'qapi/qapi-types-run-state.h' Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 105/126] hw/ide: Include 'exec/ioport.h' instead of 'hw/isa/isa.h' Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 106/126] hw/ide: Un-inline ide_set_irq() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 107/126] hw/ide: Rename ide_set_irq() -> ide_bus_set_irq() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 108/126] hw/ide: Rename ide_create_drive() -> ide_bus_create_drive() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 109/126] hw/ide: Rename ide_register_restart_cb -> ide_bus_register_restart_cb Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 110/126] hw/ide: Rename ide_exec_cmd() -> ide_bus_exec_cmd() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 111/126] hw/ide: Rename ide_init2() -> ide_bus_init_output_irq() Philippe Mathieu-Daudé
2023-02-27 14:01 ` [PULL 112/126] hw/ide: Rename idebus_active_if() -> ide_bus_active_if() Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 113/126] hw/ide: Declare ide_get_[geometry/bios_chs_trans] in 'hw/ide/internal.h' Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 114/126] hw/ide/ioport: Remove unnecessary includes Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 115/126] hw/ide/pci: Unexport bmdma_active_if() Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 116/126] hw/ide/piix: Remove unused includes Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 117/126] hw/ide/piix: Pass Error* to pci_piix_init_ports() for better error msg Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 118/126] hw/ide/piix: Refactor pci_piix_init_ports as pci_piix_init_bus per bus Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 119/126] hw/ide/via: Replace magic 2 value by ARRAY_SIZE / MAX_IDE_DEVS Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 120/126] hw/ide/pci: Add PCIIDEState::isa_irq[] Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 121/126] dump: Replace tswapN() -> cpu_to_dumpN() Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 122/126] dump: Replace TARGET_PAGE_SIZE -> qemu_target_page_size() Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 123/126] dump: Clean included headers Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 124/126] dump: Simplify compiling win_dump.o by introducing win_dump_available() Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 125/126] dump: Add create_win_dump() stub for non-x86 targets Philippe Mathieu-Daudé
2023-02-27 14:02 ` [PULL 126/126] ui/cocoa: user friendly characters for release mouse Philippe Mathieu-Daudé
2023-02-27 18:22 ` [RESEND PULL 000/126] Buildsys / QOM / QDev / UI patches for 2023-02-27 Peter Maydell
2023-02-27 21:26   ` Philippe Mathieu-Daudé

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=20230227140213.35084-55-philmd@linaro.org \
    --to=philmd@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).