aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBernhard Beschow <shentey@gmail.com>2024-01-08 00:16:23 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-01-19 12:28:59 +0100
commitebd92d6de37eacd109cf320ca8ece7a0f5a243ae (patch)
treeb7ca03340f15d54e023c28a441896d4e84a7ae79 /hw
parentc8cdec74e6214d52f1924f9db09cab8c2c4ad150 (diff)
downloadqemu-ebd92d6de37eacd109cf320ca8ece7a0f5a243ae.zip
qemu-ebd92d6de37eacd109cf320ca8ece7a0f5a243ae.tar.gz
qemu-ebd92d6de37eacd109cf320ca8ece7a0f5a243ae.tar.bz2
hw/i386/pc_piix: Make piix_intx_routing_notifier_xen() more device independent
This is a follow-up on commit 89965db43cce "hw/isa/piix3: Avoid Xen-specific variant of piix3_write_config()" which introduced piix_intx_routing_notifier_xen(). This function is implemented in board code but accesses the PCI configuration space of the PIIX ISA function to determine the PCI interrupt routes. Avoid this by reusing pci_device_route_intx_to_irq() which makes piix_intx_routing_notifier_xen() more device-agnostic. One remaining improvement would be making piix_intx_routing_notifier_xen() agnostic towards the number of PCI interrupt routes and move it to xen-hvm. This might be useful for possible Q35 Xen efforts but remains a future exercise for now. Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240107231623.5282-1-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/i386/pc_piix.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 042c13c..abfcfe4 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -92,13 +92,10 @@ static void piix_intx_routing_notifier_xen(PCIDevice *dev)
{
int i;
- /* Scan for updates to PCI link routes (0x60-0x63). */
+ /* Scan for updates to PCI link routes. */
for (i = 0; i < PIIX_NUM_PIRQS; i++) {
- uint8_t v = dev->config_read(dev, PIIX_PIRQCA + i, 1);
- if (v & 0x80) {
- v = 0;
- }
- v &= 0xf;
+ const PCIINTxRoute route = pci_device_route_intx_to_irq(dev, i);
+ const uint8_t v = route.mode == PCI_INTX_ENABLED ? route.irq : 0;
xen_set_pci_link_route(i, v);
}
}