[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 47/83] hw/i386/pc_piix: Wire PIIX3's ISA interrupts by new "isa-ir
From: |
Michael S. Tsirkin |
Subject: |
[PULL 47/83] hw/i386/pc_piix: Wire PIIX3's ISA interrupts by new "isa-irqs" property |
Date: |
Wed, 18 Oct 2023 11:56:54 -0400 |
From: Bernhard Beschow <shentey@gmail.com>
Avoid assigning the private member of struct PIIX3State from outside which goes
against best QOM practices. Instead, implement best QOM practice by adding an
"isa-irqs" array property to TYPE_PIIX3_DEVICE and assign it in board code, i.e.
from outside.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20231007123843.127151-6-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/southbridge/piix.h | 2 +-
hw/i386/pc_piix.c | 7 ++++++-
hw/isa/piix3.c | 2 ++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h
index 2317bb7974..bb898c6c88 100644
--- a/include/hw/southbridge/piix.h
+++ b/include/hw/southbridge/piix.h
@@ -46,7 +46,7 @@ struct PIIXState {
#endif
uint64_t pic_levels;
- qemu_irq *pic;
+ qemu_irq pic[ISA_NUM_IRQS];
/* This member isn't used. Just for save/load compatibility */
int32_t pci_irq_levels_vmstate[PIIX_NUM_PIRQS];
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index a003923788..4dc7298c15 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -263,10 +263,15 @@ static void pc_init1(MachineState *machine,
if (pcmc->pci_enabled) {
PIIX3State *piix3;
PCIDevice *pci_dev;
+ DeviceState *dev;
+ size_t i;
pci_dev = pci_new_multifunction(-1, TYPE_PIIX3_DEVICE);
piix3 = PIIX3_PCI_DEVICE(pci_dev);
- piix3->pic = x86ms->gsi;
+ dev = DEVICE(pci_dev);
+ for (i = 0; i < ISA_NUM_IRQS; i++) {
+ qdev_connect_gpio_out_named(dev, "isa-irqs", i, x86ms->gsi[i]);
+ }
pci_realize_and_unref(pci_dev, pci_bus, &error_fatal);
if (xen_enabled()) {
diff --git a/hw/isa/piix3.c b/hw/isa/piix3.c
index 7240c91440..c17547a2c0 100644
--- a/hw/isa/piix3.c
+++ b/hw/isa/piix3.c
@@ -312,6 +312,8 @@ static void pci_piix3_init(Object *obj)
{
PIIX3State *d = PIIX3_PCI_DEVICE(obj);
+ qdev_init_gpio_out_named(DEVICE(obj), d->pic, "isa-irqs", ISA_NUM_IRQS);
+
object_initialize_child(obj, "rtc", &d->rtc, TYPE_MC146818_RTC);
}
--
MST
- [PULL 31/83] vhost-user: factor out "vhost_user_write_sync", (continued)
- [PULL 31/83] vhost-user: factor out "vhost_user_write_sync", Michael S. Tsirkin, 2023/10/18
- [PULL 25/83] tests: bios-tables-test: Add ACPI table binaries for smbios type4 thread count test, Michael S. Tsirkin, 2023/10/18
- [PULL 30/83] vhost-user: tighten "reply_supported" scope in "set_vring_addr", Michael S. Tsirkin, 2023/10/18
- [PULL 34/83] vhost-user: allow "vhost_set_vring" to wait for a reply, Michael S. Tsirkin, 2023/10/18
- [PULL 35/83] vhost-user: call VHOST_USER_SET_VRING_ENABLE synchronously, Michael S. Tsirkin, 2023/10/18
- [PULL 38/83] vhost-backend: remove vhost_kernel_reset_device(), Michael S. Tsirkin, 2023/10/18
- [PULL 39/83] virtio: call ->vhost_reset_device() during reset, Michael S. Tsirkin, 2023/10/18
- [PULL 43/83] hw/i386/pc: Merge two if statements into one, Michael S. Tsirkin, 2023/10/18
- [PULL 46/83] hw/isa/piix3: Resolve redundant PIIX_NUM_PIC_IRQS, Michael S. Tsirkin, 2023/10/18
- [PULL 45/83] hw/i386/pc_piix: Assign PIIX3's ISA interrupts before its realize(), Michael S. Tsirkin, 2023/10/18
- [PULL 47/83] hw/i386/pc_piix: Wire PIIX3's ISA interrupts by new "isa-irqs" property,
Michael S. Tsirkin <=
- [PULL 49/83] hw/isa/piix3: Rename "pic" attribute to "isa_irqs_in", Michael S. Tsirkin, 2023/10/18
- [PULL 53/83] hw/isa/piix3: Create IDE controller in host device, Michael S. Tsirkin, 2023/10/18
- [PULL 58/83] hw/isa/piix4: Rename "isa" attribute to "isa_irqs_in", Michael S. Tsirkin, 2023/10/18
- [PULL 54/83] hw/isa/piix3: Create USB controller in host device, Michael S. Tsirkin, 2023/10/18
- [PULL 57/83] hw/isa/piix4: Remove unused inbound ISA interrupt lines, Michael S. Tsirkin, 2023/10/18
- [PULL 59/83] hw/isa/piix4: Rename reset control operations to match PIIX3, Michael S. Tsirkin, 2023/10/18
- [PULL 61/83] hw/isa/piix3: Merge hw/isa/piix4.c, Michael S. Tsirkin, 2023/10/18
- [PULL 56/83] hw/isa/piix3: Drop the "3" from PIIX base class name, Michael S. Tsirkin, 2023/10/18
- [PULL 62/83] hw/isa/piix: Allow for optional PIC creation in PIIX3, Michael S. Tsirkin, 2023/10/18
- [PULL 55/83] hw/isa/piix3: Create power management controller in host device, Michael S. Tsirkin, 2023/10/18