@samitouri / QOSamiQemu / commits / c6f9b1dc95

hw/nmi: Raise NMI line only once

We only expect one device in the system to implement the TYPE_NMI interface (typically the machine, but in a few cases for e.g. m68k and ppc this is an interrupt controller or similar device); so we don't need to keep walking the whole QOM tree once we've found it. As no machine type creates more than one object implementing TYPE_NMI, this is not a behaviour change. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20260812121232.71958-8-philmd@oss.qualcomm.com>

Philippe Mathieu-Daudé committed Aug 11, 2026 at 12:43 UTC c6f9b1dc9564760959e915665d1b4f5d61105be4
1 file changed +5
hw/core/nmi.c
+5
@@ -31,6 +31,11 @@ static int do_nmi(Object *o, void *opaque)
31 if (n) {
32 *handled = true;
33 NMI_GET_CLASS(n)->raise_nmi(n);
34 + /*
35 + * We expect only one object to implement TYPE_NMI, so once
36 + * we've asked it to deliver the NMI we can stop looking.
37 + */
38 + return 1;
39 }
40
41 return 0;