mbox series

[RFC,0/3] Decouple INTx-to-LNKx routing from south bridges

Message ID 20221116185500.84019-1-shentey@gmail.com (mailing list archive)
Headers show
Series Decouple INTx-to-LNKx routing from south bridges | expand

Message

Bernhard Beschow Nov. 16, 2022, 6:54 p.m. UTC
During my PIIX consolidation work [1] I've noticed that both PIIX models have
quite different pci_slot_get_pirq() implementations. These functions seem to
map PCI INTx pins to input pins of a programmable interrupt router which is
AFAIU board-specific. IOW, board-specific assumptions are baked into the device
models which prevent e.g. the whole PIIX4 south bridge to be reusable in the PC
machine.

In this series, I've moved the pci_slot_get_pirq() implementations into their
respective boards. This required a hack, however, thus this RFC. The issue is
that pci_slot_get_pirq() can only be assigned using pci_bus_irqs() which also
wants a pci_set_irq_fn. That function is in turn device-specific.

Futhermore, the issue does not only affect PIIX but also the VIA south bridges
as demonstrated in the last patch. Any advice for an upstreamable solution would
be highly appreciated.

Testing done:
* `make check`
* `make check-avocado`
* `qemu-system-ppc -machine pegasos2 -rtc base=localtime -device ati-vga,guest_hwcursor=true,romfile="" -cdrom morphos-3.17.iso -kernel morphos-3.17/boot.img -serial stdio`
* `qemu-system-mips64el -M malta -kernel vmlinux-3.2.0-4-5kc-malta -hda debian_wheezy_mipsel_standard.qcow2 -append "root=/dev/sda1 console=ttyS0"`
* `qemu-system-x86_64 -M pc -m 2G -cdrom manjaro-kde-21.3.2-220704-linux515.iso`

Thanks,
Bernhard

[1] https://lists.nongnu.org/archive/html/qemu-devel/2022-10/msg03941.html

Bernhard Beschow (3):
  hw/isa/piix3: Decouple INTx-to-LNKx routing which is board-specific
  hw/isa/piix4: Decouple INTx-to-LNKx routing which is board-specific
  hw/isa/vt82c686: Implement PIRQ routing

 hw/i386/pc_piix.c | 17 +++++++++++++++++
 hw/isa/piix3.c    | 16 +++-------------
 hw/isa/piix4.c    | 28 ++--------------------------
 hw/isa/vt82c686.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 hw/mips/malta.c   | 29 +++++++++++++++++++++++++++++
 5 files changed, 97 insertions(+), 39 deletions(-)