From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
qemu-s390x@nongnu.org, qemu-ppc@nongnu.org,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Dr. David Alan Gilbert" <dave@treblig.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"David Hildenbrand" <david@redhat.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Eric Blake" <eblake@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH 2/4] hw/s390x/virtio-ccw: Always deliver NMI to first CPU
Date: Tue, 20 Feb 2024 16:08:31 +0100 [thread overview]
Message-ID: <20240220150833.13674-3-philmd@linaro.org> (raw)
In-Reply-To: <20240220150833.13674-1-philmd@linaro.org>
We can trigger NMI from HMP or QMP.
QEMU maps the NMI to the s390x per-CPU 'RESTART' interrupt.
Linux guests usually setup this interrupt to trigger kdump
or crash. Such crashdump can be triggered in QEMU by HMP
"nmi" or QMP "inject-nmi" commands.
Using QMP, since we can not select a particular CPU, the first
CPU is used (CPU#0). See the documentation from commit 795dc6e4
("watchdog: Add new Virtual Watchdog action INJECT-NMI"):
@inject-nmi: a non-maskable interrupt is injected into the
first VCPU (all VCPUS on x86) (since 2.4)
While we can select a particular CPU on HMP, the guest behavior
is expected to be the same if using CPU #N or CPU #0. Since
always using CPU#0 simplifies API maintainance, update s390_nmi()
to deliver NMI to the first CPU.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
qapi/run-state.json | 5 +++--
hw/s390x/s390-virtio-ccw.c | 4 +---
hmp-commands.hx | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/qapi/run-state.json b/qapi/run-state.json
index 08bc99cb85..a2542f1a50 100644
--- a/qapi/run-state.json
+++ b/qapi/run-state.json
@@ -320,8 +320,9 @@
#
# @none: nothing is done
#
-# @inject-nmi: a non-maskable interrupt is injected into the first
-# VCPU (all VCPUS on x86) (since 2.4)
+# @inject-nmi: a non-maskable interrupt is injected (architecture
+# specific: on s390x only the first vCPU receive the NMI, on
+# other architectures all vCPUs receive it). (since 2.4)
#
# Since: 2.1
##
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 62804cc228..ba1fa6472f 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -605,9 +605,7 @@ static HotplugHandler *s390_get_hotplug_handler(MachineState *machine,
static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
{
- CPUState *cs = qemu_get_cpu(cpu_index);
-
- s390_cpu_restart(S390_CPU(cs));
+ s390_cpu_restart(S390_CPU(first_cpu));
}
static ram_addr_t s390_fixup_ram_size(ram_addr_t sz)
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 17b5ea839d..2b01bb5926 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -851,7 +851,7 @@ ERST
},
SRST
``nmi`` *cpu*
- Inject an NMI on the default CPU (x86/s390) or all CPUs (ppc64).
+ Inject an NMI.
ERST
{
--
2.41.0
next prev parent reply other threads:[~2024-02-20 15:09 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 15:08 [PATCH 0/4] hw/nmi: Remove @cpu_index argument Philippe Mathieu-Daudé
2024-02-20 15:08 ` [PATCH 1/4] hw/nmi: Use object_child_foreach_recursive() in nmi_children() Philippe Mathieu-Daudé
2024-03-20 13:09 ` Peter Maydell
2024-02-20 15:08 ` Philippe Mathieu-Daudé [this message]
2024-03-20 13:16 ` [PATCH 2/4] hw/s390x/virtio-ccw: Always deliver NMI to first CPU Peter Maydell
2024-03-20 14:12 ` David Hildenbrand
2024-02-20 15:08 ` [PATCH 3/4] hw/nmi: Remove @cpu_index argument from NMIClass::nmi_handler() Philippe Mathieu-Daudé
2024-03-20 13:23 ` Peter Maydell
2024-03-20 16:47 ` Philippe Mathieu-Daudé
2024-03-20 19:05 ` Markus Armbruster
2024-03-20 19:39 ` Peter Maydell
2024-02-20 15:08 ` [PATCH 4/4] hw/nmi: Remove @cpu_index argument from nmi_trigger() Philippe Mathieu-Daudé
2024-03-20 13:34 ` Peter Maydell
2024-02-20 15:19 ` [PATCH 0/4] hw/nmi: Remove @cpu_index argument Thomas Huth
2024-02-20 20:05 ` Philippe Mathieu-Daudé
2024-03-20 11:19 ` Philippe Mathieu-Daudé
2024-03-20 11:44 ` Mark Burton
2024-03-20 12:00 ` Peter Maydell
2024-03-20 12:31 ` Mark Burton
2024-03-20 13:55 ` Peter Maydell
2024-03-20 14:09 ` Mark Burton
2024-03-20 15:00 ` Peter Maydell
2024-03-20 15:40 ` Mark Burton
2024-03-22 14:08 ` Cédric Le Goater
2024-03-22 14:55 ` Peter Maydell
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=20240220150833.13674-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=dave@treblig.org \
--cc=david@redhat.com \
--cc=eblake@redhat.com \
--cc=farman@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).