From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-s390x@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
"Corey Minyard" <minyard@acm.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Subject: [PATCH v4 1/7] hw/nmi: Use object_child_foreach_recursive() in nmi_children()
Date: Tue, 11 Aug 2026 17:49:24 +0200 [thread overview]
Message-ID: <20260811154930.13915-2-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260811154930.13915-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 15:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 15:49 [PATCH v4 0/7] hw/nmi: Disconnect of vCPU and disentangle Monitor code Philippe Mathieu-Daudé
2026-08-11 15:49 ` Philippe Mathieu-Daudé [this message]
2026-08-11 15:49 ` [PATCH v4 2/7] hw/s390x/virtio-ccw: Always inject NMI to first CPU Philippe Mathieu-Daudé
2026-08-11 20:53 ` Eric Farman
2026-08-12 12:28 ` Cornelia Huck
2026-08-11 15:49 ` [PATCH v4 3/7] hw/nmi: Remove @cpu_index argument from NMIClass::nmi_monitor_handler() Philippe Mathieu-Daudé
2026-08-11 15:49 ` [PATCH v4 4/7] hw/nmi: Remove @cpu_index argument from nmi_inject() Philippe Mathieu-Daudé
2026-08-11 16:38 ` Peter Maydell
2026-08-12 8:51 ` Philippe Mathieu-Daudé
2026-08-11 15:49 ` [PATCH v4 5/7] hw/nmi: Rename nmi_monitor_handler() -> raise_nmi() Philippe Mathieu-Daudé
2026-08-11 15:49 ` [PATCH v4 6/7] hw/nmi: Remove unused @errp argument from raise_nmi() Philippe Mathieu-Daudé
2026-08-11 16:34 ` Peter Maydell
2026-08-11 15:49 ` [PATCH v4 7/7] hw/nmi: Raise NMI line only once Philippe Mathieu-Daudé
2026-08-11 18:40 ` [PATCH v4 0/7] hw/nmi: Disconnect of vCPU and disentangle Monitor code marcandre.lureau
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=20260811154930.13915-2-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=armbru@redhat.com \
--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.