On 29/05/2022 20:06, Bernhard Beschow wrote:
Am 28. Mai 2022 09:19:29 UTC schrieb Mark Cave-Ayland
<mark.cave-ayl...@ilande.co.uk>:
Use the new piix4_pm_init() instance init function to initialise 2 separate qdev
gpios for the SCI and SMI IRQs.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk>
---
hw/acpi/piix4.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index d897d2dee6..454fa34df1 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -497,6 +497,14 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)
piix4_pm_add_properties(s);
}
+static void piix4_pm_init(Object *obj)
+{
+ PIIX4PMState *s = PIIX4_PM(obj);
+
+ qdev_init_gpio_out(DEVICE(obj), &s->irq, 1);
+ qdev_init_gpio_out_named(DEVICE(obj), &s->smi_irq, "smi-irq", 1);
+}
The two IRQs still get connected internally. Doesn't this create the risk of
double connections until patches 8 and 9 are applied?
No, that should be fine. Here the address of the IRQ is being made available as a
qdev gpio for use by qdev_connect_gpio_out(). Since that isn't being used yet, and
the 2 IRQs are still being set afterwards in piix4_pm_initfn(), everything should
still work just as before.
+
PIIX4PMState *piix4_pm_initfn(PCIBus *bus, int devfn, uint32_t smb_io_base,
qemu_irq sci_irq, qemu_irq smi_irq,
int smm_enabled)
@@ -663,6 +671,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void
*data)
static const TypeInfo piix4_pm_info = {
.name = TYPE_PIIX4_PM,
.parent = TYPE_PCI_DEVICE,
+ .instance_init = piix4_pm_init,
.instance_size = sizeof(PIIX4PMState),
.class_init = piix4_pm_class_init,
.interfaces = (InterfaceInfo[]) {
ATB,
Mark.