On Tue, 11 Aug 2026 at 11:55, Philippe Mathieu-Daudé
<[email protected]> wrote:
>
> Use the first handler available to deliver NMI only once.
> If anothers handlers are available, no need to keep delivering.
>
> Suggested-by: Peter Maydell <[email protected]>
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
>  hw/core/nmi.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/core/nmi.c b/hw/core/nmi.c
> index 8eea75ad530..4fe5ee75bfc 100644
> --- a/hw/core/nmi.c
> +++ b/hw/core/nmi.c
> @@ -31,6 +31,8 @@ static int do_nmi(Object *o, void *opaque)
>      if (n) {
>          *handled = true;
>          NMI_GET_CLASS(n)->deliver_nmi(n);
> +        /* We only need to deliver NMI once */
> +        return 1;
>      }
>
>      return 0;

Looking back at my review comments on v1 of this series,
I think we could clarify the comment / commit message a bit.
Commit message:

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.

and comment:

 /*
  * We expect only one object to implement TYPE_NMI, so once
  * we've asked it to deliver the NMI we can stop looking.
  */

With that

Reviewed-by: Peter Maydell <[email protected]>

thanks
-- PMM

Reply via email to