Commit c6f9b1dc95 for qemu.org

commit c6f9b1dc9564760959e915665d1b4f5d61105be4
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date:   Tue Aug 11 12:43:06 2026 +0200

    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>

diff --git a/hw/core/nmi.c b/hw/core/nmi.c
index c44b0cf892..84f2166598 100644
--- a/hw/core/nmi.c
+++ b/hw/core/nmi.c
@@ -31,6 +31,11 @@ static int do_nmi(Object *o, void *opaque)
     if (n) {
         *handled = true;
         NMI_GET_CLASS(n)->raise_nmi(n);
+        /*
+         * We expect only one object to implement TYPE_NMI, so once
+         * we've asked it to deliver the NMI we can stop looking.
+         */
+        return 1;
     }

     return 0;