hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-Id: <20240610062105.49848-7-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2024-06-07 14:43:47 +02:00
parent ae08259b84
commit ace6fcde9b
3 changed files with 18 additions and 8 deletions

View File

@ -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);
}
/*

View File

@ -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");
}

View File

@ -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) */