From: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: "Corey Minyard" <minyard@acm.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
qemu-s390x@nongnu.org
Subject: [PATCH 4/4] hw/nmi: Remove unused @cpu_index and @errp arguments
Date: Mon, 10 Aug 2026 23:37:22 +0200 [thread overview]
Message-ID: <20260810213723.58467-5-philmd@oss.qualcomm.com> (raw)
In-Reply-To: <20260810213723.58467-1-philmd@oss.qualcomm.com>
NMI delivery never fails: remove the unused @errp argument.
nmi_handler() neither use the @cpu_index argument, remove it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/hw/core/nmi.h | 2 +-
hw/core/nmi.c | 7 ++-----
hw/hppa/machine.c | 4 ++--
hw/i386/x86.c | 5 ++---
hw/intc/m68k_irqc.c | 4 ++--
hw/m68k/q800-glue.c | 4 ++--
hw/misc/macio/gpio.c | 4 ++--
hw/ppc/pnv.c | 7 +++----
hw/ppc/spapr.c | 4 ++--
9 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/include/hw/core/nmi.h b/include/hw/core/nmi.h
index 2f554d58b7f..476b5d02fa1 100644
--- a/include/hw/core/nmi.h
+++ b/include/hw/core/nmi.h
@@ -37,7 +37,7 @@ typedef struct NMIState NMIState;
struct NMIClass {
InterfaceClass parent_class;
- void (*nmi_monitor_handler)(NMIState *n, int cpu_index, Error **errp);
+ void (*nmi_handler)(NMIState *ns);
void (*nmi_cpu_handler)(NMIState *ns, CPUState *cs);
};
diff --git a/hw/core/nmi.c b/hw/core/nmi.c
index fb623fd00be..3f4ef5b2094 100644
--- a/hw/core/nmi.c
+++ b/hw/core/nmi.c
@@ -45,11 +45,8 @@ static int do_nmi(Object *o, void *opaque)
ns->handled = true;
/* Generic handler */
- if (nc->nmi_monitor_handler) {
- nc->nmi_monitor_handler(n, ns->cpu_index, &ns->err);
- if (ns->err) {
- return -1;
- }
+ if (nc->nmi_handler) {
+ nc->nmi_handler(n);
}
/* Per vCPU handler */
if (nc->nmi_cpu_handler) {
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index d762163ddf5..93874b5d5c9 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -829,7 +829,7 @@ static void hppa_machine_reset(MachineState *ms, ResetType type)
cpu[0]->env.cmdline_or_bootorder = 'c';
}
-static void hppa_nmi(NMIState *n, int cpu_index, Error **errp)
+static void hppa_nmi(NMIState *ns)
{
CPUState *cs;
@@ -851,7 +851,7 @@ static void hppa_machine_common_class_init(ObjectClass *oc, const void *data)
mc->default_ram_id = "hppa.ram";
mc->default_nic = "tulip";
- nc->nmi_monitor_handler = hppa_nmi;
+ nc->nmi_handler = hppa_nmi;
}
static void HP_B160L_machine_init_class_init(ObjectClass *oc, const void *data)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index dc7f0d56b01..201746945d5 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -147,9 +147,8 @@ static const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms)
return ms->possible_cpus;
}
-static void x86_nmi(NMIState *n, int cpu_index, Error **errp)
+static void x86_nmi(NMIState *ns)
{
- /* cpu index isn't used */
CPUState *cs;
CPU_FOREACH(cs) {
@@ -389,7 +388,7 @@ static void x86_machine_class_init(ObjectClass *oc, const void *data)
mc->get_default_cpu_node_id = x86_get_default_cpu_node_id;
mc->possible_cpu_arch_ids = x86_possible_cpu_arch_ids;
mc->kvm_type = x86_kvm_type;
- nc->nmi_monitor_handler = x86_nmi;
+ nc->nmi_handler = x86_nmi;
object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto",
x86_machine_get_smm, x86_machine_set_smm,
diff --git a/hw/intc/m68k_irqc.c b/hw/intc/m68k_irqc.c
index 68ddb5351be..5d4e5a10ab8 100644
--- a/hw/intc/m68k_irqc.c
+++ b/hw/intc/m68k_irqc.c
@@ -70,7 +70,7 @@ static void m68k_irqc_instance_init(Object *obj)
qdev_init_gpio_in(DEVICE(obj), m68k_set_irq, M68K_IRQC_LEVEL_NUM);
}
-static void m68k_nmi(NMIState *n, int cpu_index, Error **errp)
+static void m68k_nmi(NMIState *n)
{
m68k_set_irq(n, M68K_IRQC_LEVEL_7, 1);
}
@@ -97,7 +97,7 @@ static void m68k_irqc_class_init(ObjectClass *oc, const void *data)
InterruptStatsProviderClass *ic = INTERRUPT_STATS_PROVIDER_CLASS(oc);
device_class_set_props(dc, m68k_irqc_properties);
- nc->nmi_monitor_handler = m68k_nmi;
+ nc->nmi_handler = m68k_nmi;
device_class_set_legacy_reset(dc, m68k_irqc_reset);
dc->vmsd = &vmstate_m68k_irqc;
ic->get_statistics = m68k_irqc_get_statistics;
diff --git a/hw/m68k/q800-glue.c b/hw/m68k/q800-glue.c
index ac9062c6488..6a9592182a4 100644
--- a/hw/m68k/q800-glue.c
+++ b/hw/m68k/q800-glue.c
@@ -159,7 +159,7 @@ static void glue_auxmode_set_irq(void *opaque, int irq, int level)
s->auxmode = level;
}
-static void glue_nmi(NMIState *n, int cpu_index, Error **errp)
+static void glue_nmi(NMIState *n)
{
GLUEState *s = GLUE(n);
@@ -237,7 +237,7 @@ static void glue_class_init(ObjectClass *klass, const void *data)
dc->vmsd = &vmstate_glue;
device_class_set_props(dc, glue_properties);
rc->phases.hold = glue_reset_hold;
- nc->nmi_monitor_handler = glue_nmi;
+ nc->nmi_handler = glue_nmi;
}
static const TypeInfo glue_info_types[] = {
diff --git a/hw/misc/macio/gpio.c b/hw/misc/macio/gpio.c
index 1a7c534d652..f6fce5b3532 100644
--- a/hw/misc/macio/gpio.c
+++ b/hw/misc/macio/gpio.c
@@ -188,7 +188,7 @@ static void macio_gpio_reset(DeviceState *dev)
macio_set_gpio(s, 1, true);
}
-static void macio_gpio_nmi(NMIState *n, int cpu_index, Error **errp)
+static void macio_gpio_nmi(NMIState *n)
{
macio_set_gpio(MACIO_GPIO(n), 9, true);
macio_set_gpio(MACIO_GPIO(n), 9, false);
@@ -201,7 +201,7 @@ static void macio_gpio_class_init(ObjectClass *oc, const void *data)
device_class_set_legacy_reset(dc, macio_gpio_reset);
dc->vmsd = &vmstate_macio_gpio;
- nc->nmi_monitor_handler = macio_gpio_nmi;
+ nc->nmi_handler = macio_gpio_nmi;
}
static const TypeInfo macio_gpio_init_info = {
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index c0cb45dbfbc..817f2ed7ae4 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -3552,12 +3552,11 @@ static void pnv_cpu_do_nmi(PnvChip *chip, PowerPCCPU *cpu, void *opaque)
async_run_on_cpu(CPU(cpu), pnv_cpu_do_nmi_on_cpu, RUN_ON_CPU_HOST_INT(0));
}
-static void pnv_nmi(NMIState *n, int cpu_index, Error **errp)
+static void pnv_nmi(NMIState *ns)
{
PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
- int i;
- for (i = 0; i < pnv->num_chips; i++) {
+ for (int i = 0; i < pnv->num_chips; i++) {
pnv_chip_foreach_cpu(pnv->chips[i], pnv_cpu_do_nmi, NULL);
}
}
@@ -3583,7 +3582,7 @@ static void pnv_machine_class_init(ObjectClass *oc, const void *data)
mc->default_ram_size = 1 * GiB;
mc->default_ram_id = "pnv.ram";
ispc->print_info = pnv_pic_print_info;
- nc->nmi_monitor_handler = pnv_nmi;
+ nc->nmi_handler = pnv_nmi;
object_class_property_add_bool(oc, "hb-mode",
pnv_machine_get_hb, pnv_machine_set_hb);
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index b79828b4e90..a2195796efe 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3550,7 +3550,7 @@ void spapr_do_system_reset_on_cpu(CPUState *cs, run_on_cpu_data arg)
}
}
-static void spapr_nmi(NMIState *n, int cpu_index, Error **errp)
+static void spapr_nmi(NMIState *ns)
{
CPUState *cs;
@@ -4652,7 +4652,7 @@ static void spapr_machine_class_init(ObjectClass *oc, const void *data)
mc->nvdimm_supported = true;
smc->resize_hpt_default = SPAPR_RESIZE_HPT_ENABLED;
fwc->get_dev_path = spapr_get_fw_dev_path;
- nc->nmi_monitor_handler = spapr_nmi;
+ nc->nmi_handler = spapr_nmi;
vhc->cpu_in_nested = spapr_cpu_in_nested;
vhc->deliver_hv_excp = spapr_exit_nested;
vhc->hypercall = emulate_spapr_hypercall;
--
2.53.0
next prev parent reply other threads:[~2026-08-10 21:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 21:37 [PATCH 0/4] hw/nmi: Safer vCPU delivery Philippe Mathieu-Daudé
2026-08-10 21:37 ` [PATCH 1/4] hw/nmi: Allow delivering to first available vCPU (not by index) Philippe Mathieu-Daudé
2026-08-10 21:37 ` [PATCH 2/4] hw/nmi: Introduce nmi_cpu_handler() for vcpu-specific delivery Philippe Mathieu-Daudé
2026-08-10 21:37 ` [PATCH 3/4] hw/s390x: Deliver per-vcpu NMI using nmi_cpu_handler Philippe Mathieu-Daudé
2026-08-10 21:37 ` Philippe Mathieu-Daudé [this message]
2026-08-11 8:44 ` [PATCH 0/4] hw/nmi: Safer vCPU delivery Philippe Mathieu-Daudé
2026-08-11 8:50 ` Philippe Mathieu-Daudé
2026-08-11 9:36 ` Philippe Mathieu-Daudé
2026-08-11 9:49 ` Daniel P. Berrangé
2026-08-11 10:56 ` 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=20260810213723.58467-5-philmd@oss.qualcomm.com \
--to=philmd@oss.qualcomm.com \
--cc=marcandre.lureau@redhat.com \
--cc=minyard@acm.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
/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.