[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info() |
Date: |
Mon, 10 Jun 2024 08:20:40 +0200 |
Replace Monitor API by HumanReadableText one.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/ppc/xics.h | 2 +-
hw/intc/xics.c | 8 ++++----
hw/intc/xics_spapr.c | 8 +++++++-
hw/ppc/pnv.c | 8 +++++++-
4 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 95ead0dd7c..1116aa6953 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -171,7 +171,7 @@ static inline bool ics_irq_free(ICSState *ics, uint32_t
srcno)
}
void ics_set_irq_type(ICSState *ics, int srcno, bool lsi);
-void icp_pic_print_info(ICPState *icp, Monitor *mon);
+void icp_pic_print_info(ICPState *icp, GString *buf);
void ics_pic_print_info(ICSState *ics, Monitor *mon);
void ics_resend(ICSState *ics);
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 9b3b7abaea..039e10a0e4 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -42,7 +42,7 @@
#include "sysemu/reset.h"
#include "target/ppc/cpu.h"
-void icp_pic_print_info(ICPState *icp, Monitor *mon)
+void icp_pic_print_info(ICPState *icp, GString *buf)
{
int cpu_index;
@@ -63,9 +63,9 @@ void icp_pic_print_info(ICPState *icp, Monitor *mon)
icp_synchronize_state(icp);
}
- monitor_printf(mon, "CPU %d XIRR=%08x (%p) PP=%02x MFRR=%02x\n",
- cpu_index, icp->xirr, icp->xirr_owner,
- icp->pending_priority, icp->mfrr);
+ g_string_append_printf(buf, "CPU %d XIRR=%08x (%p) PP=%02x MFRR=%02x\n",
+ cpu_index, icp->xirr, icp->xirr_owner,
+ icp->pending_priority, icp->mfrr);
}
void ics_pic_print_info(ICSState *ics, Monitor *mon)
diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
index 37b2d99977..bab9d88218 100644
--- a/hw/intc/xics_spapr.c
+++ b/hw/intc/xics_spapr.c
@@ -34,6 +34,8 @@
#include "hw/ppc/xics_spapr.h"
#include "hw/ppc/fdt.h"
#include "qapi/visitor.h"
+#include "qapi/type-helpers.h"
+#include "monitor/monitor.h"
/*
* Guest interfaces
@@ -399,12 +401,16 @@ static void
xics_spapr_print_info(SpaprInterruptController *intc, Monitor *mon)
{
ICSState *ics = ICS_SPAPR(intc);
CPUState *cs;
+ g_autoptr(GString) buf = g_string_new("");
+ g_autoptr(HumanReadableText) info = NULL;
CPU_FOREACH(cs) {
PowerPCCPU *cpu = POWERPC_CPU(cs);
- icp_pic_print_info(spapr_cpu_state(cpu)->icp, mon);
+ icp_pic_print_info(spapr_cpu_state(cpu)->icp, buf);
}
+ info = human_readable_text_from_str(buf);
+ monitor_puts(mon, info->human_readable_text);
ics_pic_print_info(ics, mon);
}
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 5356a4e295..fa23b27a2b 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1130,7 +1130,13 @@ static void pnv_chip_power8_intc_destroy(PnvChip *chip,
PowerPCCPU *cpu)
static void pnv_chip_power8_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
Monitor *mon)
{
- icp_pic_print_info(ICP(pnv_cpu_state(cpu)->intc), mon);
+ g_autoptr(GString) buf = g_string_new("");
+ g_autoptr(HumanReadableText) info = NULL;
+
+ icp_pic_print_info(ICP(pnv_cpu_state(cpu)->intc), buf);
+
+ info = human_readable_text_from_str(buf);
+ monitor_puts(mon, info->human_readable_text);
}
/*
--
2.41.0
- [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor, Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info(),
Philippe Mathieu-Daudé <=
- [PATCH 03/26] hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 04/26] hw/ppc: Avoid using Monitor in ics_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 05/26] hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 07/26] hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 08/26] hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10