From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-s390x@nongnu.org,
"Dr. David Alan Gilbert" <dave@treblig.org>,
"Thomas Huth" <thuth@redhat.com>,
qemu-ppc@nongnu.org, "Corey Minyard" <minyard@acm.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [PATCH v3 1/7] hw/nmi: Use object_child_foreach_recursive() in nmi_children()
Date: Tue, 11 Aug 2026 12:54:19 +0200 [thread overview]
Message-ID: <20260811105425.7429-2-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260811105425.7429-1-philmd@oss.qualcomm.com>
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Replace object_child_foreach() and recursion by a single
object_child_foreach_recursive() call.
Propagate the returned value so callers can check it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
hw/core/nmi.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/hw/core/nmi.c b/hw/core/nmi.c
index 4b447e126ba..22724046575 100644
--- a/hw/core/nmi.c
+++ b/hw/core/nmi.c
@@ -31,8 +31,6 @@ struct do_nmi_s {
bool handled;
};
-static void nmi_children(Object *o, struct do_nmi_s *ns);
-
static int do_nmi(Object *o, void *opaque)
{
struct do_nmi_s *ns = opaque;
@@ -47,14 +45,13 @@ static int do_nmi(Object *o, void *opaque)
return -1;
}
}
- nmi_children(o, ns);
return 0;
}
-static void nmi_children(Object *o, struct do_nmi_s *ns)
+static int nmi_children(Object *o, struct do_nmi_s *ns)
{
- object_child_foreach(o, do_nmi, ns);
+ return object_child_foreach_recursive(o, do_nmi, ns);
}
void nmi_monitor_handle(int cpu_index, Error **errp)
@@ -65,10 +62,9 @@ void nmi_monitor_handle(int cpu_index, Error **errp)
.handled = false
};
- nmi_children(object_get_root(), &ns);
- if (ns.handled) {
+ if (nmi_children(object_get_root(), &ns)) {
error_propagate(errp, ns.err);
- } else {
+ } else if (!ns.handled) {
error_setg(errp, "machine does not provide NMIs");
}
}
--
2.53.0
next prev parent reply other threads:[~2026-08-11 10:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 10:54 [PATCH v3 0/7] hw/nmi: Disconnect of vCPU and disentangle Monitor code Philippe Mathieu-Daudé
2026-08-11 10:54 ` Philippe Mathieu-Daudé [this message]
2026-08-11 10:54 ` [PATCH v3 2/7] hw/s390x/virtio-ccw: Always deliver NMI to first CPU Philippe Mathieu-Daudé
2026-08-11 10:54 ` [PATCH v3 3/7] hw/nmi: Remove @cpu_index argument from NMIClass::nmi_monitor_handler() Philippe Mathieu-Daudé
2026-08-11 13:21 ` Peter Maydell
2026-08-11 10:54 ` [PATCH v3 4/7] hw/nmi: Remove @cpu_index argument from nmi_trigger() Philippe Mathieu-Daudé
2026-08-11 11:10 ` Marc-André Lureau
2026-08-11 13:55 ` Philippe Mathieu-Daudé
2026-08-11 10:54 ` [PATCH v3 5/7] hw/nmi: Rename nmi_monitor_handler() -> deliver_nmi() Philippe Mathieu-Daudé
2026-08-11 10:54 ` [PATCH v3 6/7] hw/nmi: Remove unused @errp argument from deliver_nmi() Philippe Mathieu-Daudé
2026-08-11 13:24 ` Peter Maydell
2026-08-11 10:54 ` [PATCH v3 7/7] hw/nmi: Deliver NMI only once Philippe Mathieu-Daudé
2026-08-11 13:34 ` Peter Maydell
2026-08-11 14:09 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260811105425.7429-2-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=marcandre.lureau@redhat.com \
--cc=minyard@acm.org \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.