On 20/5/26 23:49, Marc-André Lureau wrote:
Replace monitor_printf() error reporting with the standard **errp
pattern. Drop the Monitor *mon parameter and return bool to indicate
success, improving the function usage from non-HMP contexts. Update the
KVM MCE injection path and hmp_mce() accordingly.
Notes:
- we may want to print the error in KVM path too
- multiple error prints are now accumulated with error hints
Signed-off-by: Marc-André Lureau <[email protected]>
---
target/i386/cpu.h | 4 ++--
target/i386/helper.c | 49 ++++++++++++++++++++++++++++---------------------
target/i386/kvm/kvm.c | 4 ++--
target/i386/monitor.c | 6 ++++--
4 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index a536712c755..785a13dd710 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -580,6 +580,7 @@ void hmp_mce(Monitor *mon, const QDict *qdict)
uint64_t addr = qdict_get_int(qdict, "addr");
uint64_t misc = qdict_get_int(qdict, "misc");
int flags = MCE_INJECT_UNCOND_AO;
+ Error *err = NULL;
if (qdict_get_try_bool(qdict, "broadcast", false)) {
flags |= MCE_INJECT_BROADCAST;
@@ -587,7 +588,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict)
cs = qemu_get_cpu(cpu_index);
if (!cs) {
error_setg(errp, "Invalid CPU %d", cpu_index);
return;
}
?
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
if (cs != NULL) {
cpu = X86_CPU(cs);
- cpu_x86_inject_mce(mon, cpu, bank, status, mcg_status, addr, misc,
- flags);
+ cpu_x86_inject_mce(cpu, bank, status, mcg_status, addr, misc,
+ flags, &err);
+ hmp_handle_error(mon, err);
}
}