qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
@ 2024-06-10  6:20 Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info() Philippe Mathieu-Daudé
                   ` (32 more replies)
  0 siblings, 33 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe =?unknown-8bit?q?Mathieu-Daud=C3=A9?=

Hi,

This series remove uses of Monitor in hw/ppc/,
replacing by the more generic HumanReadableText.
Care is taken to keep the commit bisectables by
updating functions one by one, also easing review.

For rationale see previous series from Daniel:
https://lore.kernel.org/qemu-devel/20211028155457.967291-1-berrange@redhat.com/

Regards,

Phil.

Philippe Mathieu-Daudé (26):
  hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
  hw/ppc: Avoid using Monitor in icp_pic_print_info()
  hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
  hw/ppc: Avoid using Monitor in ics_pic_print_info()
  hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
  hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
  hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
  hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
  hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
  hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
  hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
  hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
  hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
  hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
  hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
  hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
  hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
  hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
  hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
  hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
  hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
  hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
  hw/ppc: Avoid using Monitor in
    SpaprInterruptControllerClass::print_info()
  hw/ppc: Avoid using Monitor in spapr_irq_print_info()
  hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
  hw/ppc: Avoid using Monitor in pic_print_info()

 include/hw/pci-host/pnv_phb3.h |   2 +-
 include/hw/pci-host/pnv_phb4.h |   2 +-
 include/hw/ppc/pnv_chip.h      |   4 +-
 include/hw/ppc/pnv_psi.h       |   2 +-
 include/hw/ppc/pnv_xive.h      |   4 +-
 include/hw/ppc/spapr_irq.h     |   4 +-
 include/hw/ppc/xics.h          |   4 +-
 include/hw/ppc/xive.h          |   4 +-
 include/hw/ppc/xive2_regs.h    |   8 +--
 include/hw/ppc/xive_regs.h     |   8 +--
 hw/intc/pnv_xive.c             |  38 ++++++------
 hw/intc/pnv_xive2.c            |  48 +++++++--------
 hw/intc/spapr_xive.c           |  41 ++++++-------
 hw/intc/xics.c                 |  25 ++++----
 hw/intc/xics_spapr.c           |   7 +--
 hw/intc/xive.c                 | 108 ++++++++++++++++-----------------
 hw/intc/xive2.c                |  87 +++++++++++++-------------
 hw/pci-host/pnv_phb3_msi.c     |  21 +++----
 hw/pci-host/pnv_phb4.c         |  17 +++---
 hw/ppc/pnv.c                   |  52 ++++++++--------
 hw/ppc/pnv_psi.c               |   9 ++-
 hw/ppc/spapr.c                 |  11 +++-
 hw/ppc/spapr_irq.c             |   4 +-
 23 files changed, 256 insertions(+), 254 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-17 10:11   ` Harsh Prateek Bora
  2024-06-10  6:20 ` [PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info() Philippe Mathieu-Daudé
                   ` (31 subsequent siblings)
  32 siblings, 1 reply; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/pci-host/pnv_phb3.h |  2 +-
 hw/pci-host/pnv_phb3_msi.c     | 21 ++++++++++-----------
 hw/ppc/pnv.c                   |  8 +++++++-
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
index d62b3091ac..24ca3dddaa 100644
--- a/include/hw/pci-host/pnv_phb3.h
+++ b/include/hw/pci-host/pnv_phb3.h
@@ -40,7 +40,7 @@ void pnv_phb3_msi_update_config(Phb3MsiState *msis, uint32_t base,
 void pnv_phb3_msi_send(Phb3MsiState *msis, uint64_t addr, uint16_t data,
                        int32_t dev_pe);
 void pnv_phb3_msi_ffi(Phb3MsiState *msis, uint64_t val);
-void pnv_phb3_msi_pic_print_info(Phb3MsiState *msis, Monitor *mon);
+void pnv_phb3_msi_pic_print_info(Phb3MsiState *msis, GString *buf);
 
 
 /*
diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c
index a6d827f903..77d673da54 100644
--- a/hw/pci-host/pnv_phb3_msi.c
+++ b/hw/pci-host/pnv_phb3_msi.c
@@ -13,7 +13,6 @@
 #include "hw/pci-host/pnv_phb3.h"
 #include "hw/ppc/pnv.h"
 #include "hw/pci/msi.h"
-#include "monitor/monitor.h"
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
 #include "sysemu/reset.h"
@@ -316,13 +315,13 @@ static void pnv_phb3_msi_register_types(void)
 
 type_init(pnv_phb3_msi_register_types);
 
-void pnv_phb3_msi_pic_print_info(Phb3MsiState *msi, Monitor *mon)
+void pnv_phb3_msi_pic_print_info(Phb3MsiState *msi, GString *buf)
 {
     ICSState *ics = ICS(msi);
     int i;
 
-    monitor_printf(mon, "ICS %4x..%4x %p\n",
-                   ics->offset, ics->offset + ics->nr_irqs - 1, ics);
+    g_string_append_printf(buf, "ICS %4x..%4x %p\n",
+                           ics->offset, ics->offset + ics->nr_irqs - 1, ics);
 
     for (i = 0; i < ics->nr_irqs; i++) {
         uint64_t ive;
@@ -335,12 +334,12 @@ void pnv_phb3_msi_pic_print_info(Phb3MsiState *msi, Monitor *mon)
             continue;
         }
 
-        monitor_printf(mon, "  %4x %c%c server=%04x prio=%02x gen=%d\n",
-                       ics->offset + i,
-                       GETFIELD(IODA2_IVT_P, ive) ? 'P' : '-',
-                       GETFIELD(IODA2_IVT_Q, ive) ? 'Q' : '-',
-                       (uint32_t) GETFIELD(IODA2_IVT_SERVER, ive) >> 2,
-                       (uint32_t) GETFIELD(IODA2_IVT_PRIORITY, ive),
-                       (uint32_t) GETFIELD(IODA2_IVT_GEN, ive));
+        g_string_append_printf(buf, "  %4x %c%c server=%04x prio=%02x gen=%d\n",
+                               ics->offset + i,
+                               GETFIELD(IODA2_IVT_P, ive) ? 'P' : '-',
+                               GETFIELD(IODA2_IVT_Q, ive) ? 'Q' : '-',
+                               (uint32_t) GETFIELD(IODA2_IVT_SERVER, ive) >> 2,
+                               (uint32_t) GETFIELD(IODA2_IVT_PRIORITY, ive),
+                               (uint32_t) GETFIELD(IODA2_IVT_GEN, ive));
     }
 }
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 6e3a5ccdec..5356a4e295 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -38,6 +38,7 @@
 #include "hw/loader.h"
 #include "hw/nmi.h"
 #include "qapi/visitor.h"
+#include "qapi/type-helpers.h"
 #include "monitor/monitor.h"
 #include "hw/intc/intc.h"
 #include "hw/ipmi/ipmi.h"
@@ -774,8 +775,13 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
     for (i = 0; i < chip8->num_phbs; i++) {
         PnvPHB *phb = chip8->phbs[i];
         PnvPHB3 *phb3 = PNV_PHB3(phb->backend);
+        g_autoptr(GString) buf = g_string_new("");
+        g_autoptr(HumanReadableText) info = NULL;
+
+        pnv_phb3_msi_pic_print_info(&phb3->msis, buf);
+        info = human_readable_text_from_str(buf);
+        monitor_puts(mon, info->human_readable_text);
 
-        pnv_phb3_msi_pic_print_info(&phb3->msis, mon);
         ics_pic_print_info(&phb3->lsis, mon);
     }
 }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 03/26] hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info() Philippe Mathieu-Daudé
                   ` (30 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

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



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 03/26] hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info() Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-17 10:19   ` Harsh Prateek Bora
  2024-06-10  6:20 ` [PATCH 04/26] hw/ppc: Avoid using Monitor in ics_pic_print_info() Philippe Mathieu-Daudé
                   ` (29 subsequent siblings)
  32 siblings, 1 reply; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive.h |  2 +-
 hw/intc/spapr_xive.c  |  7 ++++++-
 hw/intc/xive.c        | 11 ++++++-----
 hw/ppc/pnv.c          | 16 ++++++++++++++--
 4 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index f120874e0f..bc1cbad8a8 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -528,7 +528,7 @@ void xive_tctx_tm_write(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
 uint64_t xive_tctx_tm_read(XivePresenter *xptr, XiveTCTX *tctx, hwaddr offset,
                            unsigned size);
 
-void xive_tctx_pic_print_info(XiveTCTX *tctx, Monitor *mon);
+void xive_tctx_pic_print_info(XiveTCTX *tctx, GString *buf);
 Object *xive_tctx_create(Object *cpu, XivePresenter *xptr, Error **errp);
 void xive_tctx_reset(XiveTCTX *tctx);
 void xive_tctx_destroy(XiveTCTX *tctx);
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index d7e56bfb20..b7c12aa432 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -11,6 +11,7 @@
 #include "qemu/log.h"
 #include "qemu/module.h"
 #include "qapi/error.h"
+#include "qapi/type-helpers.h"
 #include "qemu/error-report.h"
 #include "target/ppc/cpu.h"
 #include "sysemu/cpus.h"
@@ -703,12 +704,16 @@ static void spapr_xive_print_info(SpaprInterruptController *intc, Monitor *mon)
 {
     SpaprXive *xive = SPAPR_XIVE(intc);
     CPUState *cs;
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
     CPU_FOREACH(cs) {
         PowerPCCPU *cpu = POWERPC_CPU(cs);
 
-        xive_tctx_pic_print_info(spapr_cpu_state(cpu)->tctx, mon);
+        xive_tctx_pic_print_info(spapr_cpu_state(cpu)->tctx, buf);
     }
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     spapr_xive_pic_print_info(xive, mon);
 }
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index 057b308ae9..a0d7e7ca67 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -669,7 +669,7 @@ static const char * const xive_tctx_ring_names[] = {
          xpc->in_kernel ? xpc->in_kernel(xptr) : false;                 \
      }))
 
-void xive_tctx_pic_print_info(XiveTCTX *tctx, Monitor *mon)
+void xive_tctx_pic_print_info(XiveTCTX *tctx, GString *buf)
 {
     int cpu_index;
     int i;
@@ -693,13 +693,14 @@ void xive_tctx_pic_print_info(XiveTCTX *tctx, Monitor *mon)
         }
     }
 
-    monitor_printf(mon, "CPU[%04x]:   QW   NSR CPPR IPB LSMFB ACK# INC AGE PIPR"
-                   "  W2\n", cpu_index);
+    g_string_append_printf(buf, "CPU[%04x]:   "
+                           "QW   NSR CPPR IPB LSMFB ACK# INC AGE PIPR  W2\n",
+                           cpu_index);
 
     for (i = 0; i < XIVE_TM_RING_COUNT; i++) {
         char *s = xive_tctx_ring_print(&tctx->regs[i * XIVE_TM_RING_SIZE]);
-        monitor_printf(mon, "CPU[%04x]: %4s    %s\n", cpu_index,
-                       xive_tctx_ring_names[i], s);
+        g_string_append_printf(buf, "CPU[%04x]: %4s    %s\n",
+                               cpu_index, xive_tctx_ring_names[i], s);
         g_free(s);
     }
 }
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index fa23b27a2b..5854358f65 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1223,7 +1223,13 @@ static void pnv_chip_power9_intc_destroy(PnvChip *chip, PowerPCCPU *cpu)
 static void pnv_chip_power9_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
                                             Monitor *mon)
 {
-    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), mon);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
+
+    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 static void pnv_chip_power10_intc_create(PnvChip *chip, PowerPCCPU *cpu,
@@ -1267,7 +1273,13 @@ static void pnv_chip_power10_intc_destroy(PnvChip *chip, PowerPCCPU *cpu)
 static void pnv_chip_power10_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
                                              Monitor *mon)
 {
-    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), mon);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
+
+    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 /*
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 04/26] hw/ppc: Avoid using Monitor in ics_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 03/26] hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 05/26] hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info() Philippe Mathieu-Daudé
                   ` (28 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

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        | 17 ++++++++---------
 hw/intc/xics_spapr.c  |  4 ++--
 hw/ppc/pnv.c          | 15 ++++++++-------
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 1116aa6953..e94d53405f 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -172,7 +172,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, GString *buf);
-void ics_pic_print_info(ICSState *ics, Monitor *mon);
+void ics_pic_print_info(ICSState *ics, GString *buf);
 
 void ics_resend(ICSState *ics);
 void icp_resend(ICPState *ss);
diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 039e10a0e4..6f4d5271ea 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -35,7 +35,6 @@
 #include "qemu/module.h"
 #include "qapi/visitor.h"
 #include "migration/vmstate.h"
-#include "monitor/monitor.h"
 #include "hw/intc/intc.h"
 #include "hw/irq.h"
 #include "sysemu/kvm.h"
@@ -68,12 +67,12 @@ void icp_pic_print_info(ICPState *icp, GString *buf)
                            icp->pending_priority, icp->mfrr);
 }
 
-void ics_pic_print_info(ICSState *ics, Monitor *mon)
+void ics_pic_print_info(ICSState *ics, GString *buf)
 {
     uint32_t i;
 
-    monitor_printf(mon, "ICS %4x..%4x %p\n",
-                   ics->offset, ics->offset + ics->nr_irqs - 1, ics);
+    g_string_append_printf(buf, "ICS %4x..%4x %p\n",
+                           ics->offset, ics->offset + ics->nr_irqs - 1, ics);
 
     if (!ics->irqs) {
         return;
@@ -89,11 +88,11 @@ void ics_pic_print_info(ICSState *ics, Monitor *mon)
         if (!(irq->flags & XICS_FLAGS_IRQ_MASK)) {
             continue;
         }
-        monitor_printf(mon, "  %4x %s %02x %02x\n",
-                       ics->offset + i,
-                       (irq->flags & XICS_FLAGS_IRQ_LSI) ?
-                       "LSI" : "MSI",
-                       irq->priority, irq->status);
+        g_string_append_printf(buf, "  %4x %s %02x %02x\n",
+                               ics->offset + i,
+                               (irq->flags & XICS_FLAGS_IRQ_LSI) ?
+                               "LSI" : "MSI",
+                               irq->priority, irq->status);
     }
 }
 
diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
index bab9d88218..1926373ebd 100644
--- a/hw/intc/xics_spapr.c
+++ b/hw/intc/xics_spapr.c
@@ -409,10 +409,10 @@ static void xics_spapr_print_info(SpaprInterruptController *intc, Monitor *mon)
 
         icp_pic_print_info(spapr_cpu_state(cpu)->icp, buf);
     }
+    ics_pic_print_info(ics, buf);
+
     info = human_readable_text_from_str(buf);
     monitor_puts(mon, info->human_readable_text);
-
-    ics_pic_print_info(ics, mon);
 }
 
 static int xics_spapr_post_load(SpaprInterruptController *intc, int version_id)
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 5854358f65..3eaf674efa 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -770,20 +770,21 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
     Pnv8Chip *chip8 = PNV8_CHIP(chip);
     int i;
 
-    ics_pic_print_info(&chip8->psi.ics, mon);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
+
+    ics_pic_print_info(&chip8->psi.ics, buf);
 
     for (i = 0; i < chip8->num_phbs; i++) {
         PnvPHB *phb = chip8->phbs[i];
         PnvPHB3 *phb3 = PNV_PHB3(phb->backend);
-        g_autoptr(GString) buf = g_string_new("");
-        g_autoptr(HumanReadableText) info = NULL;
 
         pnv_phb3_msi_pic_print_info(&phb3->msis, buf);
-        info = human_readable_text_from_str(buf);
-        monitor_puts(mon, info->human_readable_text);
-
-        ics_pic_print_info(&phb3->lsis, mon);
+        ics_pic_print_info(&phb3->lsis, buf);
     }
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 static int pnv_chip_power9_pic_print_info_child(Object *child, void *opaque)
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 05/26] hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 04/26] hw/ppc: Avoid using Monitor in ics_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info() Philippe Mathieu-Daudé
                   ` (27 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/pnv_chip.h |  2 +-
 hw/ppc/pnv.c              | 30 ++++++++----------------------
 2 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/include/hw/ppc/pnv_chip.h b/include/hw/ppc/pnv_chip.h
index 8589f3291e..a5e428be7c 100644
--- a/include/hw/ppc/pnv_chip.h
+++ b/include/hw/ppc/pnv_chip.h
@@ -151,7 +151,7 @@ struct PnvChipClass {
     void (*intc_create)(PnvChip *chip, PowerPCCPU *cpu, Error **errp);
     void (*intc_reset)(PnvChip *chip, PowerPCCPU *cpu);
     void (*intc_destroy)(PnvChip *chip, PowerPCCPU *cpu);
-    void (*intc_print_info)(PnvChip *chip, PowerPCCPU *cpu, Monitor *mon);
+    void (*intc_print_info)(PnvChip *chip, PowerPCCPU *cpu, GString *buf);
     ISABus *(*isa_create)(PnvChip *chip, Error **errp);
     void (*dt_populate)(PnvChip *chip, void *fdt);
     void (*pic_print_info)(PnvChip *chip, Monitor *mon);
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 3eaf674efa..aed6767c8d 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -1129,15 +1129,9 @@ 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)
+                                            GString *buf)
 {
-    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);
 }
 
 /*
@@ -1222,15 +1216,9 @@ static void pnv_chip_power9_intc_destroy(PnvChip *chip, PowerPCCPU *cpu)
 }
 
 static void pnv_chip_power9_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
-                                            Monitor *mon)
+                                            GString *buf)
 {
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
-
     xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 static void pnv_chip_power10_intc_create(PnvChip *chip, PowerPCCPU *cpu,
@@ -1272,15 +1260,9 @@ static void pnv_chip_power10_intc_destroy(PnvChip *chip, PowerPCCPU *cpu)
 }
 
 static void pnv_chip_power10_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
-                                             Monitor *mon)
+                                             GString *buf)
 {
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
-
     xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 /*
@@ -2363,14 +2345,18 @@ static void pnv_pic_print_info(InterruptStatsProvider *obj,
     PnvMachineState *pnv = PNV_MACHINE(obj);
     int i;
     CPUState *cs;
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
     CPU_FOREACH(cs) {
         PowerPCCPU *cpu = POWERPC_CPU(cs);
 
         /* XXX: loop on each chip/core/thread instead of CPU_FOREACH() */
         PNV_CHIP_GET_CLASS(pnv->chips[0])->intc_print_info(pnv->chips[0], cpu,
-                                                           mon);
+                                                           buf);
     }
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     for (i = 0; i < pnv->num_chips; i++) {
         PNV_CHIP_GET_CLASS(pnv->chips[i])->pic_print_info(pnv->chips[i], mon);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 05/26] hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-17 12:35   ` Harsh Prateek Bora
  2024-06-10  6:20 ` [PATCH 07/26] hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info() Philippe Mathieu-Daudé
                   ` (26 subsequent siblings)
  32 siblings, 1 reply; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

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



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 07/26] hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-17 12:39   ` Harsh Prateek Bora
  2024-06-10  6:20 ` [PATCH 08/26] hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info() Philippe Mathieu-Daudé
                   ` (25 subsequent siblings)
  32 siblings, 1 reply; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/intc/spapr_xive.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index 3357f6325f..d571645e9e 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -133,7 +133,7 @@ static int spapr_xive_target_to_end(uint32_t target, uint8_t prio,
  * structure dumping only the information related to the OS EQ.
  */
 static void spapr_xive_end_pic_print_info(SpaprXive *xive, XiveEND *end,
-                                          Monitor *mon)
+                                          GString *buf)
 {
     uint64_t qaddr_base = xive_end_qaddr(end);
     uint32_t qindex = xive_get_field32(END_W1_PAGE_OFF, end->w1);
@@ -142,17 +142,12 @@ 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);
+    g_string_append_printf(buf, "%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, buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 /*
@@ -198,13 +193,18 @@ static void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
         if (!xive_eas_is_masked(eas)) {
             uint32_t end_idx = xive_get_field64(EAS_END_INDEX, eas->w);
             XiveEND *end;
+            g_autoptr(GString) buf = g_string_new("");
+            g_autoptr(HumanReadableText) info = NULL;
 
             assert(end_idx < xive->nr_ends);
             end = &xive->endt[end_idx];
 
             if (xive_end_is_valid(end)) {
-                spapr_xive_end_pic_print_info(xive, end, mon);
+                spapr_xive_end_pic_print_info(xive, end, buf);
             }
+
+            info = human_readable_text_from_str(buf);
+            monitor_puts(mon, info->human_readable_text);
         }
         monitor_printf(mon, "\n");
     }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 08/26] hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 07/26] hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-17 12:50   ` Harsh Prateek Bora
  2024-06-10  6:20 ` [PATCH 09/26] hw/ppc: Avoid using Monitor in xive_source_pic_print_info() Philippe Mathieu-Daudé
                   ` (24 subsequent siblings)
  32 siblings, 1 reply; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/intc/spapr_xive.c | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index d571645e9e..9d0d5948ff 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -157,7 +157,7 @@ static void spapr_xive_end_pic_print_info(SpaprXive *xive, XiveEND *end,
 #define spapr_xive_in_kernel(xive) \
     (kvm_irqchip_in_kernel() && (xive)->fd != -1)
 
-static void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
+static void spapr_xive_pic_print_info(SpaprXive *xive, GString *buf)
 {
     XiveSource *xsrc = &xive->source;
     int i;
@@ -172,7 +172,7 @@ static void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
         }
     }
 
-    monitor_printf(mon, "  LISN         PQ    EISN     CPU/PRIO EQ\n");
+    g_string_append_printf(buf, "  LISN         PQ    EISN     CPU/PRIO EQ\n");
 
     for (i = 0; i < xive->nr_irqs; i++) {
         uint8_t pq = xive_source_esb_get(xsrc, i);
@@ -182,19 +182,17 @@ static void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
             continue;
         }
 
-        monitor_printf(mon, "  %08x %s %c%c%c %s %08x ", i,
-                       xive_source_irq_is_lsi(xsrc, i) ? "LSI" : "MSI",
-                       pq & XIVE_ESB_VAL_P ? 'P' : '-',
-                       pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
-                       xive_source_is_asserted(xsrc, i) ? 'A' : ' ',
-                       xive_eas_is_masked(eas) ? "M" : " ",
-                       (int) xive_get_field64(EAS_END_DATA, eas->w));
+        g_string_append_printf(buf, "  %08x %s %c%c%c %s %08x ", i,
+                               xive_source_irq_is_lsi(xsrc, i) ? "LSI" : "MSI",
+                               pq & XIVE_ESB_VAL_P ? 'P' : '-',
+                               pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
+                               xive_source_is_asserted(xsrc, i) ? 'A' : ' ',
+                               xive_eas_is_masked(eas) ? "M" : " ",
+                               (int) xive_get_field64(EAS_END_DATA, eas->w));
 
         if (!xive_eas_is_masked(eas)) {
             uint32_t end_idx = xive_get_field64(EAS_END_INDEX, eas->w);
             XiveEND *end;
-            g_autoptr(GString) buf = g_string_new("");
-            g_autoptr(HumanReadableText) info = NULL;
 
             assert(end_idx < xive->nr_ends);
             end = &xive->endt[end_idx];
@@ -203,10 +201,8 @@ static void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
                 spapr_xive_end_pic_print_info(xive, end, buf);
             }
 
-            info = human_readable_text_from_str(buf);
-            monitor_puts(mon, info->human_readable_text);
         }
-        monitor_printf(mon, "\n");
+        g_string_append_c(buf, '\n');
     }
 }
 
@@ -717,10 +713,10 @@ static void spapr_xive_print_info(SpaprInterruptController *intc, Monitor *mon)
 
         xive_tctx_pic_print_info(spapr_cpu_state(cpu)->tctx, buf);
     }
+    spapr_xive_pic_print_info(xive, buf);
+
     info = human_readable_text_from_str(buf);
     monitor_puts(mon, info->human_readable_text);
-
-    spapr_xive_pic_print_info(xive, mon);
 }
 
 static void spapr_xive_dt(SpaprInterruptController *intc, uint32_t nr_servers,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 09/26] hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 08/26] hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 10/26] hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info() Philippe Mathieu-Daudé
                   ` (23 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive.h  |  2 +-
 hw/intc/pnv_xive.c     | 11 ++++++++---
 hw/intc/pnv_xive2.c    |  8 +++++++-
 hw/intc/xive.c         | 16 +++++++---------
 hw/pci-host/pnv_phb4.c | 20 ++++++++++++++------
 hw/ppc/pnv_psi.c       | 12 +++++++++---
 6 files changed, 46 insertions(+), 23 deletions(-)

diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index bc1cbad8a8..28c181faa2 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -314,7 +314,7 @@ static inline bool xive_source_is_asserted(XiveSource *xsrc, uint32_t srcno)
 }
 
 void xive_source_pic_print_info(XiveSource *xsrc, uint32_t offset,
-                                Monitor *mon);
+                                GString *buf);
 
 static inline bool xive_source_irq_is_lsi(XiveSource *xsrc, uint32_t srcno)
 {
diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
index da10deceb8..520d7e0acd 100644
--- a/hw/intc/pnv_xive.c
+++ b/hw/intc/pnv_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"
@@ -1857,10 +1858,14 @@ void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
     XiveNVT nvt;
     int i;
     uint64_t xive_nvt_per_subpage;
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
-    monitor_printf(mon, "XIVE[%x] #%d Source %08x .. %08x\n", chip_id, blk,
-                   srcno0, srcno0 + nr_ipis - 1);
-    xive_source_pic_print_info(&xive->ipi_source, srcno0, mon);
+    g_string_append_printf(buf, "XIVE[%x] #%d Source %08x .. %08x\n",
+                           chip_id, blk, srcno0, srcno0 + nr_ipis - 1);
+    xive_source_pic_print_info(&xive->ipi_source, srcno0, buf);
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     monitor_printf(mon, "XIVE[%x] #%d EAT %08x .. %08x\n", chip_id, blk,
                    srcno0, srcno0 + nr_ipis - 1);
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index 4b8d0a5d81..83e0f6b09f 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -10,6 +10,7 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "qapi/error.h"
+#include "qapi/type-helpers.h"
 #include "target/ppc/cpu.h"
 #include "sysemu/cpus.h"
 #include "sysemu/dma.h"
@@ -2116,10 +2117,15 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon)
     Xive2Nvp nvp;
     int i;
     uint64_t xive_nvp_per_subpage;
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
     monitor_printf(mon, "XIVE[%x] Source %08x .. %08x\n", blk, srcno0,
                    srcno0 + nr_esbs - 1);
-    xive_source_pic_print_info(&xive->ipi_source, srcno0, mon);
+    xive_source_pic_print_info(&xive->ipi_source, srcno0, buf);
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     monitor_printf(mon, "XIVE[%x] EAT %08x .. %08x\n", blk, srcno0,
                    srcno0 + nr_esbs - 1);
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index 260a94e2ca..1adb0439c5 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -1209,22 +1209,20 @@ void xive_source_set_irq(void *opaque, int srcno, int val)
     }
 }
 
-void xive_source_pic_print_info(XiveSource *xsrc, uint32_t offset, Monitor *mon)
+void xive_source_pic_print_info(XiveSource *xsrc, uint32_t offset, GString *buf)
 {
-    int i;
-
-    for (i = 0; i < xsrc->nr_irqs; i++) {
+    for (unsigned i = 0; i < xsrc->nr_irqs; i++) {
         uint8_t pq = xive_source_esb_get(xsrc, i);
 
         if (pq == XIVE_ESB_OFF) {
             continue;
         }
 
-        monitor_printf(mon, "  %08x %s %c%c%c\n", i + offset,
-                       xive_source_irq_is_lsi(xsrc, i) ? "LSI" : "MSI",
-                       pq & XIVE_ESB_VAL_P ? 'P' : '-',
-                       pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
-                       xive_source_is_asserted(xsrc, i) ? 'A' : ' ');
+        g_string_append_printf(buf, "  %08x %s %c%c%c\n", i + offset,
+                               xive_source_irq_is_lsi(xsrc, i) ? "LSI" : "MSI",
+                               pq & XIVE_ESB_VAL_P ? 'P' : '-',
+                               pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
+                               xive_source_is_asserted(xsrc, i) ? 'A' : ' ');
     }
 }
 
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 075499d36d..4b453997e7 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -10,6 +10,7 @@
 #include "qemu/log.h"
 #include "qapi/visitor.h"
 #include "qapi/error.h"
+#include "qapi/type-helpers.h"
 #include "monitor/monitor.h"
 #include "target/ppc/cpu.h"
 #include "hw/pci-host/pnv_phb4_regs.h"
@@ -1807,11 +1808,18 @@ void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon)
         phb->regs[PHB_INT_NOTIFY_ADDR >> 3] & ~PHB_INT_NOTIFY_ADDR_64K;
     uint32_t offset = phb->regs[PHB_INT_NOTIFY_INDEX >> 3];
     bool abt = !!(phb->regs[PHB_CTRLR >> 3] & PHB_CTRLR_IRQ_ABT_MODE);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
-    monitor_printf(mon, "PHB4[%x:%x] Source %08x .. %08x %s @%"HWADDR_PRIx"\n",
-                   phb->chip_id, phb->phb_id,
-                   offset, offset + phb->xsrc.nr_irqs - 1,
-                   abt ? "ABT" : "",
-                   notif_port);
-    xive_source_pic_print_info(&phb->xsrc, 0, mon);
+    g_string_append_printf(buf,
+                           "PHB4[%x:%x] Source %08x .. %08x "
+                           "%s @%"HWADDR_PRIx"\n",
+                           phb->chip_id, phb->phb_id,
+                           offset, offset + phb->xsrc.nr_irqs - 1,
+                           abt ? "ABT" : "",
+                           notif_port);
+    xive_source_pic_print_info(&phb->xsrc, 0, buf);
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c
index 26460d210d..922ac07b2f 100644
--- a/hw/ppc/pnv_psi.c
+++ b/hw/ppc/pnv_psi.c
@@ -25,6 +25,7 @@
 #include "qemu/module.h"
 #include "sysemu/reset.h"
 #include "qapi/error.h"
+#include "qapi/type-helpers.h"
 #include "monitor/monitor.h"
 
 
@@ -980,11 +981,16 @@ type_init(pnv_psi_register_types);
 void pnv_psi_pic_print_info(Pnv9Psi *psi9, Monitor *mon)
 {
     PnvPsi *psi = PNV_PSI(psi9);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
     uint32_t offset =
         (psi->regs[PSIHB_REG(PSIHB9_IVT_OFFSET)] >> PSIHB9_IVT_OFF_SHIFT);
 
-    monitor_printf(mon, "PSIHB Source %08x .. %08x\n",
-                  offset, offset + psi9->source.nr_irqs - 1);
-    xive_source_pic_print_info(&psi9->source, offset, mon);
+    g_string_append_printf(buf, "PSIHB Source %08x .. %08x\n",
+                           offset, offset + psi9->source.nr_irqs - 1);
+    xive_source_pic_print_info(&psi9->source, offset, buf);
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 10/26] hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 09/26] hw/ppc: Avoid using Monitor in xive_source_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 11/26] hw/ppc: Avoid using Monitor in xive_eas_pic_print_info() Philippe Mathieu-Daudé
                   ` (22 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/pci-host/pnv_phb4.h | 2 +-
 hw/pci-host/pnv_phb4.c         | 9 +--------
 hw/ppc/pnv.c                   | 6 +++++-
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 3212e68160..8abee78e4d 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -155,7 +155,7 @@ struct PnvPHB4 {
     QLIST_HEAD(, PnvPhb4DMASpace) dma_spaces;
 };
 
-void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon);
+void pnv_phb4_pic_print_info(PnvPHB4 *phb, GString *buf);
 int pnv_phb4_pec_get_phb_id(PnvPhb4PecState *pec, int stack_index);
 PnvPhb4PecState *pnv_pec_add_phb(PnvChip *chip, PnvPHB *phb, Error **errp);
 void pnv_phb4_bus_init(DeviceState *dev, PnvPHB4 *phb);
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 4b453997e7..99991008c1 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -10,8 +10,6 @@
 #include "qemu/log.h"
 #include "qapi/visitor.h"
 #include "qapi/error.h"
-#include "qapi/type-helpers.h"
-#include "monitor/monitor.h"
 #include "target/ppc/cpu.h"
 #include "hw/pci-host/pnv_phb4_regs.h"
 #include "hw/pci-host/pnv_phb4.h"
@@ -1802,14 +1800,12 @@ static void pnv_phb4_register_types(void)
 
 type_init(pnv_phb4_register_types);
 
-void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon)
+void pnv_phb4_pic_print_info(PnvPHB4 *phb, GString *buf)
 {
     uint64_t notif_port =
         phb->regs[PHB_INT_NOTIFY_ADDR >> 3] & ~PHB_INT_NOTIFY_ADDR_64K;
     uint32_t offset = phb->regs[PHB_INT_NOTIFY_INDEX >> 3];
     bool abt = !!(phb->regs[PHB_CTRLR >> 3] & PHB_CTRLR_IRQ_ABT_MODE);
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     g_string_append_printf(buf,
                            "PHB4[%x:%x] Source %08x .. %08x "
@@ -1819,7 +1815,4 @@ void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon)
                            abt ? "ABT" : "",
                            notif_port);
     xive_source_pic_print_info(&phb->xsrc, 0, buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index aed6767c8d..df187c5180 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -791,12 +791,16 @@ static int pnv_chip_power9_pic_print_info_child(Object *child, void *opaque)
 {
     Monitor *mon = opaque;
     PnvPHB *phb =  (PnvPHB *) object_dynamic_cast(child, TYPE_PNV_PHB);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
     if (!phb) {
         return 0;
     }
 
-    pnv_phb4_pic_print_info(PNV_PHB4(phb->backend), mon);
+    pnv_phb4_pic_print_info(PNV_PHB4(phb->backend), buf);
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     return 0;
 }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 11/26] hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 10/26] hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 12/26] hw/ppc: Avoid using Monitor in xive_end_pic_print_info() Philippe Mathieu-Daudé
                   ` (21 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive_regs.h |  2 +-
 hw/intc/pnv_xive.c         | 10 +++++-----
 hw/intc/xive.c             | 12 ++++++------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/include/hw/ppc/xive_regs.h b/include/hw/ppc/xive_regs.h
index 51e9a2152e..dd4a76bcf0 100644
--- a/include/hw/ppc/xive_regs.h
+++ b/include/hw/ppc/xive_regs.h
@@ -167,7 +167,7 @@ typedef struct XiveEAS {
 #define xive_eas_is_valid(eas)   (be64_to_cpu((eas)->w) & EAS_VALID)
 #define xive_eas_is_masked(eas)  (be64_to_cpu((eas)->w) & EAS_MASKED)
 
-void xive_eas_pic_print_info(XiveEAS *eas, uint32_t lisn, Monitor *mon);
+void xive_eas_pic_print_info(XiveEAS *eas, uint32_t lisn, GString *buf);
 
 static inline uint64_t xive_get_field64(uint64_t mask, uint64_t word)
 {
diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
index 520d7e0acd..c377823522 100644
--- a/hw/intc/pnv_xive.c
+++ b/hw/intc/pnv_xive.c
@@ -1864,19 +1864,19 @@ void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
     g_string_append_printf(buf, "XIVE[%x] #%d Source %08x .. %08x\n",
                            chip_id, blk, srcno0, srcno0 + nr_ipis - 1);
     xive_source_pic_print_info(&xive->ipi_source, srcno0, buf);
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 
-    monitor_printf(mon, "XIVE[%x] #%d EAT %08x .. %08x\n", chip_id, blk,
-                   srcno0, srcno0 + nr_ipis - 1);
+    g_string_append_printf(buf, "XIVE[%x] #%d EAT %08x .. %08x\n",
+                           chip_id, blk, srcno0, srcno0 + nr_ipis - 1);
     for (i = 0; i < nr_ipis; i++) {
         if (xive_router_get_eas(xrtr, blk, i, &eas)) {
             break;
         }
         if (!xive_eas_is_masked(&eas)) {
-            xive_eas_pic_print_info(&eas, i, mon);
+            xive_eas_pic_print_info(&eas, i, buf);
         }
     }
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     monitor_printf(mon, "XIVE[%x] #%d ENDT\n", chip_id, blk);
     i = 0;
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index 1adb0439c5..b2203b721b 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -1921,17 +1921,17 @@ static const TypeInfo xive_router_info = {
     }
 };
 
-void xive_eas_pic_print_info(XiveEAS *eas, uint32_t lisn, Monitor *mon)
+void xive_eas_pic_print_info(XiveEAS *eas, uint32_t lisn, GString *buf)
 {
     if (!xive_eas_is_valid(eas)) {
         return;
     }
 
-    monitor_printf(mon, "  %08x %s end:%02x/%04x data:%08x\n",
-                   lisn, xive_eas_is_masked(eas) ? "M" : " ",
-                   (uint8_t)  xive_get_field64(EAS_END_BLOCK, eas->w),
-                   (uint32_t) xive_get_field64(EAS_END_INDEX, eas->w),
-                   (uint32_t) xive_get_field64(EAS_END_DATA, eas->w));
+    g_string_append_printf(buf, "  %08x %s end:%02x/%04x data:%08x\n",
+                           lisn, xive_eas_is_masked(eas) ? "M" : " ",
+                           (uint8_t)  xive_get_field64(EAS_END_BLOCK, eas->w),
+                           (uint32_t) xive_get_field64(EAS_END_INDEX, eas->w),
+                           (uint32_t) xive_get_field64(EAS_END_DATA, eas->w));
 }
 
 /*
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 12/26] hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 11/26] hw/ppc: Avoid using Monitor in xive_eas_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 13/26] hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info() Philippe Mathieu-Daudé
                   ` (20 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive_regs.h |  2 +-
 hw/intc/pnv_xive.c         |  8 ++++----
 hw/intc/xive.c             | 40 +++++++++++++++++---------------------
 3 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/include/hw/ppc/xive_regs.h b/include/hw/ppc/xive_regs.h
index dd4a76bcf0..5e6f9d1be4 100644
--- a/include/hw/ppc/xive_regs.h
+++ b/include/hw/ppc/xive_regs.h
@@ -261,7 +261,7 @@ static inline uint64_t xive_end_qaddr(XiveEND *end)
         be32_to_cpu(end->w3);
 }
 
-void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon);
+void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, GString *buf);
 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);
 
diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
index c377823522..1dddbf7827 100644
--- a/hw/intc/pnv_xive.c
+++ b/hw/intc/pnv_xive.c
@@ -1875,14 +1875,14 @@ void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
             xive_eas_pic_print_info(&eas, i, buf);
         }
     }
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 
-    monitor_printf(mon, "XIVE[%x] #%d ENDT\n", chip_id, blk);
+    g_string_append_printf(buf, "XIVE[%x] #%d ENDT\n", chip_id, blk);
     i = 0;
     while (!xive_router_get_end(xrtr, blk, i, &end)) {
-        xive_end_pic_print_info(&end, i++, mon);
+        xive_end_pic_print_info(&end, i++, buf);
     }
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     monitor_printf(mon, "XIVE[%x] #%d END Escalation EAT\n", chip_id, blk);
     i = 0;
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index b2203b721b..f631d7cd6e 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -11,7 +11,6 @@
 #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"
@@ -1352,7 +1351,7 @@ void xive_end_queue_pic_print_info(XiveEND *end, uint32_t width, GString *buf)
     g_string_append_c(buf, ']');
 }
 
-void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon)
+void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, GString *buf)
 {
     uint64_t qaddr_base = xive_end_qaddr(end);
     uint32_t qindex = xive_get_field32(END_W1_PAGE_OFF, end->w1);
@@ -1364,8 +1363,6 @@ 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;
@@ -1373,28 +1370,27 @@ void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, Monitor *mon)
 
     pq = xive_get_field32(END_W1_ESn, end->w1);
 
-    monitor_printf(mon, "  %08x %c%c %c%c%c%c%c%c%c%c prio:%d nvt:%02x/%04x",
-                   end_idx,
-                   pq & XIVE_ESB_VAL_P ? 'P' : '-',
-                   pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
-                   xive_end_is_valid(end)    ? 'v' : '-',
-                   xive_end_is_enqueue(end)  ? 'q' : '-',
-                   xive_end_is_notify(end)   ? 'n' : '-',
-                   xive_end_is_backlog(end)  ? 'b' : '-',
-                   xive_end_is_escalate(end) ? 'e' : '-',
-                   xive_end_is_uncond_escalation(end)   ? 'u' : '-',
-                   xive_end_is_silent_escalation(end)   ? 's' : '-',
-                   xive_end_is_firmware(end)   ? 'f' : '-',
-                   priority, nvt_blk, nvt_idx);
+    g_string_append_printf(buf,
+                           "  %08x %c%c %c%c%c%c%c%c%c%c prio:%d nvt:%02x/%04x",
+                           end_idx,
+                           pq & XIVE_ESB_VAL_P ? 'P' : '-',
+                           pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
+                           xive_end_is_valid(end)    ? 'v' : '-',
+                           xive_end_is_enqueue(end)  ? 'q' : '-',
+                           xive_end_is_notify(end)   ? 'n' : '-',
+                           xive_end_is_backlog(end)  ? 'b' : '-',
+                           xive_end_is_escalate(end) ? 'e' : '-',
+                           xive_end_is_uncond_escalation(end)   ? 'u' : '-',
+                           xive_end_is_silent_escalation(end)   ? 's' : '-',
+                           xive_end_is_firmware(end)   ? 'f' : '-',
+                           priority, nvt_blk, nvt_idx);
 
     if (qaddr_base) {
-        monitor_printf(mon, " eq:@%08"PRIx64"% 6d/%5d ^%d",
-                       qaddr_base, qindex, qentries, qgen);
+        g_string_append_printf(buf, " eq:@%08"PRIx64"% 6d/%5d ^%d",
+                               qaddr_base, qindex, qentries, qgen);
         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");
+    g_string_append_c(buf, '\n');
 }
 
 static void xive_end_enqueue(XiveEND *end, uint32_t data)
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 13/26] hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 12/26] hw/ppc: Avoid using Monitor in xive_end_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 14/26] hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info() Philippe Mathieu-Daudé
                   ` (19 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive_regs.h |  2 +-
 hw/intc/pnv_xive.c         |  9 +++++----
 hw/intc/xive.c             | 22 ++++++++++------------
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/include/hw/ppc/xive_regs.h b/include/hw/ppc/xive_regs.h
index 5e6f9d1be4..b9db7abc2e 100644
--- a/include/hw/ppc/xive_regs.h
+++ b/include/hw/ppc/xive_regs.h
@@ -263,7 +263,7 @@ static inline uint64_t xive_end_qaddr(XiveEND *end)
 
 void xive_end_pic_print_info(XiveEND *end, uint32_t end_idx, GString *buf);
 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);
+void xive_end_eas_pic_print_info(XiveEND *end, uint32_t end_idx, GString *buf);
 
 /* Notification Virtual Target (NVT) */
 typedef struct XiveNVT {
diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
index 1dddbf7827..a0c6dee5db 100644
--- a/hw/intc/pnv_xive.c
+++ b/hw/intc/pnv_xive.c
@@ -1881,14 +1881,15 @@ void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
     while (!xive_router_get_end(xrtr, blk, i, &end)) {
         xive_end_pic_print_info(&end, i++, buf);
     }
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 
-    monitor_printf(mon, "XIVE[%x] #%d END Escalation EAT\n", chip_id, blk);
+    g_string_append_printf(buf, "XIVE[%x] #%d END Escalation EAT\n",
+                           chip_id, blk);
     i = 0;
     while (!xive_router_get_end(xrtr, blk, i, &end)) {
-        xive_end_eas_pic_print_info(&end, i++, mon);
+        xive_end_eas_pic_print_info(&end, i++, buf);
     }
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     monitor_printf(mon, "XIVE[%x] #%d NVTT %08x .. %08x\n", chip_id, blk,
                    0, XIVE_NVT_COUNT - 1);
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index f631d7cd6e..70f11f993b 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -17,7 +17,6 @@
 #include "sysemu/reset.h"
 #include "hw/qdev-properties.h"
 #include "migration/vmstate.h"
-#include "monitor/monitor.h"
 #include "hw/irq.h"
 #include "hw/ppc/xive.h"
 #include "hw/ppc/xive2.h"
@@ -1419,8 +1418,7 @@ static void xive_end_enqueue(XiveEND *end, uint32_t data)
     end->w1 = xive_set_field32(END_W1_PAGE_OFF, end->w1, qindex);
 }
 
-void xive_end_eas_pic_print_info(XiveEND *end, uint32_t end_idx,
-                                   Monitor *mon)
+void xive_end_eas_pic_print_info(XiveEND *end, uint32_t end_idx, GString *buf)
 {
     XiveEAS *eas = (XiveEAS *) &end->w4;
     uint8_t pq;
@@ -1431,15 +1429,15 @@ void xive_end_eas_pic_print_info(XiveEND *end, uint32_t end_idx,
 
     pq = xive_get_field32(END_W1_ESe, end->w1);
 
-    monitor_printf(mon, "  %08x %c%c %c%c end:%02x/%04x data:%08x\n",
-                   end_idx,
-                   pq & XIVE_ESB_VAL_P ? 'P' : '-',
-                   pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
-                   xive_eas_is_valid(eas) ? 'V' : ' ',
-                   xive_eas_is_masked(eas) ? 'M' : ' ',
-                   (uint8_t)  xive_get_field64(EAS_END_BLOCK, eas->w),
-                   (uint32_t) xive_get_field64(EAS_END_INDEX, eas->w),
-                   (uint32_t) xive_get_field64(EAS_END_DATA, eas->w));
+    g_string_append_printf(buf, "  %08x %c%c %c%c end:%02x/%04x data:%08x\n",
+                           end_idx,
+                           pq & XIVE_ESB_VAL_P ? 'P' : '-',
+                           pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
+                           xive_eas_is_valid(eas) ? 'V' : ' ',
+                           xive_eas_is_masked(eas) ? 'M' : ' ',
+                           (uint8_t)  xive_get_field64(EAS_END_BLOCK, eas->w),
+                           (uint32_t) xive_get_field64(EAS_END_INDEX, eas->w),
+                           (uint32_t) xive_get_field64(EAS_END_DATA, eas->w));
 }
 
 /*
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 14/26] hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (12 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 13/26] hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 15/26] hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info() Philippe Mathieu-Daudé
                   ` (18 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/intc/pnv_xive.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
index a0c6dee5db..3ad4ac8e7d 100644
--- a/hw/intc/pnv_xive.c
+++ b/hw/intc/pnv_xive.c
@@ -1832,7 +1832,7 @@ static const MemoryRegionOps pnv_xive_pc_ops = {
 };
 
 static void xive_nvt_pic_print_info(XiveNVT *nvt, uint32_t nvt_idx,
-                                    Monitor *mon)
+                                    GString *buf)
 {
     uint8_t  eq_blk = xive_get_field32(NVT_W1_EQ_BLOCK, nvt->w1);
     uint32_t eq_idx = xive_get_field32(NVT_W1_EQ_INDEX, nvt->w1);
@@ -1841,9 +1841,9 @@ static void xive_nvt_pic_print_info(XiveNVT *nvt, uint32_t nvt_idx,
         return;
     }
 
-    monitor_printf(mon, "  %08x end:%02x/%04x IPB:%02x\n", nvt_idx,
-                   eq_blk, eq_idx,
-                   xive_get_field32(NVT_W4_IPB, nvt->w4));
+    g_string_append_printf(buf, "  %08x end:%02x/%04x IPB:%02x\n",
+                           nvt_idx, eq_blk, eq_idx,
+                           xive_get_field32(NVT_W4_IPB, nvt->w4));
 }
 
 void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
@@ -1888,17 +1888,18 @@ void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
     while (!xive_router_get_end(xrtr, blk, i, &end)) {
         xive_end_eas_pic_print_info(&end, i++, buf);
     }
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 
-    monitor_printf(mon, "XIVE[%x] #%d NVTT %08x .. %08x\n", chip_id, blk,
-                   0, XIVE_NVT_COUNT - 1);
+    g_string_append_printf(buf, "XIVE[%x] #%d NVTT %08x .. %08x\n",
+                           chip_id, blk, 0, XIVE_NVT_COUNT - 1);
     xive_nvt_per_subpage = pnv_xive_vst_per_subpage(xive, VST_TSEL_VPDT);
     for (i = 0; i < XIVE_NVT_COUNT; i += xive_nvt_per_subpage) {
         while (!xive_router_get_nvt(xrtr, blk, i, &nvt)) {
-            xive_nvt_pic_print_info(&nvt, i++, mon);
+            xive_nvt_pic_print_info(&nvt, i++, buf);
         }
     }
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 static void pnv_xive_reset(void *dev)
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 15/26] hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (13 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 14/26] hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 16/26] hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info() Philippe Mathieu-Daudé
                   ` (17 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/pnv_xive.h | 2 +-
 hw/intc/pnv_xive.c        | 9 +--------
 hw/ppc/pnv.c              | 8 +++++++-
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/include/hw/ppc/pnv_xive.h b/include/hw/ppc/pnv_xive.h
index 9c48430ee4..7d634e469c 100644
--- a/include/hw/ppc/pnv_xive.h
+++ b/include/hw/ppc/pnv_xive.h
@@ -93,7 +93,7 @@ struct PnvXiveClass {
     DeviceRealize parent_realize;
 };
 
-void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon);
+void pnv_xive_pic_print_info(PnvXive *xive, GString *buf);
 
 /*
  * XIVE2 interrupt controller (POWER10)
diff --git a/hw/intc/pnv_xive.c b/hw/intc/pnv_xive.c
index 3ad4ac8e7d..5bacbce6a4 100644
--- a/hw/intc/pnv_xive.c
+++ b/hw/intc/pnv_xive.c
@@ -11,12 +11,10 @@
 #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"
 #include "sysemu/reset.h"
-#include "monitor/monitor.h"
 #include "hw/ppc/fdt.h"
 #include "hw/ppc/pnv.h"
 #include "hw/ppc/pnv_chip.h"
@@ -1846,7 +1844,7 @@ static void xive_nvt_pic_print_info(XiveNVT *nvt, uint32_t nvt_idx,
                            xive_get_field32(NVT_W4_IPB, nvt->w4));
 }
 
-void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
+void pnv_xive_pic_print_info(PnvXive *xive, GString *buf)
 {
     XiveRouter *xrtr = XIVE_ROUTER(xive);
     uint8_t blk = pnv_xive_block_id(xive);
@@ -1858,8 +1856,6 @@ void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
     XiveNVT nvt;
     int i;
     uint64_t xive_nvt_per_subpage;
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     g_string_append_printf(buf, "XIVE[%x] #%d Source %08x .. %08x\n",
                            chip_id, blk, srcno0, srcno0 + nr_ipis - 1);
@@ -1897,9 +1893,6 @@ void pnv_xive_pic_print_info(PnvXive *xive, Monitor *mon)
             xive_nvt_pic_print_info(&nvt, i++, buf);
         }
     }
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 static void pnv_xive_reset(void *dev)
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index df187c5180..7e6f923c7e 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -808,8 +808,14 @@ static int pnv_chip_power9_pic_print_info_child(Object *child, void *opaque)
 static void pnv_chip_power9_pic_print_info(PnvChip *chip, Monitor *mon)
 {
     Pnv9Chip *chip9 = PNV9_CHIP(chip);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
+
+    pnv_xive_pic_print_info(&chip9->xive, buf);
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
-    pnv_xive_pic_print_info(&chip9->xive, mon);
     pnv_psi_pic_print_info(&chip9->psi, mon);
 
     object_child_foreach_recursive(OBJECT(chip),
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 16/26] hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (14 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 15/26] hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 17/26] hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info() Philippe Mathieu-Daudé
                   ` (16 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/pnv_psi.h |  2 +-
 hw/ppc/pnv.c             | 10 +++++++---
 hw/ppc/pnv_psi.c         |  9 +--------
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/include/hw/ppc/pnv_psi.h b/include/hw/ppc/pnv_psi.h
index 2a6f715350..cf7f95a6b1 100644
--- a/include/hw/ppc/pnv_psi.h
+++ b/include/hw/ppc/pnv_psi.h
@@ -110,6 +110,6 @@ typedef enum PnvPsiIrq {
 #define PSIHB9_IRQ_PSU          13
 #define PSIHB9_NUM_IRQS         14
 
-void pnv_psi_pic_print_info(Pnv9Psi *psi, Monitor *mon);
+void pnv_psi_pic_print_info(Pnv9Psi *psi, GString *buf);
 
 #endif /* PPC_PNV_PSI_H */
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 7e6f923c7e..4a1a302a25 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -812,12 +812,11 @@ static void pnv_chip_power9_pic_print_info(PnvChip *chip, Monitor *mon)
     g_autoptr(HumanReadableText) info = NULL;
 
     pnv_xive_pic_print_info(&chip9->xive, buf);
+    pnv_psi_pic_print_info(&chip9->psi, buf);
 
     info = human_readable_text_from_str(buf);
     monitor_puts(mon, info->human_readable_text);
 
-    pnv_psi_pic_print_info(&chip9->psi, mon);
-
     object_child_foreach_recursive(OBJECT(chip),
                          pnv_chip_power9_pic_print_info_child, mon);
 }
@@ -862,9 +861,14 @@ static void pnv_ipmi_bt_init(ISABus *bus, IPMIBmc *bmc, uint32_t irq)
 static void pnv_chip_power10_pic_print_info(PnvChip *chip, Monitor *mon)
 {
     Pnv10Chip *chip10 = PNV10_CHIP(chip);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
     pnv_xive2_pic_print_info(&chip10->xive, mon);
-    pnv_psi_pic_print_info(&chip10->psi, mon);
+
+    pnv_psi_pic_print_info(&chip10->psi, buf);
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     object_child_foreach_recursive(OBJECT(chip),
                          pnv_chip_power9_pic_print_info_child, mon);
diff --git a/hw/ppc/pnv_psi.c b/hw/ppc/pnv_psi.c
index 922ac07b2f..18cc76a7e4 100644
--- a/hw/ppc/pnv_psi.c
+++ b/hw/ppc/pnv_psi.c
@@ -25,8 +25,6 @@
 #include "qemu/module.h"
 #include "sysemu/reset.h"
 #include "qapi/error.h"
-#include "qapi/type-helpers.h"
-#include "monitor/monitor.h"
 
 
 #include "hw/ppc/fdt.h"
@@ -978,11 +976,9 @@ static void pnv_psi_register_types(void)
 
 type_init(pnv_psi_register_types);
 
-void pnv_psi_pic_print_info(Pnv9Psi *psi9, Monitor *mon)
+void pnv_psi_pic_print_info(Pnv9Psi *psi9, GString *buf)
 {
     PnvPsi *psi = PNV_PSI(psi9);
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     uint32_t offset =
         (psi->regs[PSIHB_REG(PSIHB9_IVT_OFFSET)] >> PSIHB9_IVT_OFF_SHIFT);
@@ -990,7 +986,4 @@ void pnv_psi_pic_print_info(Pnv9Psi *psi9, Monitor *mon)
     g_string_append_printf(buf, "PSIHB Source %08x .. %08x\n",
                            offset, offset + psi9->source.nr_irqs - 1);
     xive_source_pic_print_info(&psi9->source, offset, buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 17/26] hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (15 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 16/26] hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 18/26] hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info() Philippe Mathieu-Daudé
                   ` (15 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive2_regs.h |  2 +-
 hw/intc/pnv_xive2.c         | 16 ++++++++--------
 hw/intc/xive2.c             | 12 ++++++------
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/hw/ppc/xive2_regs.h b/include/hw/ppc/xive2_regs.h
index 816f5d0e84..f662f0e325 100644
--- a/include/hw/ppc/xive2_regs.h
+++ b/include/hw/ppc/xive2_regs.h
@@ -48,7 +48,7 @@ typedef struct Xive2Eas {
 #define xive2_eas_is_valid(eas)   (be64_to_cpu((eas)->w) & EAS2_VALID)
 #define xive2_eas_is_masked(eas)  (be64_to_cpu((eas)->w) & EAS2_MASKED)
 
-void xive2_eas_pic_print_info(Xive2Eas *eas, uint32_t lisn, Monitor *mon);
+void xive2_eas_pic_print_info(Xive2Eas *eas, uint32_t lisn, GString *buf);
 
 /*
  * Event Notifification Descriptor (END)
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index 83e0f6b09f..649e5001fd 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -2120,24 +2120,24 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon)
     g_autoptr(GString) buf = g_string_new("");
     g_autoptr(HumanReadableText) info = NULL;
 
-    monitor_printf(mon, "XIVE[%x] Source %08x .. %08x\n", blk, srcno0,
-                   srcno0 + nr_esbs - 1);
+    g_string_append_printf(buf, "XIVE[%x] Source %08x .. %08x\n",
+                           blk, srcno0, srcno0 + nr_esbs - 1);
     xive_source_pic_print_info(&xive->ipi_source, srcno0, buf);
 
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
-
-    monitor_printf(mon, "XIVE[%x] EAT %08x .. %08x\n", blk, srcno0,
-                   srcno0 + nr_esbs - 1);
+    g_string_append_printf(buf, "XIVE[%x] EAT %08x .. %08x\n",
+                           blk, srcno0, srcno0 + nr_esbs - 1);
     for (i = 0; i < nr_esbs; i++) {
         if (xive2_router_get_eas(xrtr, blk, i, &eas)) {
             break;
         }
         if (!xive2_eas_is_masked(&eas)) {
-            xive2_eas_pic_print_info(&eas, i, mon);
+            xive2_eas_pic_print_info(&eas, i, buf);
         }
     }
 
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
+
     monitor_printf(mon, "XIVE[%x] #%d END Escalation EAT\n", chip_id, blk);
     i = 0;
     while (!xive2_router_get_end(xrtr, blk, i, &end)) {
diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c
index 98c0d8ba44..0154ebb59c 100644
--- a/hw/intc/xive2.c
+++ b/hw/intc/xive2.c
@@ -27,17 +27,17 @@ uint32_t xive2_router_get_config(Xive2Router *xrtr)
     return xrc->get_config(xrtr);
 }
 
-void xive2_eas_pic_print_info(Xive2Eas *eas, uint32_t lisn, Monitor *mon)
+void xive2_eas_pic_print_info(Xive2Eas *eas, uint32_t lisn, GString *buf)
 {
     if (!xive2_eas_is_valid(eas)) {
         return;
     }
 
-    monitor_printf(mon, "  %08x %s end:%02x/%04x data:%08x\n",
-                   lisn, xive2_eas_is_masked(eas) ? "M" : " ",
-                   (uint8_t)  xive_get_field64(EAS2_END_BLOCK, eas->w),
-                   (uint32_t) xive_get_field64(EAS2_END_INDEX, eas->w),
-                   (uint32_t) xive_get_field64(EAS2_END_DATA, eas->w));
+    g_string_append_printf(buf, "  %08x %s end:%02x/%04x data:%08x\n",
+                           lisn, xive2_eas_is_masked(eas) ? "M" : " ",
+                           (uint8_t)  xive_get_field64(EAS2_END_BLOCK, eas->w),
+                           (uint32_t) xive_get_field64(EAS2_END_INDEX, eas->w),
+                           (uint32_t) xive_get_field64(EAS2_END_DATA, eas->w));
 }
 
 void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 18/26] hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (16 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 17/26] hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 19/26] hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info() Philippe Mathieu-Daudé
                   ` (14 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive2_regs.h |  2 +-
 hw/intc/pnv_xive2.c         | 10 +++++-----
 hw/intc/xive2.c             | 20 ++++++++++----------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/hw/ppc/xive2_regs.h b/include/hw/ppc/xive2_regs.h
index f662f0e325..37f572ed6d 100644
--- a/include/hw/ppc/xive2_regs.h
+++ b/include/hw/ppc/xive2_regs.h
@@ -134,7 +134,7 @@ void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, Monitor *mon);
 void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width,
                                     Monitor *mon);
 void xive2_end_eas_pic_print_info(Xive2End *end, uint32_t end_idx,
-                                   Monitor *mon);
+                                  GString *buf);
 
 /*
  * Notification Virtual Processor (NVP)
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index 649e5001fd..9535f60828 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -2135,14 +2135,14 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon)
         }
     }
 
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
-
-    monitor_printf(mon, "XIVE[%x] #%d END Escalation EAT\n", chip_id, blk);
+    g_string_append_printf(buf, "XIVE[%x] #%d END Escalation EAT\n",
+                           chip_id, blk);
     i = 0;
     while (!xive2_router_get_end(xrtr, blk, i, &end)) {
-        xive2_end_eas_pic_print_info(&end, i++, mon);
+        xive2_end_eas_pic_print_info(&end, i++, buf);
     }
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     monitor_printf(mon, "XIVE[%x] #%d ENDT\n", chip_id, blk);
     i = 0;
diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c
index 0154ebb59c..23356acff7 100644
--- a/hw/intc/xive2.c
+++ b/hw/intc/xive2.c
@@ -116,7 +116,7 @@ void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, Monitor *mon)
 }
 
 void xive2_end_eas_pic_print_info(Xive2End *end, uint32_t end_idx,
-                                  Monitor *mon)
+                                  GString *buf)
 {
     Xive2Eas *eas = (Xive2Eas *) &end->w4;
     uint8_t pq;
@@ -127,15 +127,15 @@ void xive2_end_eas_pic_print_info(Xive2End *end, uint32_t end_idx,
 
     pq = xive_get_field32(END2_W1_ESe, end->w1);
 
-    monitor_printf(mon, "  %08x %c%c %c%c end:%02x/%04x data:%08x\n",
-                   end_idx,
-                   pq & XIVE_ESB_VAL_P ? 'P' : '-',
-                   pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
-                   xive2_eas_is_valid(eas) ? 'v' : ' ',
-                   xive2_eas_is_masked(eas) ? 'M' : ' ',
-                   (uint8_t)  xive_get_field64(EAS2_END_BLOCK, eas->w),
-                   (uint32_t) xive_get_field64(EAS2_END_INDEX, eas->w),
-                   (uint32_t) xive_get_field64(EAS2_END_DATA, eas->w));
+    g_string_append_printf(buf, "  %08x %c%c %c%c end:%02x/%04x data:%08x\n",
+                           end_idx,
+                           pq & XIVE_ESB_VAL_P ? 'P' : '-',
+                           pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
+                           xive2_eas_is_valid(eas) ? 'v' : ' ',
+                           xive2_eas_is_masked(eas) ? 'M' : ' ',
+                           (uint8_t)  xive_get_field64(EAS2_END_BLOCK, eas->w),
+                           (uint32_t) xive_get_field64(EAS2_END_INDEX, eas->w),
+                           (uint32_t) xive_get_field64(EAS2_END_DATA, eas->w));
 }
 
 static void xive2_end_enqueue(Xive2End *end, uint32_t data)
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 19/26] hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (17 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 18/26] hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 20/26] hw/ppc: Avoid using Monitor in xive2_end_pic_print_info() Philippe Mathieu-Daudé
                   ` (13 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive2_regs.h |  2 +-
 hw/intc/xive2.c             | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/include/hw/ppc/xive2_regs.h b/include/hw/ppc/xive2_regs.h
index 37f572ed6d..4d32703c26 100644
--- a/include/hw/ppc/xive2_regs.h
+++ b/include/hw/ppc/xive2_regs.h
@@ -132,7 +132,7 @@ static inline uint64_t xive2_end_qaddr(Xive2End *end)
 
 void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, Monitor *mon);
 void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width,
-                                    Monitor *mon);
+                                    GString *buf);
 void xive2_end_eas_pic_print_info(Xive2End *end, uint32_t end_idx,
                                   GString *buf);
 
diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c
index 23356acff7..6a15b4d1e4 100644
--- a/hw/intc/xive2.c
+++ b/hw/intc/xive2.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"
@@ -40,8 +41,7 @@ void xive2_eas_pic_print_info(Xive2Eas *eas, uint32_t lisn, GString *buf)
                            (uint32_t) xive_get_field64(EAS2_END_DATA, eas->w));
 }
 
-void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width,
-                                    Monitor *mon)
+void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width, GString *buf)
 {
     uint64_t qaddr_base = xive2_end_qaddr(end);
     uint32_t qsize = xive_get_field32(END2_W3_QSIZE, end->w3);
@@ -52,7 +52,7 @@ void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width,
     /*
      * 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);
@@ -64,11 +64,11 @@ void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width,
                           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_printf(buf, "]");
 }
 
 void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, Monitor *mon)
@@ -108,9 +108,14 @@ void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, Monitor *mon)
                    priority, nvp_blk, nvp_idx);
 
     if (qaddr_base) {
+        g_autoptr(GString) buf = g_string_new("");
+        g_autoptr(HumanReadableText) info = NULL;
+
         monitor_printf(mon, " eq:@%08"PRIx64"% 6d/%5d ^%d",
                        qaddr_base, qindex, qentries, qgen);
-        xive2_end_queue_pic_print_info(end, 6, mon);
+        xive2_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



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 20/26] hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (18 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 19/26] hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:20 ` [PATCH 21/26] hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info() Philippe Mathieu-Daudé
                   ` (12 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/xive2_regs.h |  2 +-
 hw/intc/pnv_xive2.c         |  8 +++----
 hw/intc/xive2.c             | 48 ++++++++++++++++---------------------
 3 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/include/hw/ppc/xive2_regs.h b/include/hw/ppc/xive2_regs.h
index 4d32703c26..4e5e17cd89 100644
--- a/include/hw/ppc/xive2_regs.h
+++ b/include/hw/ppc/xive2_regs.h
@@ -130,7 +130,7 @@ static inline uint64_t xive2_end_qaddr(Xive2End *end)
         (be32_to_cpu(end->w3) & END2_W3_EQ_ADDR_LO);
 }
 
-void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, Monitor *mon);
+void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, GString *buf);
 void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width,
                                     GString *buf);
 void xive2_end_eas_pic_print_info(Xive2End *end, uint32_t end_idx,
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index 9535f60828..52505fd1a4 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -2141,14 +2141,14 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon)
     while (!xive2_router_get_end(xrtr, blk, i, &end)) {
         xive2_end_eas_pic_print_info(&end, i++, buf);
     }
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 
-    monitor_printf(mon, "XIVE[%x] #%d ENDT\n", chip_id, blk);
+    g_string_append_printf(buf, "XIVE[%x] #%d ENDT\n", chip_id, blk);
     i = 0;
     while (!xive2_router_get_end(xrtr, blk, i, &end)) {
-        xive2_end_pic_print_info(&end, i++, mon);
+        xive2_end_pic_print_info(&end, i++, buf);
     }
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 
     monitor_printf(mon, "XIVE[%x] #%d NVPT %08x .. %08x\n", chip_id, blk,
                    0, XIVE2_NVP_COUNT - 1);
diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c
index 6a15b4d1e4..3e7238c663 100644
--- a/hw/intc/xive2.c
+++ b/hw/intc/xive2.c
@@ -11,12 +11,10 @@
 #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"
 #include "hw/qdev-properties.h"
-#include "monitor/monitor.h"
 #include "hw/ppc/xive.h"
 #include "hw/ppc/xive2.h"
 #include "hw/ppc/xive2_regs.h"
@@ -71,7 +69,7 @@ void xive2_end_queue_pic_print_info(Xive2End *end, uint32_t width, GString *buf)
     g_string_append_printf(buf, "]");
 }
 
-void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, Monitor *mon)
+void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, GString *buf)
 {
     uint64_t qaddr_base = xive2_end_qaddr(end);
     uint32_t qindex = xive_get_field32(END2_W1_PAGE_OFF, end->w1);
@@ -90,34 +88,30 @@ void xive2_end_pic_print_info(Xive2End *end, uint32_t end_idx, Monitor *mon)
 
     pq = xive_get_field32(END2_W1_ESn, end->w1);
 
-    monitor_printf(mon,
-                   "  %08x %c%c %c%c%c%c%c%c%c%c%c%c prio:%d nvp:%02x/%04x",
-                   end_idx,
-                   pq & XIVE_ESB_VAL_P ? 'P' : '-',
-                   pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
-                   xive2_end_is_valid(end)    ? 'v' : '-',
-                   xive2_end_is_enqueue(end)  ? 'q' : '-',
-                   xive2_end_is_notify(end)   ? 'n' : '-',
-                   xive2_end_is_backlog(end)  ? 'b' : '-',
-                   xive2_end_is_escalate(end) ? 'e' : '-',
-                   xive2_end_is_escalate_end(end) ? 'N' : '-',
-                   xive2_end_is_uncond_escalation(end)   ? 'u' : '-',
-                   xive2_end_is_silent_escalation(end)   ? 's' : '-',
-                   xive2_end_is_firmware1(end)   ? 'f' : '-',
-                   xive2_end_is_firmware2(end)   ? 'F' : '-',
-                   priority, nvp_blk, nvp_idx);
+    g_string_append_printf(buf,
+                           "  %08x %c%c %c%c%c%c%c%c%c%c%c%c "
+                           "prio:%d nvp:%02x/%04x",
+                           end_idx,
+                           pq & XIVE_ESB_VAL_P ? 'P' : '-',
+                           pq & XIVE_ESB_VAL_Q ? 'Q' : '-',
+                           xive2_end_is_valid(end)    ? 'v' : '-',
+                           xive2_end_is_enqueue(end)  ? 'q' : '-',
+                           xive2_end_is_notify(end)   ? 'n' : '-',
+                           xive2_end_is_backlog(end)  ? 'b' : '-',
+                           xive2_end_is_escalate(end) ? 'e' : '-',
+                           xive2_end_is_escalate_end(end) ? 'N' : '-',
+                           xive2_end_is_uncond_escalation(end)   ? 'u' : '-',
+                           xive2_end_is_silent_escalation(end)   ? 's' : '-',
+                           xive2_end_is_firmware1(end)   ? 'f' : '-',
+                           xive2_end_is_firmware2(end)   ? 'F' : '-',
+                           priority, nvp_blk, nvp_idx);
 
     if (qaddr_base) {
-        g_autoptr(GString) buf = g_string_new("");
-        g_autoptr(HumanReadableText) info = NULL;
-
-        monitor_printf(mon, " eq:@%08"PRIx64"% 6d/%5d ^%d",
-                       qaddr_base, qindex, qentries, qgen);
+        g_string_append_printf(buf, " eq:@%08"PRIx64"% 6d/%5d ^%d",
+                               qaddr_base, qindex, qentries, qgen);
         xive2_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");
+    g_string_append_c(buf, '\n');
 }
 
 void xive2_end_eas_pic_print_info(Xive2End *end, uint32_t end_idx,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 21/26] hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (19 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 20/26] hw/ppc: Avoid using Monitor in xive2_end_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:20 ` Philippe Mathieu-Daudé
  2024-06-10  6:21 ` [PATCH 22/26] hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info() Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/intc/pnv_xive2.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index 52505fd1a4..10914b04df 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -2028,7 +2028,7 @@ static void pnv_xive2_register_types(void)
 type_init(pnv_xive2_register_types)
 
 static void xive2_nvp_pic_print_info(Xive2Nvp *nvp, uint32_t nvp_idx,
-                                     Monitor *mon)
+                                     GString *buf)
 {
     uint8_t  eq_blk = xive_get_field32(NVP2_W5_VP_END_BLOCK, nvp->w5);
     uint32_t eq_idx = xive_get_field32(NVP2_W5_VP_END_INDEX, nvp->w5);
@@ -2037,21 +2037,21 @@ static void xive2_nvp_pic_print_info(Xive2Nvp *nvp, uint32_t nvp_idx,
         return;
     }
 
-    monitor_printf(mon, "  %08x end:%02x/%04x IPB:%02x",
-                   nvp_idx, eq_blk, eq_idx,
-                   xive_get_field32(NVP2_W2_IPB, nvp->w2));
+    g_string_append_printf(buf, "  %08x end:%02x/%04x IPB:%02x",
+                           nvp_idx, eq_blk, eq_idx,
+                           xive_get_field32(NVP2_W2_IPB, nvp->w2));
     /*
      * When the NVP is HW controlled, more fields are updated
      */
     if (xive2_nvp_is_hw(nvp)) {
-        monitor_printf(mon, " CPPR:%02x",
-                       xive_get_field32(NVP2_W2_CPPR, nvp->w2));
+        g_string_append_printf(buf, " CPPR:%02x",
+                               xive_get_field32(NVP2_W2_CPPR, nvp->w2));
         if (xive2_nvp_is_co(nvp)) {
-            monitor_printf(mon, " CO:%04x",
-                           xive_get_field32(NVP2_W1_CO_THRID, nvp->w1));
+            g_string_append_printf(buf, " CO:%04x",
+                                   xive_get_field32(NVP2_W1_CO_THRID, nvp->w1));
         }
     }
-    monitor_printf(mon, "\n");
+    g_string_append_c(buf, '\n');
 }
 
 /*
@@ -2147,15 +2147,16 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon)
     while (!xive2_router_get_end(xrtr, blk, i, &end)) {
         xive2_end_pic_print_info(&end, i++, buf);
     }
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 
-    monitor_printf(mon, "XIVE[%x] #%d NVPT %08x .. %08x\n", chip_id, blk,
-                   0, XIVE2_NVP_COUNT - 1);
+    g_string_append_printf(buf, "XIVE[%x] #%d NVPT %08x .. %08x\n",
+                           chip_id, blk, 0, XIVE2_NVP_COUNT - 1);
     xive_nvp_per_subpage = pnv_xive2_vst_per_subpage(xive, VST_NVP);
     for (i = 0; i < XIVE2_NVP_COUNT; i += xive_nvp_per_subpage) {
         while (!xive2_router_get_nvp(xrtr, blk, i, &nvp)) {
-            xive2_nvp_pic_print_info(&nvp, i++, mon);
+            xive2_nvp_pic_print_info(&nvp, i++, buf);
         }
     }
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 22/26] hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (20 preceding siblings ...)
  2024-06-10  6:20 ` [PATCH 21/26] hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:21 ` Philippe Mathieu-Daudé
  2024-06-10  6:21 ` [PATCH 23/26] hw/ppc: Avoid using Monitor in SpaprInterruptControllerClass::print_info() Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/pnv_xive.h | 2 +-
 hw/intc/pnv_xive2.c       | 9 +--------
 hw/ppc/pnv.c              | 2 +-
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/include/hw/ppc/pnv_xive.h b/include/hw/ppc/pnv_xive.h
index 7d634e469c..5b4cb4167b 100644
--- a/include/hw/ppc/pnv_xive.h
+++ b/include/hw/ppc/pnv_xive.h
@@ -163,6 +163,6 @@ typedef struct PnvXive2Class {
     DeviceRealize parent_realize;
 } PnvXive2Class;
 
-void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon);
+void pnv_xive2_pic_print_info(PnvXive2 *xive, GString *buf);
 
 #endif /* PPC_PNV_XIVE_H */
diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c
index 10914b04df..2fb4fa29d4 100644
--- a/hw/intc/pnv_xive2.c
+++ b/hw/intc/pnv_xive2.c
@@ -10,11 +10,9 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "qapi/error.h"
-#include "qapi/type-helpers.h"
 #include "target/ppc/cpu.h"
 #include "sysemu/cpus.h"
 #include "sysemu/dma.h"
-#include "monitor/monitor.h"
 #include "hw/ppc/fdt.h"
 #include "hw/ppc/pnv.h"
 #include "hw/ppc/pnv_chip.h"
@@ -2105,7 +2103,7 @@ static uint64_t pnv_xive2_vst_per_subpage(PnvXive2 *xive, uint32_t type)
     return (1ull << page_shift) / info->size;
 }
 
-void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon)
+void pnv_xive2_pic_print_info(PnvXive2 *xive, GString *buf)
 {
     Xive2Router *xrtr = XIVE2_ROUTER(xive);
     uint8_t blk = pnv_xive2_block_id(xive);
@@ -2117,8 +2115,6 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon)
     Xive2Nvp nvp;
     int i;
     uint64_t xive_nvp_per_subpage;
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     g_string_append_printf(buf, "XIVE[%x] Source %08x .. %08x\n",
                            blk, srcno0, srcno0 + nr_esbs - 1);
@@ -2156,7 +2152,4 @@ void pnv_xive2_pic_print_info(PnvXive2 *xive, Monitor *mon)
             xive2_nvp_pic_print_info(&nvp, i++, buf);
         }
     }
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 4a1a302a25..5b9dbff754 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -864,7 +864,7 @@ static void pnv_chip_power10_pic_print_info(PnvChip *chip, Monitor *mon)
     g_autoptr(GString) buf = g_string_new("");
     g_autoptr(HumanReadableText) info = NULL;
 
-    pnv_xive2_pic_print_info(&chip10->xive, mon);
+    pnv_xive2_pic_print_info(&chip10->xive, buf);
 
     pnv_psi_pic_print_info(&chip10->psi, buf);
     info = human_readable_text_from_str(buf);
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 23/26] hw/ppc: Avoid using Monitor in SpaprInterruptControllerClass::print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (21 preceding siblings ...)
  2024-06-10  6:21 ` [PATCH 22/26] hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:21 ` Philippe Mathieu-Daudé
  2024-06-10  6:21 ` [PATCH 24/26] hw/ppc: Avoid using Monitor in spapr_irq_print_info() Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/spapr_irq.h | 2 +-
 hw/intc/spapr_xive.c       | 9 +--------
 hw/intc/xics_spapr.c       | 9 +--------
 hw/ppc/spapr_irq.c         | 8 +++++++-
 4 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
index 4fd2d5853d..6e50470cff 100644
--- a/include/hw/ppc/spapr_irq.h
+++ b/include/hw/ppc/spapr_irq.h
@@ -73,7 +73,7 @@ struct SpaprInterruptControllerClass {
 
     /* These methods should only be called on the active intc */
     void (*set_irq)(SpaprInterruptController *intc, int irq, int val);
-    void (*print_info)(SpaprInterruptController *intc, Monitor *mon);
+    void (*print_info)(SpaprInterruptController *intc, GString *buf);
     void (*dt)(SpaprInterruptController *intc, uint32_t nr_servers,
                void *fdt, uint32_t phandle);
     int (*post_load)(SpaprInterruptController *intc, int version_id);
diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
index 9d0d5948ff..283a6b8fd2 100644
--- a/hw/intc/spapr_xive.c
+++ b/hw/intc/spapr_xive.c
@@ -11,13 +11,11 @@
 #include "qemu/log.h"
 #include "qemu/module.h"
 #include "qapi/error.h"
-#include "qapi/type-helpers.h"
 #include "qemu/error-report.h"
 #include "target/ppc/cpu.h"
 #include "sysemu/cpus.h"
 #include "sysemu/reset.h"
 #include "migration/vmstate.h"
-#include "monitor/monitor.h"
 #include "hw/ppc/fdt.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_cpu_core.h"
@@ -701,12 +699,10 @@ static void spapr_xive_set_irq(SpaprInterruptController *intc, int irq, int val)
     }
 }
 
-static void spapr_xive_print_info(SpaprInterruptController *intc, Monitor *mon)
+static void spapr_xive_print_info(SpaprInterruptController *intc, GString *buf)
 {
     SpaprXive *xive = SPAPR_XIVE(intc);
     CPUState *cs;
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     CPU_FOREACH(cs) {
         PowerPCCPU *cpu = POWERPC_CPU(cs);
@@ -714,9 +710,6 @@ static void spapr_xive_print_info(SpaprInterruptController *intc, Monitor *mon)
         xive_tctx_pic_print_info(spapr_cpu_state(cpu)->tctx, buf);
     }
     spapr_xive_pic_print_info(xive, buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 static void spapr_xive_dt(SpaprInterruptController *intc, uint32_t nr_servers,
diff --git a/hw/intc/xics_spapr.c b/hw/intc/xics_spapr.c
index 1926373ebd..a0d97bdefe 100644
--- a/hw/intc/xics_spapr.c
+++ b/hw/intc/xics_spapr.c
@@ -34,8 +34,6 @@
 #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
@@ -397,12 +395,10 @@ static void xics_spapr_set_irq(SpaprInterruptController *intc, int irq, int val)
     ics_set_irq(ics, srcno, val);
 }
 
-static void xics_spapr_print_info(SpaprInterruptController *intc, Monitor *mon)
+static void xics_spapr_print_info(SpaprInterruptController *intc, GString *buf)
 {
     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);
@@ -410,9 +406,6 @@ static void xics_spapr_print_info(SpaprInterruptController *intc, Monitor *mon)
         icp_pic_print_info(spapr_cpu_state(cpu)->icp, buf);
     }
     ics_pic_print_info(ics, buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 static int xics_spapr_post_load(SpaprInterruptController *intc, int version_id)
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index 97b2fc42ab..b43917e7fe 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -11,6 +11,7 @@
 #include "qemu/log.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
+#include "qapi/type-helpers.h"
 #include "hw/irq.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_cpu_core.h"
@@ -18,6 +19,7 @@
 #include "hw/ppc/xics.h"
 #include "hw/ppc/xics_spapr.h"
 #include "hw/qdev-properties.h"
+#include "monitor/monitor.h"
 #include "cpu-models.h"
 #include "sysemu/kvm.h"
 
@@ -269,8 +271,12 @@ void spapr_irq_print_info(SpaprMachineState *spapr, Monitor *mon)
 {
     SpaprInterruptControllerClass *sicc
         = SPAPR_INTC_GET_CLASS(spapr->active_intc);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
-    sicc->print_info(spapr->active_intc, mon);
+    sicc->print_info(spapr->active_intc, buf);
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 void spapr_irq_dt(SpaprMachineState *spapr, uint32_t nr_servers,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 24/26] hw/ppc: Avoid using Monitor in spapr_irq_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (22 preceding siblings ...)
  2024-06-10  6:21 ` [PATCH 23/26] hw/ppc: Avoid using Monitor in SpaprInterruptControllerClass::print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:21 ` Philippe Mathieu-Daudé
  2024-06-10  6:21 ` [PATCH 25/26] hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child() Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/spapr_irq.h |  2 +-
 hw/ppc/spapr.c             | 11 ++++++++---
 hw/ppc/spapr_irq.c         |  8 +-------
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
index 6e50470cff..cb9a85f657 100644
--- a/include/hw/ppc/spapr_irq.h
+++ b/include/hw/ppc/spapr_irq.h
@@ -85,7 +85,7 @@ int spapr_irq_cpu_intc_create(struct SpaprMachineState *spapr,
                               PowerPCCPU *cpu, Error **errp);
 void spapr_irq_cpu_intc_reset(struct SpaprMachineState *spapr, PowerPCCPU *cpu);
 void spapr_irq_cpu_intc_destroy(struct SpaprMachineState *spapr, PowerPCCPU *cpu);
-void spapr_irq_print_info(struct SpaprMachineState *spapr, Monitor *mon);
+void spapr_irq_print_info(struct SpaprMachineState *spapr, GString *buf);
 void spapr_irq_dt(struct SpaprMachineState *spapr, uint32_t nr_servers,
                   void *fdt, uint32_t phandle);
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 81a187f126..cd9b811ac6 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -31,6 +31,7 @@
 #include "qapi/error.h"
 #include "qapi/qapi-events-machine.h"
 #include "qapi/qapi-events-qdev.h"
+#include "qapi/type-helpers.h"
 #include "qapi/visitor.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/hostmem.h"
@@ -4530,10 +4531,14 @@ static void spapr_pic_print_info(InterruptStatsProvider *obj,
                                  Monitor *mon)
 {
     SpaprMachineState *spapr = SPAPR_MACHINE(obj);
+    g_autoptr(GString) buf = g_string_new("");
+    g_autoptr(HumanReadableText) info = NULL;
 
-    spapr_irq_print_info(spapr, mon);
-    monitor_printf(mon, "irqchip: %s\n",
-                   kvm_irqchip_in_kernel() ? "in-kernel" : "emulated");
+    spapr_irq_print_info(spapr, buf);
+    g_string_append_printf(buf, "irqchip: %s\n",
+                           kvm_irqchip_in_kernel() ? "in-kernel" : "emulated");
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 /*
diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c
index b43917e7fe..aebd7eaabb 100644
--- a/hw/ppc/spapr_irq.c
+++ b/hw/ppc/spapr_irq.c
@@ -11,7 +11,6 @@
 #include "qemu/log.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
-#include "qapi/type-helpers.h"
 #include "hw/irq.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_cpu_core.h"
@@ -19,7 +18,6 @@
 #include "hw/ppc/xics.h"
 #include "hw/ppc/xics_spapr.h"
 #include "hw/qdev-properties.h"
-#include "monitor/monitor.h"
 #include "cpu-models.h"
 #include "sysemu/kvm.h"
 
@@ -267,16 +265,12 @@ static void spapr_set_irq(void *opaque, int irq, int level)
     sicc->set_irq(spapr->active_intc, irq, level);
 }
 
-void spapr_irq_print_info(SpaprMachineState *spapr, Monitor *mon)
+void spapr_irq_print_info(SpaprMachineState *spapr, GString *buf)
 {
     SpaprInterruptControllerClass *sicc
         = SPAPR_INTC_GET_CLASS(spapr->active_intc);
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     sicc->print_info(spapr->active_intc, buf);
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 void spapr_irq_dt(SpaprMachineState *spapr, uint32_t nr_servers,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 25/26] hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (23 preceding siblings ...)
  2024-06-10  6:21 ` [PATCH 24/26] hw/ppc: Avoid using Monitor in spapr_irq_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:21 ` Philippe Mathieu-Daudé
  2024-06-10  6:21 ` [PATCH 26/26] hw/ppc: Avoid using Monitor in pic_print_info() Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/ppc/pnv.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 5b9dbff754..9039c1777a 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -789,18 +789,14 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
 
 static int pnv_chip_power9_pic_print_info_child(Object *child, void *opaque)
 {
-    Monitor *mon = opaque;
+    GString *buf = opaque;
     PnvPHB *phb =  (PnvPHB *) object_dynamic_cast(child, TYPE_PNV_PHB);
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     if (!phb) {
         return 0;
     }
 
     pnv_phb4_pic_print_info(PNV_PHB4(phb->backend), buf);
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 
     return 0;
 }
@@ -813,12 +809,11 @@ static void pnv_chip_power9_pic_print_info(PnvChip *chip, Monitor *mon)
 
     pnv_xive_pic_print_info(&chip9->xive, buf);
     pnv_psi_pic_print_info(&chip9->psi, buf);
+    object_child_foreach_recursive(OBJECT(chip),
+                         pnv_chip_power9_pic_print_info_child, buf);
 
     info = human_readable_text_from_str(buf);
     monitor_puts(mon, info->human_readable_text);
-
-    object_child_foreach_recursive(OBJECT(chip),
-                         pnv_chip_power9_pic_print_info_child, mon);
 }
 
 static uint64_t pnv_chip_power8_xscom_core_base(PnvChip *chip,
@@ -865,13 +860,12 @@ static void pnv_chip_power10_pic_print_info(PnvChip *chip, Monitor *mon)
     g_autoptr(HumanReadableText) info = NULL;
 
     pnv_xive2_pic_print_info(&chip10->xive, buf);
-
     pnv_psi_pic_print_info(&chip10->psi, buf);
+    object_child_foreach_recursive(OBJECT(chip),
+                         pnv_chip_power9_pic_print_info_child, buf);
+
     info = human_readable_text_from_str(buf);
     monitor_puts(mon, info->human_readable_text);
-
-    object_child_foreach_recursive(OBJECT(chip),
-                         pnv_chip_power9_pic_print_info_child, mon);
 }
 
 /* Always give the first 1GB to chip 0 else we won't boot */
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 26/26] hw/ppc: Avoid using Monitor in pic_print_info()
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (24 preceding siblings ...)
  2024-06-10  6:21 ` [PATCH 25/26] hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child() Philippe Mathieu-Daudé
@ 2024-06-10  6:21 ` Philippe Mathieu-Daudé
  2024-06-10  6:24 ` [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater,
	Philippe Mathieu-Daudé

Replace Monitor API by HumanReadableText one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/ppc/pnv_chip.h |  2 +-
 hw/ppc/pnv.c              | 29 +++++++----------------------
 2 files changed, 8 insertions(+), 23 deletions(-)

diff --git a/include/hw/ppc/pnv_chip.h b/include/hw/ppc/pnv_chip.h
index a5e428be7c..a4ed17ac59 100644
--- a/include/hw/ppc/pnv_chip.h
+++ b/include/hw/ppc/pnv_chip.h
@@ -154,7 +154,7 @@ struct PnvChipClass {
     void (*intc_print_info)(PnvChip *chip, PowerPCCPU *cpu, GString *buf);
     ISABus *(*isa_create)(PnvChip *chip, Error **errp);
     void (*dt_populate)(PnvChip *chip, void *fdt);
-    void (*pic_print_info)(PnvChip *chip, Monitor *mon);
+    void (*pic_print_info)(PnvChip *chip, GString *buf);
     uint64_t (*xscom_core_base)(PnvChip *chip, uint32_t core_id);
     uint32_t (*xscom_pcba)(PnvChip *chip, uint64_t addr);
 };
diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
index 9039c1777a..df74f032d7 100644
--- a/hw/ppc/pnv.c
+++ b/hw/ppc/pnv.c
@@ -765,14 +765,11 @@ static ISABus *pnv_isa_create(PnvChip *chip, Error **errp)
     return PNV_CHIP_GET_CLASS(chip)->isa_create(chip, errp);
 }
 
-static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
+static void pnv_chip_power8_pic_print_info(PnvChip *chip, GString *buf)
 {
     Pnv8Chip *chip8 = PNV8_CHIP(chip);
     int i;
 
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
-
     ics_pic_print_info(&chip8->psi.ics, buf);
 
     for (i = 0; i < chip8->num_phbs; i++) {
@@ -782,9 +779,6 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
         pnv_phb3_msi_pic_print_info(&phb3->msis, buf);
         ics_pic_print_info(&phb3->lsis, buf);
     }
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 static int pnv_chip_power9_pic_print_info_child(Object *child, void *opaque)
@@ -801,19 +795,14 @@ static int pnv_chip_power9_pic_print_info_child(Object *child, void *opaque)
     return 0;
 }
 
-static void pnv_chip_power9_pic_print_info(PnvChip *chip, Monitor *mon)
+static void pnv_chip_power9_pic_print_info(PnvChip *chip, GString *buf)
 {
     Pnv9Chip *chip9 = PNV9_CHIP(chip);
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     pnv_xive_pic_print_info(&chip9->xive, buf);
     pnv_psi_pic_print_info(&chip9->psi, buf);
     object_child_foreach_recursive(OBJECT(chip),
                          pnv_chip_power9_pic_print_info_child, buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 static uint64_t pnv_chip_power8_xscom_core_base(PnvChip *chip,
@@ -853,19 +842,14 @@ static void pnv_ipmi_bt_init(ISABus *bus, IPMIBmc *bmc, uint32_t irq)
     isa_realize_and_unref(dev, bus, &error_fatal);
 }
 
-static void pnv_chip_power10_pic_print_info(PnvChip *chip, Monitor *mon)
+static void pnv_chip_power10_pic_print_info(PnvChip *chip, GString *buf)
 {
     Pnv10Chip *chip10 = PNV10_CHIP(chip);
-    g_autoptr(GString) buf = g_string_new("");
-    g_autoptr(HumanReadableText) info = NULL;
 
     pnv_xive2_pic_print_info(&chip10->xive, buf);
     pnv_psi_pic_print_info(&chip10->psi, buf);
     object_child_foreach_recursive(OBJECT(chip),
                          pnv_chip_power9_pic_print_info_child, buf);
-
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 }
 
 /* Always give the first 1GB to chip 0 else we won't boot */
@@ -2363,12 +2347,13 @@ static void pnv_pic_print_info(InterruptStatsProvider *obj,
         PNV_CHIP_GET_CLASS(pnv->chips[0])->intc_print_info(pnv->chips[0], cpu,
                                                            buf);
     }
-    info = human_readable_text_from_str(buf);
-    monitor_puts(mon, info->human_readable_text);
 
     for (i = 0; i < pnv->num_chips; i++) {
-        PNV_CHIP_GET_CLASS(pnv->chips[i])->pic_print_info(pnv->chips[i], mon);
+        PNV_CHIP_GET_CLASS(pnv->chips[i])->pic_print_info(pnv->chips[i], buf);
     }
+
+    info = human_readable_text_from_str(buf);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 static int pnv_match_nvt(XiveFabric *xfb, uint8_t format,
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (25 preceding siblings ...)
  2024-06-10  6:21 ` [PATCH 26/26] hw/ppc: Avoid using Monitor in pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-10  6:24 ` Philippe Mathieu-Daudé
  2024-06-10  8:16 ` Cédric Le Goater
                   ` (5 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-10  6:24 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater

On 10/6/24 08:20, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> This series remove uses of Monitor in hw/ppc/,
> replacing by the more generic HumanReadableText.
> Care is taken to keep the commit bisectables by
> updating functions one by one, also easing review.
> 
> For rationale see previous series from Daniel:
> https://lore.kernel.org/qemu-devel/20211028155457.967291-1-berrange@redhat.com/

Or more specifically commit f2de406f29 ("docs/devel: document
expectations for QAPI data modelling for QMP").

> 
> Regards,
> 
> Phil.



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (26 preceding siblings ...)
  2024-06-10  6:24 ` [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
@ 2024-06-10  8:16 ` Cédric Le Goater
  2024-06-10  8:19 ` Cédric Le Goater
                   ` (4 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Cédric Le Goater @ 2024-06-10  8:16 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza

On 6/10/24 8:20 AM, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> This series remove uses of Monitor in hw/ppc/,
> replacing by the more generic HumanReadableText.
> Care is taken to keep the commit bisectables by
> updating functions one by one, also easing review.
> 
> For rationale see previous series from Daniel:
> https://lore.kernel.org/qemu-devel/20211028155457.967291-1-berrange@redhat.com/

This looks OK to me but I think there are patches in the ppc queue
that will conflict. I would wait for Nick to send a PR first and
then rebase.

Thanks,

C.



> 
> Regards,
> 
> Phil.
> 
> Philippe Mathieu-Daudé (26):
>    hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
>    hw/ppc: Avoid using Monitor in icp_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
>    hw/ppc: Avoid using Monitor in ics_pic_print_info()
>    hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
>    hw/ppc: Avoid using Monitor in
>      SpaprInterruptControllerClass::print_info()
>    hw/ppc: Avoid using Monitor in spapr_irq_print_info()
>    hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
>    hw/ppc: Avoid using Monitor in pic_print_info()
> 
>   include/hw/pci-host/pnv_phb3.h |   2 +-
>   include/hw/pci-host/pnv_phb4.h |   2 +-
>   include/hw/ppc/pnv_chip.h      |   4 +-
>   include/hw/ppc/pnv_psi.h       |   2 +-
>   include/hw/ppc/pnv_xive.h      |   4 +-
>   include/hw/ppc/spapr_irq.h     |   4 +-
>   include/hw/ppc/xics.h          |   4 +-
>   include/hw/ppc/xive.h          |   4 +-
>   include/hw/ppc/xive2_regs.h    |   8 +--
>   include/hw/ppc/xive_regs.h     |   8 +--
>   hw/intc/pnv_xive.c             |  38 ++++++------
>   hw/intc/pnv_xive2.c            |  48 +++++++--------
>   hw/intc/spapr_xive.c           |  41 ++++++-------
>   hw/intc/xics.c                 |  25 ++++----
>   hw/intc/xics_spapr.c           |   7 +--
>   hw/intc/xive.c                 | 108 ++++++++++++++++-----------------
>   hw/intc/xive2.c                |  87 +++++++++++++-------------
>   hw/pci-host/pnv_phb3_msi.c     |  21 +++----
>   hw/pci-host/pnv_phb4.c         |  17 +++---
>   hw/ppc/pnv.c                   |  52 ++++++++--------
>   hw/ppc/pnv_psi.c               |   9 ++-
>   hw/ppc/spapr.c                 |  11 +++-
>   hw/ppc/spapr_irq.c             |   4 +-
>   23 files changed, 256 insertions(+), 254 deletions(-)
> 



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (27 preceding siblings ...)
  2024-06-10  8:16 ` Cédric Le Goater
@ 2024-06-10  8:19 ` Cédric Le Goater
  2024-06-13  9:48   ` Philippe Mathieu-Daudé
  2024-06-12  5:48 ` Manos Pitsidianakis
                   ` (3 subsequent siblings)
  32 siblings, 1 reply; 47+ messages in thread
From: Cédric Le Goater @ 2024-06-10  8:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza

On 6/10/24 8:20 AM, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> This series remove uses of Monitor in hw/ppc/,
> replacing by the more generic HumanReadableText.
> Care is taken to keep the commit bisectables by
> updating functions one by one, also easing review.

Did you do any testing ? POWER[8-10] CPUs on pseries and powernv machines
should be checked. A bit tedious I agree but not that long.

Thanks,

C.


> 
> For rationale see previous series from Daniel:
> https://lore.kernel.org/qemu-devel/20211028155457.967291-1-berrange@redhat.com/
> 
> Regards,
> 
> Phil.
> 
> Philippe Mathieu-Daudé (26):
>    hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
>    hw/ppc: Avoid using Monitor in icp_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
>    hw/ppc: Avoid using Monitor in ics_pic_print_info()
>    hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
>    hw/ppc: Avoid using Monitor in
>      SpaprInterruptControllerClass::print_info()
>    hw/ppc: Avoid using Monitor in spapr_irq_print_info()
>    hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
>    hw/ppc: Avoid using Monitor in pic_print_info()
> 
>   include/hw/pci-host/pnv_phb3.h |   2 +-
>   include/hw/pci-host/pnv_phb4.h |   2 +-
>   include/hw/ppc/pnv_chip.h      |   4 +-
>   include/hw/ppc/pnv_psi.h       |   2 +-
>   include/hw/ppc/pnv_xive.h      |   4 +-
>   include/hw/ppc/spapr_irq.h     |   4 +-
>   include/hw/ppc/xics.h          |   4 +-
>   include/hw/ppc/xive.h          |   4 +-
>   include/hw/ppc/xive2_regs.h    |   8 +--
>   include/hw/ppc/xive_regs.h     |   8 +--
>   hw/intc/pnv_xive.c             |  38 ++++++------
>   hw/intc/pnv_xive2.c            |  48 +++++++--------
>   hw/intc/spapr_xive.c           |  41 ++++++-------
>   hw/intc/xics.c                 |  25 ++++----
>   hw/intc/xics_spapr.c           |   7 +--
>   hw/intc/xive.c                 | 108 ++++++++++++++++-----------------
>   hw/intc/xive2.c                |  87 +++++++++++++-------------
>   hw/pci-host/pnv_phb3_msi.c     |  21 +++----
>   hw/pci-host/pnv_phb4.c         |  17 +++---
>   hw/ppc/pnv.c                   |  52 ++++++++--------
>   hw/ppc/pnv_psi.c               |   9 ++-
>   hw/ppc/spapr.c                 |  11 +++-
>   hw/ppc/spapr_irq.c             |   4 +-
>   23 files changed, 256 insertions(+), 254 deletions(-)
> 



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (28 preceding siblings ...)
  2024-06-10  8:19 ` Cédric Le Goater
@ 2024-06-12  5:48 ` Manos Pitsidianakis
  2024-06-13 12:44 ` Cédric Le Goater
                   ` (2 subsequent siblings)
  32 siblings, 0 replies; 47+ messages in thread
From: Manos Pitsidianakis @ 2024-06-12  5:48 UTC (permalink / raw)
  To: qemu-devel, Philippe Mathieu-Daudé 
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Fré dé ric Barrat, David Gibson,
	Daniel P . Berrangé , Daniel Henrique Barboza,
	Cé dric Le Goater, Philippe Mathieu-Daudé 

On Mon, 10 Jun 2024 09:20, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>Hi,
>
>This series remove uses of Monitor in hw/ppc/,
>replacing by the more generic HumanReadableText.
>Care is taken to keep the commit bisectables by
>updating functions one by one, also easing review.
>
>For rationale see previous series from Daniel:
>https://lore.kernel.org/qemu-devel/20211028155457.967291-1-berrange@redhat.com/
>
>Regards,
>
>Phil.
>
>Philippe Mathieu-Daudé (26):
>  hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
>  hw/ppc: Avoid using Monitor in icp_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
>  hw/ppc: Avoid using Monitor in ics_pic_print_info()
>  hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
>  hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
>  hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
>  hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
>  hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
>  hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
>  hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
>  hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
>  hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
>  hw/ppc: Avoid using Monitor in
>    SpaprInterruptControllerClass::print_info()
>  hw/ppc: Avoid using Monitor in spapr_irq_print_info()
>  hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
>  hw/ppc: Avoid using Monitor in pic_print_info()
>
> include/hw/pci-host/pnv_phb3.h |   2 +-
> include/hw/pci-host/pnv_phb4.h |   2 +-
> include/hw/ppc/pnv_chip.h      |   4 +-
> include/hw/ppc/pnv_psi.h       |   2 +-
> include/hw/ppc/pnv_xive.h      |   4 +-
> include/hw/ppc/spapr_irq.h     |   4 +-
> include/hw/ppc/xics.h          |   4 +-
> include/hw/ppc/xive.h          |   4 +-
> include/hw/ppc/xive2_regs.h    |   8 +--
> include/hw/ppc/xive_regs.h     |   8 +--
> hw/intc/pnv_xive.c             |  38 ++++++------
> hw/intc/pnv_xive2.c            |  48 +++++++--------
> hw/intc/spapr_xive.c           |  41 ++++++-------
> hw/intc/xics.c                 |  25 ++++----
> hw/intc/xics_spapr.c           |   7 +--
> hw/intc/xive.c                 | 108 ++++++++++++++++-----------------
> hw/intc/xive2.c                |  87 +++++++++++++-------------
> hw/pci-host/pnv_phb3_msi.c     |  21 +++----
> hw/pci-host/pnv_phb4.c         |  17 +++---
> hw/ppc/pnv.c                   |  52 ++++++++--------
> hw/ppc/pnv_psi.c               |   9 ++-
> hw/ppc/spapr.c                 |  11 +++-
> hw/ppc/spapr_irq.c             |   4 +-
> 23 files changed, 256 insertions(+), 254 deletions(-)
>
>-- 
>2.41.0

For the series:

Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-10  8:19 ` Cédric Le Goater
@ 2024-06-13  9:48   ` Philippe Mathieu-Daudé
  2024-06-13 10:29     ` Cédric Le Goater
  0 siblings, 1 reply; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-13  9:48 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza

On 10/6/24 10:19, Cédric Le Goater wrote:
> On 6/10/24 8:20 AM, Philippe Mathieu-Daudé wrote:
>> Hi,
>>
>> This series remove uses of Monitor in hw/ppc/,
>> replacing by the more generic HumanReadableText.
>> Care is taken to keep the commit bisectables by
>> updating functions one by one, also easing review.
> 
> Did you do any testing ? POWER[8-10] CPUs on pseries and powernv machines
> should be checked. A bit tedious I agree but not that long.

I ran these smoke tests comparing monitor output with baseline:

$ ./qemu-system-ppc64 -M powernv8 -S -monitor stdio
QEMU 9.0.50 monitor - type 'help' for more information
(qemu) info pic
CPU 0 XIRR=00000000 (0x0) PP=ff MFRR=ff
ICS 1000..1005 0x14c03d9c0
   1000 LSI ff 00
   1001 LSI ff 00
   1002 LSI ff 00
   1003 LSI ff 00
   1004 LSI ff 00
   1005 LSI ff 00
ICS    0.. 7ff 0x14c0e93e8
ICS    0..   7 0x14c0e9328
      0 LSI ff 00
      1 LSI ff 00
      2 LSI ff 00
      3 LSI ff 00
      4 LSI ff 00
      5 LSI ff 00
      6 LSI ff 00
      7 LSI ff 00
ICS    0.. 7ff 0x14c16ffe8
ICS    0..   7 0x14c16ff28
      0 LSI ff 00
      1 LSI ff 00
      2 LSI ff 00
      3 LSI ff 00
      4 LSI ff 00
      5 LSI ff 00
      6 LSI ff 00
      7 LSI ff 00
ICS    0.. 7ff 0x14c2177e8
ICS    0..   7 0x14c217728
      0 LSI ff 00
      1 LSI ff 00
      2 LSI ff 00
      3 LSI ff 00
      4 LSI ff 00
      5 LSI ff 00
      6 LSI ff 00
      7 LSI ff 00
Interrupt controller information not available for 
power8_v2.0-powerpc64-cpu.
(qemu) q

$ ./qemu-system-ppc64 -M pseries -cpu power10 -S -monitor stdio
QEMU 9.0.50 monitor - type 'help' for more information
qemu-system-ppc64: warning: TCG doesn't support requested feature, 
cap-cfpc=workaround
qemu-system-ppc64: warning: TCG doesn't support requested feature, 
cap-sbbc=workaround
qemu-system-ppc64: warning: TCG doesn't support requested feature, 
cap-ibs=workaround
qemu-system-ppc64: warning: TCG doesn't support requested feature, 
cap-ccf-assist=on
(qemu) info pic
CPU 0 XIRR=00000000 (0x0) PP=ff MFRR=ff
ICS 1000..1fff 0x600003b05b00
   1000 MSI ff 00
   1001 MSI ff 00
   1100 MSI ff 00
   1101 MSI ff 00
   1102 MSI ff 00
   1103 MSI ff 00
   1200 LSI ff 00
   1201 LSI ff 00
   1202 LSI ff 00
   1203 LSI ff 00
irqchip: emulated
Interrupt controller information not available for 
power10_v2.0-powerpc64-cpu.
(qemu) q



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-13  9:48   ` Philippe Mathieu-Daudé
@ 2024-06-13 10:29     ` Cédric Le Goater
  2024-06-13 12:26       ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 47+ messages in thread
From: Cédric Le Goater @ 2024-06-13 10:29 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza

On 6/13/24 11:48 AM, Philippe Mathieu-Daudé wrote:
> On 10/6/24 10:19, Cédric Le Goater wrote:
>> On 6/10/24 8:20 AM, Philippe Mathieu-Daudé wrote:
>>> Hi,
>>>
>>> This series remove uses of Monitor in hw/ppc/,
>>> replacing by the more generic HumanReadableText.
>>> Care is taken to keep the commit bisectables by
>>> updating functions one by one, also easing review.
>>
>> Did you do any testing ? POWER[8-10] CPUs on pseries and powernv machines
>> should be checked. A bit tedious I agree but not that long.
> 
> I ran these smoke tests comparing monitor output with baseline:
> 
> $ ./qemu-system-ppc64 -M powernv8 -S -monitor stdio
> QEMU 9.0.50 monitor - type 'help' for more information
> (qemu) info pic
> CPU 0 XIRR=00000000 (0x0) PP=ff MFRR=ff
> ICS 1000..1005 0x14c03d9c0
>    1000 LSI ff 00
>    1001 LSI ff 00
>    1002 LSI ff 00
>    1003 LSI ff 00
>    1004 LSI ff 00
>    1005 LSI ff 00
> ICS    0.. 7ff 0x14c0e93e8
> ICS    0..   7 0x14c0e9328
>       0 LSI ff 00
>       1 LSI ff 00
>       2 LSI ff 00
>       3 LSI ff 00
>       4 LSI ff 00
>       5 LSI ff 00
>       6 LSI ff 00
>       7 LSI ff 00
> ICS    0.. 7ff 0x14c16ffe8
> ICS    0..   7 0x14c16ff28
>       0 LSI ff 00
>       1 LSI ff 00
>       2 LSI ff 00
>       3 LSI ff 00
>       4 LSI ff 00
>       5 LSI ff 00
>       6 LSI ff 00
>       7 LSI ff 00
> ICS    0.. 7ff 0x14c2177e8
> ICS    0..   7 0x14c217728
>       0 LSI ff 00
>       1 LSI ff 00
>       2 LSI ff 00
>       3 LSI ff 00
>       4 LSI ff 00
>       5 LSI ff 00
>       6 LSI ff 00
>       7 LSI ff 00
> Interrupt controller information not available for power8_v2.0-powerpc64-cpu.

This is only checking the older interrupt controller. Please try powernv10.

> (qemu) q
> 
> $ ./qemu-system-ppc64 -M pseries -cpu power10 -S -monitor stdio
> QEMU 9.0.50 monitor - type 'help' for more information
> qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-cfpc=workaround
> qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-sbbc=workaround
> qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-ibs=workaround
> qemu-system-ppc64: warning: TCG doesn't support requested feature, cap-ccf-assist=on
> (qemu) info pic
> CPU 0 XIRR=00000000 (0x0) PP=ff MFRR=ff
> ICS 1000..1fff 0x600003b05b00
>    1000 MSI ff 00
>    1001 MSI ff 00
>    1100 MSI ff 00
>    1101 MSI ff 00
>    1102 MSI ff 00
>    1103 MSI ff 00
>    1200 LSI ff 00
>    1201 LSI ff 00
>    1202 LSI ff 00
>    1203 LSI ff 00
> irqchip: emulated
> Interrupt controller information not available for power10_v2.0-powerpc64-cpu.
> (qemu) q


This is only checking the old interrupt controller. Please try :

   qemu-system-ppc64 -M pseries,ic-mode=xive -cpu power10 -S -monitor stdio

and we should be fine.

Thanks,

C.





^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-13 10:29     ` Cédric Le Goater
@ 2024-06-13 12:26       ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-13 12:26 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza

On 13/6/24 12:29, Cédric Le Goater wrote:
> On 6/13/24 11:48 AM, Philippe Mathieu-Daudé wrote:
>> On 10/6/24 10:19, Cédric Le Goater wrote:
>>> On 6/10/24 8:20 AM, Philippe Mathieu-Daudé wrote:
>>>> Hi,
>>>>
>>>> This series remove uses of Monitor in hw/ppc/,
>>>> replacing by the more generic HumanReadableText.
>>>> Care is taken to keep the commit bisectables by
>>>> updating functions one by one, also easing review.
>>>
>>> Did you do any testing ? POWER[8-10] CPUs on pseries and powernv 
>>> machines
>>> should be checked. A bit tedious I agree but not that long.
>>
>> I ran these smoke tests comparing monitor output with baseline:
>>
>> $ ./qemu-system-ppc64 -M powernv8 -S -monitor stdio
>> QEMU 9.0.50 monitor - type 'help' for more information
>> (qemu) info pic
>> CPU 0 XIRR=00000000 (0x0) PP=ff MFRR=ff
>> ICS 1000..1005 0x14c03d9c0
>>    1000 LSI ff 00
>>    1001 LSI ff 00
>>    1002 LSI ff 00
>>    1003 LSI ff 00
>>    1004 LSI ff 00
>>    1005 LSI ff 00
>> ICS    0.. 7ff 0x14c0e93e8
>> ICS    0..   7 0x14c0e9328
>>       0 LSI ff 00
>>       1 LSI ff 00
>>       2 LSI ff 00
>>       3 LSI ff 00
>>       4 LSI ff 00
>>       5 LSI ff 00
>>       6 LSI ff 00
>>       7 LSI ff 00
>> ICS    0.. 7ff 0x14c16ffe8
>> ICS    0..   7 0x14c16ff28
>>       0 LSI ff 00
>>       1 LSI ff 00
>>       2 LSI ff 00
>>       3 LSI ff 00
>>       4 LSI ff 00
>>       5 LSI ff 00
>>       6 LSI ff 00
>>       7 LSI ff 00
>> ICS    0.. 7ff 0x14c2177e8
>> ICS    0..   7 0x14c217728
>>       0 LSI ff 00
>>       1 LSI ff 00
>>       2 LSI ff 00
>>       3 LSI ff 00
>>       4 LSI ff 00
>>       5 LSI ff 00
>>       6 LSI ff 00
>>       7 LSI ff 00
>> Interrupt controller information not available for 
>> power8_v2.0-powerpc64-cpu.
> 
> This is only checking the older interrupt controller. Please try powernv10.
> 
>> (qemu) q
>>
>> $ ./qemu-system-ppc64 -M pseries -cpu power10 -S -monitor stdio
>> QEMU 9.0.50 monitor - type 'help' for more information
>> qemu-system-ppc64: warning: TCG doesn't support requested feature, 
>> cap-cfpc=workaround
>> qemu-system-ppc64: warning: TCG doesn't support requested feature, 
>> cap-sbbc=workaround
>> qemu-system-ppc64: warning: TCG doesn't support requested feature, 
>> cap-ibs=workaround
>> qemu-system-ppc64: warning: TCG doesn't support requested feature, 
>> cap-ccf-assist=on
>> (qemu) info pic
>> CPU 0 XIRR=00000000 (0x0) PP=ff MFRR=ff
>> ICS 1000..1fff 0x600003b05b00
>>    1000 MSI ff 00
>>    1001 MSI ff 00
>>    1100 MSI ff 00
>>    1101 MSI ff 00
>>    1102 MSI ff 00
>>    1103 MSI ff 00
>>    1200 LSI ff 00
>>    1201 LSI ff 00
>>    1202 LSI ff 00
>>    1203 LSI ff 00
>> irqchip: emulated
>> Interrupt controller information not available for 
>> power10_v2.0-powerpc64-cpu.
>> (qemu) q
> 
> 
> This is only checking the old interrupt controller. Please try :
> 
>    qemu-system-ppc64 -M pseries,ic-mode=xive -cpu power10 -S -monitor stdio
> 
> and we should be fine.

No change in output:

$ ./qemu-system-ppc64 -M pseries,ic-mode=xive -cpu power10 -S -monitor 
stdio
QEMU 9.0.50 monitor - type 'help' for more information
qemu-system-ppc64: warning: TCG doesn't support requested feature, 
cap-cfpc=workaround
qemu-system-ppc64: warning: TCG doesn't support requested feature, 
cap-sbbc=workaround
qemu-system-ppc64: warning: TCG doesn't support requested feature, 
cap-ibs=workaround
qemu-system-ppc64: warning: TCG doesn't support requested feature, 
cap-ccf-assist=on
(qemu) info pic
CPU[0000]:   QW   NSR CPPR IPB LSMFB ACK# INC AGE PIPR  W2
CPU[0000]: USER    00   00  00    00   00  00  00   00  00000000
CPU[0000]:   OS    00   00  00    ff   ff  00  ff   ff  80000400
CPU[0000]: POOL    00   00  00    00   00  00  00   00  00000000
CPU[0000]: PHYS    00   00  00    00   00  00  00   ff  00000000
   LISN         PQ    EISN     CPU/PRIO EQ
   00000000 MSI -Q  M 00000000
   00001000 MSI -Q  M 00000000
   00001001 MSI -Q  M 00000000
   00001100 MSI -Q  M 00000000
   00001101 MSI -Q  M 00000000
   00001102 MSI -Q  M 00000000
   00001103 MSI -Q  M 00000000
   00001200 LSI -Q  M 00000000
   00001201 LSI -Q  M 00000000
   00001202 LSI -Q  M 00000000
   00001203 LSI -Q  M 00000000
irqchip: emulated
Interrupt controller information not available for 
power10_v2.0-powerpc64-cpu.
(qemu)



^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (29 preceding siblings ...)
  2024-06-12  5:48 ` Manos Pitsidianakis
@ 2024-06-13 12:44 ` Cédric Le Goater
  2024-06-13 13:31   ` Philippe Mathieu-Daudé
  2024-06-17 13:30 ` Harsh Prateek Bora
  2024-06-18 10:43 ` Philippe Mathieu-Daudé
  32 siblings, 1 reply; 47+ messages in thread
From: Cédric Le Goater @ 2024-06-13 12:44 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza

On 6/10/24 8:20 AM, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> This series remove uses of Monitor in hw/ppc/,
> replacing by the more generic HumanReadableText.
> Care is taken to keep the commit bisectables by
> updating functions one by one, also easing review.
> 
> For rationale see previous series from Daniel:
> https://lore.kernel.org/qemu-devel/20211028155457.967291-1-berrange@redhat.com/
> 
> Regards,
> 
> Phil.
> 
> Philippe Mathieu-Daudé (26):
>    hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
>    hw/ppc: Avoid using Monitor in icp_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
>    hw/ppc: Avoid using Monitor in ics_pic_print_info()
>    hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
>    hw/ppc: Avoid using Monitor in
>      SpaprInterruptControllerClass::print_info()
>    hw/ppc: Avoid using Monitor in spapr_irq_print_info()
>    hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
>    hw/ppc: Avoid using Monitor in pic_print_info()
> 
>   include/hw/pci-host/pnv_phb3.h |   2 +-
>   include/hw/pci-host/pnv_phb4.h |   2 +-
>   include/hw/ppc/pnv_chip.h      |   4 +-
>   include/hw/ppc/pnv_psi.h       |   2 +-
>   include/hw/ppc/pnv_xive.h      |   4 +-
>   include/hw/ppc/spapr_irq.h     |   4 +-
>   include/hw/ppc/xics.h          |   4 +-
>   include/hw/ppc/xive.h          |   4 +-
>   include/hw/ppc/xive2_regs.h    |   8 +--
>   include/hw/ppc/xive_regs.h     |   8 +--
>   hw/intc/pnv_xive.c             |  38 ++++++------
>   hw/intc/pnv_xive2.c            |  48 +++++++--------
>   hw/intc/spapr_xive.c           |  41 ++++++-------
>   hw/intc/xics.c                 |  25 ++++----
>   hw/intc/xics_spapr.c           |   7 +--
>   hw/intc/xive.c                 | 108 ++++++++++++++++-----------------
>   hw/intc/xive2.c                |  87 +++++++++++++-------------
>   hw/pci-host/pnv_phb3_msi.c     |  21 +++----
>   hw/pci-host/pnv_phb4.c         |  17 +++---
>   hw/ppc/pnv.c                   |  52 ++++++++--------
>   hw/ppc/pnv_psi.c               |   9 ++-
>   hw/ppc/spapr.c                 |  11 +++-
>   hw/ppc/spapr_irq.c             |   4 +-
>   23 files changed, 256 insertions(+), 254 deletions(-)
> 


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-13 12:44 ` Cédric Le Goater
@ 2024-06-13 13:31   ` Philippe Mathieu-Daudé
  2024-06-13 13:36     ` Cédric Le Goater
  0 siblings, 1 reply; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-13 13:31 UTC (permalink / raw)
  To: Cédric Le Goater, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza

On 13/6/24 14:44, Cédric Le Goater wrote:

>> Philippe Mathieu-Daudé (26):
>>    hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
>>    hw/ppc: Avoid using Monitor in icp_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
>>    hw/ppc: Avoid using Monitor in ics_pic_print_info()
>>    hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
>>    hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
>>    hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
>>    hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
>>    hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
>>    hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
>>    hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
>>    hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
>>    hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
>>    hw/ppc: Avoid using Monitor in
>>      SpaprInterruptControllerClass::print_info()
>>    hw/ppc: Avoid using Monitor in spapr_irq_print_info()
>>    hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
>>    hw/ppc: Avoid using Monitor in pic_print_info()

> Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks! As you suggested I'll wait for Nick to post the PPC
pull request before respining this series (and the series
depending on it).

Regards,

Phil.


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-13 13:31   ` Philippe Mathieu-Daudé
@ 2024-06-13 13:36     ` Cédric Le Goater
  0 siblings, 0 replies; 47+ messages in thread
From: Cédric Le Goater @ 2024-06-13 13:36 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza


> Thanks! As you suggested I'll wait for Nick to post the PPC
> pull request before respining this series (and the series
> depending on it).

I think this patch is the only conflicting one :
  
   https://lore.kernel.org/qemu-devel/20240424093048.180966-1-clg@redhat.com/

Adding it to your series would surely help.

Thanks,

C.




^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
  2024-06-10  6:20 ` [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-17 10:11   ` Harsh Prateek Bora
  2024-06-17 10:19     ` Harsh Prateek Bora
  0 siblings, 1 reply; 47+ messages in thread
From: Harsh Prateek Bora @ 2024-06-17 10:11 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater



On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
> Replace Monitor API by HumanReadableText one.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>

> ---
>   include/hw/pci-host/pnv_phb3.h |  2 +-
>   hw/pci-host/pnv_phb3_msi.c     | 21 ++++++++++-----------
>   hw/ppc/pnv.c                   |  8 +++++++-
>   3 files changed, 18 insertions(+), 13 deletions(-)
> 
> diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
> index d62b3091ac..24ca3dddaa 100644
> --- a/include/hw/pci-host/pnv_phb3.h
> +++ b/include/hw/pci-host/pnv_phb3.h
> @@ -40,7 +40,7 @@ void pnv_phb3_msi_update_config(Phb3MsiState *msis, uint32_t base,
>   void pnv_phb3_msi_send(Phb3MsiState *msis, uint64_t addr, uint16_t data,
>                          int32_t dev_pe);
>   void pnv_phb3_msi_ffi(Phb3MsiState *msis, uint64_t val);
> -void pnv_phb3_msi_pic_print_info(Phb3MsiState *msis, Monitor *mon);
> +void pnv_phb3_msi_pic_print_info(Phb3MsiState *msis, GString *buf);
>   
>   
>   /*
> diff --git a/hw/pci-host/pnv_phb3_msi.c b/hw/pci-host/pnv_phb3_msi.c
> index a6d827f903..77d673da54 100644
> --- a/hw/pci-host/pnv_phb3_msi.c
> +++ b/hw/pci-host/pnv_phb3_msi.c
> @@ -13,7 +13,6 @@
>   #include "hw/pci-host/pnv_phb3.h"
>   #include "hw/ppc/pnv.h"
>   #include "hw/pci/msi.h"
> -#include "monitor/monitor.h"
>   #include "hw/irq.h"
>   #include "hw/qdev-properties.h"
>   #include "sysemu/reset.h"
> @@ -316,13 +315,13 @@ static void pnv_phb3_msi_register_types(void)
>   
>   type_init(pnv_phb3_msi_register_types);
>   
> -void pnv_phb3_msi_pic_print_info(Phb3MsiState *msi, Monitor *mon)
> +void pnv_phb3_msi_pic_print_info(Phb3MsiState *msi, GString *buf)
>   {
>       ICSState *ics = ICS(msi);
>       int i;
>   
> -    monitor_printf(mon, "ICS %4x..%4x %p\n",
> -                   ics->offset, ics->offset + ics->nr_irqs - 1, ics);
> +    g_string_append_printf(buf, "ICS %4x..%4x %p\n",
> +                           ics->offset, ics->offset + ics->nr_irqs - 1, ics);
>   
>       for (i = 0; i < ics->nr_irqs; i++) {
>           uint64_t ive;
> @@ -335,12 +334,12 @@ void pnv_phb3_msi_pic_print_info(Phb3MsiState *msi, Monitor *mon)
>               continue;
>           }
>   
> -        monitor_printf(mon, "  %4x %c%c server=%04x prio=%02x gen=%d\n",
> -                       ics->offset + i,
> -                       GETFIELD(IODA2_IVT_P, ive) ? 'P' : '-',
> -                       GETFIELD(IODA2_IVT_Q, ive) ? 'Q' : '-',
> -                       (uint32_t) GETFIELD(IODA2_IVT_SERVER, ive) >> 2,
> -                       (uint32_t) GETFIELD(IODA2_IVT_PRIORITY, ive),
> -                       (uint32_t) GETFIELD(IODA2_IVT_GEN, ive));
> +        g_string_append_printf(buf, "  %4x %c%c server=%04x prio=%02x gen=%d\n",
> +                               ics->offset + i,
> +                               GETFIELD(IODA2_IVT_P, ive) ? 'P' : '-',
> +                               GETFIELD(IODA2_IVT_Q, ive) ? 'Q' : '-',
> +                               (uint32_t) GETFIELD(IODA2_IVT_SERVER, ive) >> 2,
> +                               (uint32_t) GETFIELD(IODA2_IVT_PRIORITY, ive),
> +                               (uint32_t) GETFIELD(IODA2_IVT_GEN, ive));
>       }
>   }
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index 6e3a5ccdec..5356a4e295 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -38,6 +38,7 @@
>   #include "hw/loader.h"
>   #include "hw/nmi.h"
>   #include "qapi/visitor.h"
> +#include "qapi/type-helpers.h"
>   #include "monitor/monitor.h"
>   #include "hw/intc/intc.h"
>   #include "hw/ipmi/ipmi.h"
> @@ -774,8 +775,13 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
>       for (i = 0; i < chip8->num_phbs; i++) {
>           PnvPHB *phb = chip8->phbs[i];
>           PnvPHB3 *phb3 = PNV_PHB3(phb->backend);
> +        g_autoptr(GString) buf = g_string_new("");
> +        g_autoptr(HumanReadableText) info = NULL;
> +
> +        pnv_phb3_msi_pic_print_info(&phb3->msis, buf);
> +        info = human_readable_text_from_str(buf);
> +        monitor_puts(mon, info->human_readable_text);
>   
> -        pnv_phb3_msi_pic_print_info(&phb3->msis, mon);
>           ics_pic_print_info(&phb3->lsis, mon);
>       }
>   }


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
  2024-06-17 10:11   ` Harsh Prateek Bora
@ 2024-06-17 10:19     ` Harsh Prateek Bora
  2024-06-17 10:29       ` Harsh Prateek Bora
  0 siblings, 1 reply; 47+ messages in thread
From: Harsh Prateek Bora @ 2024-06-17 10:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater

Hi Phillipe,

One query below:

On 6/17/24 15:41, Harsh Prateek Bora wrote:
> 
> 
> On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
>> Replace Monitor API by HumanReadableText one.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
> 
>> ---
>>   include/hw/pci-host/pnv_phb3.h |  2 +-
>>   hw/pci-host/pnv_phb3_msi.c     | 21 ++++++++++-----------
>>   hw/ppc/pnv.c                   |  8 +++++++-
>>   3 files changed, 18 insertions(+), 13 deletions(-)
>>

<snip>

>> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
>> index 6e3a5ccdec..5356a4e295 100644
>> --- a/hw/ppc/pnv.c
>> +++ b/hw/ppc/pnv.c
>> @@ -38,6 +38,7 @@
>>   #include "hw/loader.h"
>>   #include "hw/nmi.h"
>>   #include "qapi/visitor.h"
>> +#include "qapi/type-helpers.h"
>>   #include "monitor/monitor.h"
>>   #include "hw/intc/intc.h"
>>   #include "hw/ipmi/ipmi.h"
>> @@ -774,8 +775,13 @@ static void 
>> pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
>>       for (i = 0; i < chip8->num_phbs; i++) {
>>           PnvPHB *phb = chip8->phbs[i];
>>           PnvPHB3 *phb3 = PNV_PHB3(phb->backend);
>> +        g_autoptr(GString) buf = g_string_new("");
>> +        g_autoptr(HumanReadableText) info = NULL;
>> +
>> +        pnv_phb3_msi_pic_print_info(&phb3->msis, buf);
>> +        info = human_readable_text_from_str(buf);
>> +        monitor_puts(mon, info->human_readable_text);
>> -        pnv_phb3_msi_pic_print_info(&phb3->msis, mon);
>>           ics_pic_print_info(&phb3->lsis, mon);

How is the memory allocated to info in human_readable_text_from_str 
being reclaimed here? Isnt it a mem leak ?

Thanks
Harsh

>>       }
>>   }
> 


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 03/26] hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
  2024-06-10  6:20 ` [PATCH 03/26] hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-17 10:19   ` Harsh Prateek Bora
  2024-06-17 11:23     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 47+ messages in thread
From: Harsh Prateek Bora @ 2024-06-17 10:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater

Hi Phillipe,

On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
> index fa23b27a2b..5854358f65 100644
> --- a/hw/ppc/pnv.c
> +++ b/hw/ppc/pnv.c
> @@ -1223,7 +1223,13 @@ static void pnv_chip_power9_intc_destroy(PnvChip *chip, PowerPCCPU *cpu)
>   static void pnv_chip_power9_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
>                                               Monitor *mon)
>   {
> -    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), mon);
> +    g_autoptr(GString) buf = g_string_new("");
> +    g_autoptr(HumanReadableText) info = NULL;
> +
> +    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
> +
> +    info = human_readable_text_from_str(buf);
> +    monitor_puts(mon, info->human_readable_text);
>   }
>   
>   static void pnv_chip_power10_intc_create(PnvChip *chip, PowerPCCPU *cpu,
> @@ -1267,7 +1273,13 @@ static void pnv_chip_power10_intc_destroy(PnvChip *chip, PowerPCCPU *cpu)
>   static void pnv_chip_power10_intc_print_info(PnvChip *chip, PowerPCCPU *cpu,
>                                                Monitor *mon)
>   {
> -    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), mon);
> +    g_autoptr(GString) buf = g_string_new("");
> +    g_autoptr(HumanReadableText) info = NULL;
> +
> +    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
> +
> +    info = human_readable_text_from_str(buf);
> +    monitor_puts(mon, info->human_readable_text);
>   }
>   

We have an existing code duplication in above two routines which is 
getting worse with these multi-lines getting duplicated. Could _power9_ 
be changed to inline and called from _power10_ as well?

Thanks
Harsh


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
  2024-06-17 10:19     ` Harsh Prateek Bora
@ 2024-06-17 10:29       ` Harsh Prateek Bora
  0 siblings, 0 replies; 47+ messages in thread
From: Harsh Prateek Bora @ 2024-06-17 10:29 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater



On 6/17/24 15:49, Harsh Prateek Bora wrote:
> Hi Phillipe,
> 
> One query below:
> 
> On 6/17/24 15:41, Harsh Prateek Bora wrote:
>>
>>
>> On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
>>> Replace Monitor API by HumanReadableText one.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>>
>> Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
>>
>>> ---
>>>   include/hw/pci-host/pnv_phb3.h |  2 +-
>>>   hw/pci-host/pnv_phb3_msi.c     | 21 ++++++++++-----------
>>>   hw/ppc/pnv.c                   |  8 +++++++-
>>>   3 files changed, 18 insertions(+), 13 deletions(-)
>>>
> 
> <snip>
> 
>>> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
>>> index 6e3a5ccdec..5356a4e295 100644
>>> --- a/hw/ppc/pnv.c
>>> +++ b/hw/ppc/pnv.c
>>> @@ -38,6 +38,7 @@
>>>   #include "hw/loader.h"
>>>   #include "hw/nmi.h"
>>>   #include "qapi/visitor.h"
>>> +#include "qapi/type-helpers.h"
>>>   #include "monitor/monitor.h"
>>>   #include "hw/intc/intc.h"
>>>   #include "hw/ipmi/ipmi.h"
>>> @@ -774,8 +775,13 @@ static void 
>>> pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
>>>       for (i = 0; i < chip8->num_phbs; i++) {
>>>           PnvPHB *phb = chip8->phbs[i];
>>>           PnvPHB3 *phb3 = PNV_PHB3(phb->backend);
>>> +        g_autoptr(GString) buf = g_string_new("");
>>> +        g_autoptr(HumanReadableText) info = NULL;
>>> +
>>> +        pnv_phb3_msi_pic_print_info(&phb3->msis, buf);
>>> +        info = human_readable_text_from_str(buf);
>>> +        monitor_puts(mon, info->human_readable_text);
>>> -        pnv_phb3_msi_pic_print_info(&phb3->msis, mon);
>>>           ics_pic_print_info(&phb3->lsis, mon);
> 
> How is the memory allocated to info in human_readable_text_from_str 
> being reclaimed here? Isnt it a mem leak ?
> 
Ok, I see, g_autoptr takes care of auto cleanup. Please ignore.

> Thanks
> Harsh
> 
>>>       }
>>>   }
>>


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 03/26] hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
  2024-06-17 10:19   ` Harsh Prateek Bora
@ 2024-06-17 11:23     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-17 11:23 UTC (permalink / raw)
  To: Harsh Prateek Bora, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater

Hi Harsh,

On 17/6/24 12:19, Harsh Prateek Bora wrote:
> On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
>> diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c
>> index fa23b27a2b..5854358f65 100644
>> --- a/hw/ppc/pnv.c
>> +++ b/hw/ppc/pnv.c
>> @@ -1223,7 +1223,13 @@ static void 
>> pnv_chip_power9_intc_destroy(PnvChip *chip, PowerPCCPU *cpu)
>>   static void pnv_chip_power9_intc_print_info(PnvChip *chip, 
>> PowerPCCPU *cpu,
>>                                               Monitor *mon)
>>   {
>> -    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), mon);
>> +    g_autoptr(GString) buf = g_string_new("");
>> +    g_autoptr(HumanReadableText) info = NULL;
>> +
>> +    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
>> +
>> +    info = human_readable_text_from_str(buf);
>> +    monitor_puts(mon, info->human_readable_text);
>>   }
>>   static void pnv_chip_power10_intc_create(PnvChip *chip, PowerPCCPU 
>> *cpu,
>> @@ -1267,7 +1273,13 @@ static void 
>> pnv_chip_power10_intc_destroy(PnvChip *chip, PowerPCCPU *cpu)
>>   static void pnv_chip_power10_intc_print_info(PnvChip *chip, 
>> PowerPCCPU *cpu,
>>                                                Monitor *mon)
>>   {
>> -    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), mon);
>> +    g_autoptr(GString) buf = g_string_new("");
>> +    g_autoptr(HumanReadableText) info = NULL;
>> +
>> +    xive_tctx_pic_print_info(XIVE_TCTX(pnv_cpu_state(cpu)->intc), buf);
>> +
>> +    info = human_readable_text_from_str(buf);
>> +    monitor_puts(mon, info->human_readable_text);
>>   }
> 
> We have an existing code duplication in above two routines which is 
> getting worse with these multi-lines getting duplicated. Could _power9_ 
> be changed to inline and called from _power10_ as well?

The duplicated lines get removed later. This series is a mere API
upgrade, the final diff is smaller (although harder to review, which
is why I did it with many trivial patches).

_power9_ / _power10_ simplification could be done but as a separate
patch from this series, since different matter IMHO.

Thanks for your reviews!

Phil.


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
  2024-06-10  6:20 ` [PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-17 12:35   ` Harsh Prateek Bora
  0 siblings, 0 replies; 47+ messages in thread
From: Harsh Prateek Bora @ 2024-06-17 12:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater



On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
> @@ -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");

This monitor_printf could also be folded in buf before info assignment ?

>   }
>   


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 07/26] hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
  2024-06-10  6:20 ` [PATCH 07/26] hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-17 12:39   ` Harsh Prateek Bora
  0 siblings, 0 replies; 47+ messages in thread
From: Harsh Prateek Bora @ 2024-06-17 12:39 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater



On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
> @@ -198,13 +193,18 @@ static void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
>           if (!xive_eas_is_masked(eas)) {
>               uint32_t end_idx = xive_get_field64(EAS_END_INDEX, eas->w);
>               XiveEND *end;
> +            g_autoptr(GString) buf = g_string_new("");
> +            g_autoptr(HumanReadableText) info = NULL;
>   
>               assert(end_idx < xive->nr_ends);
>               end = &xive->endt[end_idx];
>   
>               if (xive_end_is_valid(end)) {
> -                spapr_xive_end_pic_print_info(xive, end, mon);
> +                spapr_xive_end_pic_print_info(xive, end, buf);
>               }
> +
> +            info = human_readable_text_from_str(buf);
> +            monitor_puts(mon, info->human_readable_text);
>           }
>           monitor_printf(mon, "\n");

Similarly, this monitor_printf could be g_stringified before doing the 
human_readable logic ?

Thanks
Harsh
>       }


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 08/26] hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
  2024-06-10  6:20 ` [PATCH 08/26] hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info() Philippe Mathieu-Daudé
@ 2024-06-17 12:50   ` Harsh Prateek Bora
  0 siblings, 0 replies; 47+ messages in thread
From: Harsh Prateek Bora @ 2024-06-17 12:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater



On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
> @@ -203,10 +201,8 @@ static void spapr_xive_pic_print_info(SpaprXive *xive, Monitor *mon)
>                   spapr_xive_end_pic_print_info(xive, end, buf);
>               }
>   
> -            info = human_readable_text_from_str(buf);
> -            monitor_puts(mon, info->human_readable_text);
>           }
> -        monitor_printf(mon, "\n");
> +        g_string_append_c(buf, '\n');

Ok, I see caller specific changes are done in separate patches.
Ideally one call flow could be squashed into a single patch, which would
help avoid addition, followed by removal of common logic like above.
However, assuming that would be increasing the patch size, I understand
smaller patches are easier to review.

Thanks
Harsh

>       }
>   }


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (30 preceding siblings ...)
  2024-06-13 12:44 ` Cédric Le Goater
@ 2024-06-17 13:30 ` Harsh Prateek Bora
  2024-06-18 10:43 ` Philippe Mathieu-Daudé
  32 siblings, 0 replies; 47+ messages in thread
From: Harsh Prateek Bora @ 2024-06-17 13:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: qemu-ppc, Nicholas Piggin, Frédéric Barrat,
	David Gibson, Daniel P . Berrangé, Daniel Henrique Barboza,
	Cédric Le Goater



On 6/10/24 11:50, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> This series remove uses of Monitor in hw/ppc/,
> replacing by the more generic HumanReadableText.
> Care is taken to keep the commit bisectables by
> updating functions one by one, also easing review.
> 
> For rationale see previous series from Daniel:
> https://lore.kernel.org/qemu-devel/20211028155457.967291-1-berrange@redhat.com/
> 
> Regards,
> 
> Phil.
> 

For the series:

Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>

> Philippe Mathieu-Daudé (26):
>    hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
>    hw/ppc: Avoid using Monitor in icp_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
>    hw/ppc: Avoid using Monitor in ics_pic_print_info()
>    hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
>    hw/ppc: Avoid using Monitor in
>      SpaprInterruptControllerClass::print_info()
>    hw/ppc: Avoid using Monitor in spapr_irq_print_info()
>    hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
>    hw/ppc: Avoid using Monitor in pic_print_info()
> 
>   include/hw/pci-host/pnv_phb3.h |   2 +-
>   include/hw/pci-host/pnv_phb4.h |   2 +-
>   include/hw/ppc/pnv_chip.h      |   4 +-
>   include/hw/ppc/pnv_psi.h       |   2 +-
>   include/hw/ppc/pnv_xive.h      |   4 +-
>   include/hw/ppc/spapr_irq.h     |   4 +-
>   include/hw/ppc/xics.h          |   4 +-
>   include/hw/ppc/xive.h          |   4 +-
>   include/hw/ppc/xive2_regs.h    |   8 +--
>   include/hw/ppc/xive_regs.h     |   8 +--
>   hw/intc/pnv_xive.c             |  38 ++++++------
>   hw/intc/pnv_xive2.c            |  48 +++++++--------
>   hw/intc/spapr_xive.c           |  41 ++++++-------
>   hw/intc/xics.c                 |  25 ++++----
>   hw/intc/xics_spapr.c           |   7 +--
>   hw/intc/xive.c                 | 108 ++++++++++++++++-----------------
>   hw/intc/xive2.c                |  87 +++++++++++++-------------
>   hw/pci-host/pnv_phb3_msi.c     |  21 +++----
>   hw/pci-host/pnv_phb4.c         |  17 +++---
>   hw/ppc/pnv.c                   |  52 ++++++++--------
>   hw/ppc/pnv_psi.c               |   9 ++-
>   hw/ppc/spapr.c                 |  11 +++-
>   hw/ppc/spapr_irq.c             |   4 +-
>   23 files changed, 256 insertions(+), 254 deletions(-)
> 


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor
  2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
                   ` (31 preceding siblings ...)
  2024-06-17 13:30 ` Harsh Prateek Bora
@ 2024-06-18 10:43 ` Philippe Mathieu-Daudé
  32 siblings, 0 replies; 47+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-18 10:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Harsh Prateek Bora, qemu-ppc, Nicholas Piggin,
	Frédéric Barrat, David Gibson, Daniel P . Berrangé,
	Daniel Henrique Barboza, Cédric Le Goater

On 10/6/24 08:20, Philippe Mathieu-Daudé wrote:

> Philippe Mathieu-Daudé (26):
>    hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info()
>    hw/ppc: Avoid using Monitor in icp_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info()
>    hw/ppc: Avoid using Monitor in ics_pic_print_info()
>    hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_source_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_end_pic_print_info()
>    hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info()
>    hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info()
>    hw/ppc: Avoid using Monitor in
>      SpaprInterruptControllerClass::print_info()
>    hw/ppc: Avoid using Monitor in spapr_irq_print_info()
>    hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child()
>    hw/ppc: Avoid using Monitor in pic_print_info()

Series queued.


^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2024-06-18 10:43 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10  6:20 [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 01/26] hw/ppc: Avoid using Monitor in pnv_phb3_msi_pic_print_info() Philippe Mathieu-Daudé
2024-06-17 10:11   ` Harsh Prateek Bora
2024-06-17 10:19     ` Harsh Prateek Bora
2024-06-17 10:29       ` Harsh Prateek Bora
2024-06-10  6:20 ` [PATCH 02/26] hw/ppc: Avoid using Monitor in icp_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 03/26] hw/ppc: Avoid using Monitor in xive_tctx_pic_print_info() Philippe Mathieu-Daudé
2024-06-17 10:19   ` Harsh Prateek Bora
2024-06-17 11:23     ` Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 04/26] hw/ppc: Avoid using Monitor in ics_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 05/26] hw/ppc: Avoid using Monitor in PnvChipClass::intc_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 06/26] hw/ppc: Avoid using Monitor in xive_end_queue_pic_print_info() Philippe Mathieu-Daudé
2024-06-17 12:35   ` Harsh Prateek Bora
2024-06-10  6:20 ` [PATCH 07/26] hw/ppc: Avoid using Monitor in spapr_xive_end_pic_print_info() Philippe Mathieu-Daudé
2024-06-17 12:39   ` Harsh Prateek Bora
2024-06-10  6:20 ` [PATCH 08/26] hw/ppc: Avoid using Monitor in spapr_xive_pic_print_info() Philippe Mathieu-Daudé
2024-06-17 12:50   ` Harsh Prateek Bora
2024-06-10  6:20 ` [PATCH 09/26] hw/ppc: Avoid using Monitor in xive_source_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 10/26] hw/ppc: Avoid using Monitor in pnv_phb4_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 11/26] hw/ppc: Avoid using Monitor in xive_eas_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 12/26] hw/ppc: Avoid using Monitor in xive_end_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 13/26] hw/ppc: Avoid using Monitor in xive_end_eas_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 14/26] hw/ppc: Avoid using Monitor in xive_nvt_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 15/26] hw/ppc: Avoid using Monitor in pnv_xive_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 16/26] hw/ppc: Avoid using Monitor in pnv_psi_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 17/26] hw/ppc: Avoid using Monitor in xive2_eas_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 18/26] hw/ppc: Avoid using Monitor in xive2_end_eas_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 19/26] hw/ppc: Avoid using Monitor in xive2_end_queue_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 20/26] hw/ppc: Avoid using Monitor in xive2_end_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:20 ` [PATCH 21/26] hw/ppc: Avoid using Monitor in xive2_nvp_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:21 ` [PATCH 22/26] hw/ppc: Avoid using Monitor in pnv_xive2_pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:21 ` [PATCH 23/26] hw/ppc: Avoid using Monitor in SpaprInterruptControllerClass::print_info() Philippe Mathieu-Daudé
2024-06-10  6:21 ` [PATCH 24/26] hw/ppc: Avoid using Monitor in spapr_irq_print_info() Philippe Mathieu-Daudé
2024-06-10  6:21 ` [PATCH 25/26] hw/ppc: Avoid using Monitor in pnv_chip_power9_pic_print_info_child() Philippe Mathieu-Daudé
2024-06-10  6:21 ` [PATCH 26/26] hw/ppc: Avoid using Monitor in pic_print_info() Philippe Mathieu-Daudé
2024-06-10  6:24 ` [PATCH 00/26] hw/ppc: Prefer HumanReadableText over Monitor Philippe Mathieu-Daudé
2024-06-10  8:16 ` Cédric Le Goater
2024-06-10  8:19 ` Cédric Le Goater
2024-06-13  9:48   ` Philippe Mathieu-Daudé
2024-06-13 10:29     ` Cédric Le Goater
2024-06-13 12:26       ` Philippe Mathieu-Daudé
2024-06-12  5:48 ` Manos Pitsidianakis
2024-06-13 12:44 ` Cédric Le Goater
2024-06-13 13:31   ` Philippe Mathieu-Daudé
2024-06-13 13:36     ` Cédric Le Goater
2024-06-17 13:30 ` Harsh Prateek Bora
2024-06-18 10:43 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).