diff mbox series

[4/5] hw/pci-host/raven: Manually reset the OR_IRQ device

Message ID 20210424162229.3312116-5-f4bug@amsat.org (mailing list archive)
State New, archived
Headers show
Series hw: Fix reset of bus-less devices | expand

Commit Message

Philippe Mathieu-Daudé April 24, 2021, 4:22 p.m. UTC
The OR_IRQ device is bus-less, thus isn't reset automatically.
Add the raven_pcihost_reset() handler to manually reset the OR IRQ.

Fixes: f40b83a4e31 ("40p: use OR gate to wire up raven PCI interrupts")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/pci-host/prep.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

David Gibson April 27, 2021, 1:47 a.m. UTC | #1
On Sat, Apr 24, 2021 at 06:22:28PM +0200, Philippe Mathieu-Daudé wrote:
> The OR_IRQ device is bus-less, thus isn't reset automatically.
> Add the raven_pcihost_reset() handler to manually reset the OR IRQ.
> 
> Fixes: f40b83a4e31 ("40p: use OR gate to wire up raven PCI interrupts")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  hw/pci-host/prep.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
> index 0a9162fba97..275379e4c78 100644
> --- a/hw/pci-host/prep.c
> +++ b/hw/pci-host/prep.c
> @@ -230,6 +230,15 @@ static void raven_change_gpio(void *opaque, int n, int level)
>      s->contiguous_map = level;
>  }
>  
> +static void raven_pcihost_reset(DeviceState *dev)
> +{
> +    PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(dev);
> +
> +    if (!s->is_legacy_prep) {
> +        device_legacy_reset(DEVICE(&s->or_irq));
> +    }
> +}
> +
>  static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
>  {
>      SysBusDevice *dev = SYS_BUS_DEVICE(d);
> @@ -422,6 +431,7 @@ static void raven_pcihost_class_init(ObjectClass *klass, void *data)
>  
>      set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
>      dc->realize = raven_pcihost_realizefn;
> +    dc->reset = raven_pcihost_reset;
>      device_class_set_props(dc, raven_pcihost_properties);
>      dc->fw_name = "pci";
>  }
diff mbox series

Patch

diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c
index 0a9162fba97..275379e4c78 100644
--- a/hw/pci-host/prep.c
+++ b/hw/pci-host/prep.c
@@ -230,6 +230,15 @@  static void raven_change_gpio(void *opaque, int n, int level)
     s->contiguous_map = level;
 }
 
+static void raven_pcihost_reset(DeviceState *dev)
+{
+    PREPPCIState *s = RAVEN_PCI_HOST_BRIDGE(dev);
+
+    if (!s->is_legacy_prep) {
+        device_legacy_reset(DEVICE(&s->or_irq));
+    }
+}
+
 static void raven_pcihost_realizefn(DeviceState *d, Error **errp)
 {
     SysBusDevice *dev = SYS_BUS_DEVICE(d);
@@ -422,6 +431,7 @@  static void raven_pcihost_class_init(ObjectClass *klass, void *data)
 
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
     dc->realize = raven_pcihost_realizefn;
+    dc->reset = raven_pcihost_reset;
     device_class_set_props(dc, raven_pcihost_properties);
     dc->fw_name = "pci";
 }