[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/12] hw/isa/piix3: Wire up Xen PCI IRQ handling outside of PIIX3
From: |
Anthony PERARD |
Subject: |
[PULL 08/12] hw/isa/piix3: Wire up Xen PCI IRQ handling outside of PIIX3 |
Date: |
Wed, 7 Jun 2023 15:18:35 +0100 |
From: Bernhard Beschow <shentey@gmail.com>
xen_intx_set_irq() doesn't depend on PIIX3State. In order to resolve
TYPE_PIIX3_XEN_DEVICE and in order to make Xen agnostic about the
precise south bridge being used, set up Xen's PCI IRQ handling of PIIX3
in the board.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
Tested-by: Chuck Zmudzinski <brchuckz@aol.com>
Message-Id: <20230312120221.99183-4-shentey@gmail.com>
Message-Id: <20230403074124.3925-5-shentey@gmail.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
hw/i386/pc_piix.c | 13 +++++++++++++
hw/isa/piix3.c | 24 +-----------------------
2 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d5b0dcd1fe..11af191513 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -71,6 +71,7 @@
#include "kvm/kvm-cpu.h"
#define MAX_IDE_BUS 2
+#define XEN_IOAPIC_NUM_PIRQS 128ULL
#ifdef CONFIG_IDE_ISA
static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
@@ -238,6 +239,18 @@ static void pc_init1(MachineState *machine,
pcms->bus = pci_bus;
pci_dev = pci_create_simple_multifunction(pci_bus, -1, true, type);
+
+ if (xen_enabled()) {
+ /*
+ * Xen supports additional interrupt routes from the PCI devices to
+ * the IOAPIC: the four pins of each PCI device on the bus are also
+ * connected to the IOAPIC directly.
+ * These additional routes can be discovered through ACPI.
+ */
+ pci_bus_irqs(pci_bus, xen_intx_set_irq, pci_dev,
+ XEN_IOAPIC_NUM_PIRQS);
+ }
+
piix3 = PIIX3_PCI_DEVICE(pci_dev);
piix3->pic = x86ms->gsi;
piix3_devfn = piix3->dev.devfn;
diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
index 800b80f2bb..0b7e9ade0d 100644
--- a/hw/isa/piix3.c
+++ b/hw/isa/piix3.c
@@ -35,8 +35,6 @@
#include "migration/vmstate.h"
#include "hw/acpi/acpi_aml_interface.h"
-#define XEN_IOAPIC_NUM_PIRQS 128ULL
-
static void piix3_set_irq_pic(PIIX3State *piix3, int pic_irq)
{
qemu_set_irq(piix3->pic[pic_irq],
@@ -403,32 +401,12 @@ static const TypeInfo piix3_info = {
.class_init = piix3_class_init,
};
-static void piix3_xen_realize(PCIDevice *dev, Error **errp)
-{
- ERRP_GUARD();
- PIIX3State *piix3 = PIIX3_PCI_DEVICE(dev);
- PCIBus *pci_bus = pci_get_bus(dev);
-
- piix3_realize(dev, errp);
- if (*errp) {
- return;
- }
-
- /*
- * Xen supports additional interrupt routes from the PCI devices to
- * the IOAPIC: the four pins of each PCI device on the bus are also
- * connected to the IOAPIC directly.
- * These additional routes can be discovered through ACPI.
- */
- pci_bus_irqs(pci_bus, xen_intx_set_irq, piix3, XEN_IOAPIC_NUM_PIRQS);
-}
-
static void piix3_xen_class_init(ObjectClass *klass, void *data)
{
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
k->config_write = piix3_write_config_xen;
- k->realize = piix3_xen_realize;
+ k->realize = piix3_realize;
}
static const TypeInfo piix3_xen_info = {
--
Anthony PERARD
- [PULL 02/12] hw/xen: Fix memory leak in libxenstore_open() for Xen, (continued)
- [PULL 02/12] hw/xen: Fix memory leak in libxenstore_open() for Xen, Anthony PERARD, 2023/06/07
- [PULL 03/12] xen: Drop support for Xen versions below 4.7.1, Anthony PERARD, 2023/06/07
- [PULL 06/12] hw/pci/pci.c: Don't leak PCIBus::irq_count[] in pci_bus_irqs(), Anthony PERARD, 2023/06/07
- [PULL 04/12] hw/xen: Fix broken check for invalid state in xs_be_open(), Anthony PERARD, 2023/06/07
- [PULL 01/12] hw/xen: Simplify emulated Xen platform init, Anthony PERARD, 2023/06/07
- [PULL 07/12] hw/isa/piix3: Reuse piix3_realize() in piix3_xen_realize(), Anthony PERARD, 2023/06/07
- [PULL 09/12] hw/isa/piix3: Avoid Xen-specific variant of piix3_write_config(), Anthony PERARD, 2023/06/07
- [PULL 05/12] include/hw/xen/xen: Rename xen_piix3_set_irq() to xen_intx_set_irq(), Anthony PERARD, 2023/06/07
- [PULL 11/12] hw/isa/piix3: Resolve redundant TYPE_PIIX3_XEN_DEVICE, Anthony PERARD, 2023/06/07
- [PULL 12/12] xen-block: fix segv on unrealize, Anthony PERARD, 2023/06/07
- [PULL 08/12] hw/isa/piix3: Wire up Xen PCI IRQ handling outside of PIIX3,
Anthony PERARD <=
- [PULL 10/12] hw/isa/piix3: Resolve redundant k->config_write assignments, Anthony PERARD, 2023/06/07
- Re: [PULL 00/12] xen queue, Michael Tokarev, 2023/06/07
- Re: [PULL 00/12] xen queue, Richard Henderson, 2023/06/07