From: Jan Kiszka <[email protected]>

The only watchdog QEMU offers us on non-x86 virt platforms is the
i6300esb. This one is PCI-attached, but watchdog probing will happen
before PCI, so will miss it. Redo this late so that we gain autostart
support.

Deliberately limited to contemporary ARM and RISC-V.

Signed-off-by: Jan Kiszka <[email protected]>
---
 board/emulation/qemu-arm/qemu-arm.c     | 5 +++++
 board/emulation/qemu-riscv/qemu-riscv.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/board/emulation/qemu-arm/qemu-arm.c 
b/board/emulation/qemu-arm/qemu-arm.c
index 38f0ec5f2fb..529bffa3e49 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -14,6 +14,7 @@
 #include <usb.h>
 #include <virtio_types.h>
 #include <virtio.h>
+#include <wdt.h>
 
 #include <linux/kernel.h>
 #include <linux/sizes.h>
@@ -114,6 +115,10 @@ int board_late_init(void)
        if (CONFIG_IS_ENABLED(USB_KEYBOARD))
                usb_init();
 
+       /* watchdog may come via PCI but was probed too early */
+       if (CONFIG_IS_ENABLED(WDT))
+               initr_watchdog();
+
        return 0;
 }
 
diff --git a/board/emulation/qemu-riscv/qemu-riscv.c 
b/board/emulation/qemu-riscv/qemu-riscv.c
index ce5bc34ca71..5ed21b286ee 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -14,6 +14,7 @@
 #include <usb.h>
 #include <virtio_types.h>
 #include <virtio.h>
+#include <wdt.h>
 
 #if IS_ENABLED(CONFIG_MTD_NOR_FLASH)
 int is_flash_available(void)
@@ -38,6 +39,10 @@ int board_late_init(void)
         */
        virtio_init();
 
+       /* watchdog may come via PCI but was probed too early */
+       if (CONFIG_IS_ENABLED(WDT))
+               initr_watchdog();
+
        return 0;
 }
 
-- 
2.47.3

Reply via email to