[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_in
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info() |
Date: |
Mon, 10 Jun 2024 08:20:44 +0200 |
Replace Monitor API by HumanReadableText one.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/hw/ppc/xive_regs.h | 2 +-
hw/intc/spapr_xive.c | 7 ++++++-
hw/intc/xive.c | 17 +++++++++++------
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/include/hw/ppc/xive_regs.h b/include/hw/ppc/xive_regs.h
index 4a3c9badd3..51e9a2152e 100644
--- a/include/hw/ppc/xive_regs.h
+++ b/include/hw/ppc/xive_regs.h
@@ -262,7 +262,7 @@ static inline uint64_t xive_end_qaddr(XiveEND *end)
}
void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon);
-void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, Monitor *mon);
+void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, GString *buf);
void xive_end_eas_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon);
/* Notification Virtual Target (NVT) */
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index b7c12aa432..3357f6325f 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -142,12 +142,17 @@ static void spapr_xive_end_pic_print_info(SpaprXive
*xive, XiveEND *end,
uint32_t qentries = 1 << (qsize + 10);
uint32_t nvt = xive_get_field32(END_W6_NVT_INDEX, end->w6);
uint8_t priority = xive_get_field32(END_W7_F0_PRIORITY, end->w7);
+ g_autoptr(GString) buf = g_string_new("");
+ g_autoptr(HumanReadableText) info = NULL;
monitor_printf(mon, "%3d/%d % 6d/%5d @%"PRIx64" ^%d",
spapr_xive_nvt_to_target(0, nvt),
priority, qindex, qentries, qaddr_base, qgen);
- xive_end_queue_pic_print_info(end, 6, mon);
+ xive_end_queue_pic_print_info(end, 6, buf);
+
+ info = human_readable_text_from_str(buf);
+ monitor_puts(mon, info->human_readable_text);
}
/*
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index a0d7e7ca67..260a94e2ca 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -11,6 +11,7 @@
#include "qemu/log.h"
#include "qemu/module.h"
#include "qapi/error.h"
+#include "qapi/type-helpers.h"
#include "target/ppc/cpu.h"
#include "sysemu/cpus.h"
#include "sysemu/dma.h"
@@ -1323,7 +1324,7 @@ static const TypeInfo xive_source_info = {
* XiveEND helpers
*/
-void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, Monitor *mon)
+void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, GString *buf)
{
uint64_t qaddr_base = xive_end_qaddr(end);
uint32_t qsize = xive_get_field32(END_W0_QSIZE, end->w0);
@@ -1334,7 +1335,7 @@ void xive_end_queue_pic_print_info(XiveEND *end, uint32_t
width, Monitor *mon)
/*
* print out the [ (qindex - (width - 1)) .. (qindex + 1)] window
*/
- monitor_printf(mon, " [ ");
+ g_string_append_printf(buf, " [ ");
qindex = (qindex - (width - 1)) & (qentries - 1);
for (i = 0; i < width; i++) {
uint64_t qaddr = qaddr_base + (qindex << 2);
@@ -1346,11 +1347,11 @@ void xive_end_queue_pic_print_info(XiveEND *end,
uint32_t width, Monitor *mon)
HWADDR_PRIx "\n", qaddr);
return;
}
- monitor_printf(mon, "%s%08x ", i == width - 1 ? "^" : "",
- be32_to_cpu(qdata));
+ g_string_append_printf(buf, "%s%08x ", i == width - 1 ? "^" : "",
+ be32_to_cpu(qdata));
qindex = (qindex + 1) & (qentries - 1);
}
- monitor_printf(mon, "]");
+ g_string_append_c(buf, ']');
}
void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon)
@@ -1365,6 +1366,8 @@ void xive_end_pic_print_info(XiveEND *end, uint32_t
end_idx, Monitor *mon)
uint32_t nvt_idx = xive_get_field32(END_W6_NVT_INDEX, end->w6);
uint8_t priority = xive_get_field32(END_W7_F0_PRIORITY, end->w7);
uint8_t pq;
+ g_autoptr(GString) buf = g_string_new("");
+ g_autoptr(HumanReadableText) info = NULL;
if (!xive_end_is_valid(end)) {
return;
@@ -1389,8 +1392,10 @@ void xive_end_pic_print_info(XiveEND *end, uint32_t
end_idx, Monitor *mon)
if (qaddr_base) {
monitor_printf(mon, " eq:@%08"PRIx64"% 6d/%5d ^%d",
qaddr_base, qindex, qentries, qgen);
- xive_end_queue_pic_print_info(end, 6, mon);
+ xive_end_queue_pic_print_info(end, 6, buf);
}
+ info = human_readable_text_from_str(buf);
+ monitor_puts(mon, info->human_readable_text);
monitor_printf(mon, "\n");
}
--
2.41.0
- [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info(), (continued)
- [PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [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é <=
- [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
- [PATCH 09/26] hw/ppc: Avoid using Monitor in xive_source_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 10/26] hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 12/26] hw/ppc: Avoid using Monitor in xive_end_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 11/26] hw/ppc: Avoid using Monitor in xive_eas_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10
- [PATCH 13/26] hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info(), Philippe Mathieu-Daudé, 2024/06/10