All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
@ 2019-04-17 19:17 Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 01/17] include: Include fprintf-fn.h only where needed Markus Armbruster
                   ` (27 more replies)
  0 siblings, 28 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

We pass around fprintf_function callbacks together a FILE * argument.
Three cases:

* We pass fprintf() and stdout, stderr or qemu_log_file.  Okay.

* We pass monitor_fprintf() together with the current monitor cast to
  FILE *.  The type-punning is ugly.

* We pass monitor_printf() cast to fprintf_function together with the
  current monitor cast to FILE *.  Even uglier.

All but two instances can be replaced by using qemu_printf() directly
instead of printing through a callback.

One more can be replace by using new qemu_fprintf() directly.

The last one can use qemu_fprintf() to at least avoid the
type-punning.

Based-on: <20190417190641.26814-1-armbru@redhat.com>

v2:
* PATCH 08: Commit message pasto [Dave]
* PATCH 09: Commit message typo [Dave]
* PATCH 14: Drop spurious change to x86_cpu_dump_local_apic_state()
  [Dave]

Markus Armbruster (17):
  include: Include fprintf-fn.h only where needed
  trace: Simplify how st_print_trace_file_status() prints
  tcg: Simplify how dump_opcount_info() prints
  tcg: Simplify how dump_exec_info() prints
  tcg: Simplify how dump_drift_info() prints
  qsp: Simplify how qsp_report() prints
  block/qapi: Clean up how we print to monitor or stdout
  memory: Clean up how mtree_info() prints
  target: Simplify how the TARGET_cpu_list() print
  target: Clean up how the dump_mmu() print
  target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
  qom/cpu: Simplify how CPUClass::dump_statistics() prints
  qemu-print: New qemu_fprintf(), qemu_vfprintf()
  qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
  monitor: Clean up how monitor_disas() funnels output to monitor
  disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
  include: Move fprintf_function to disas/

 accel/kvm/kvm-all.c                |   4 +-
 accel/tcg/translate-all.c          |  49 ++--
 block/qapi.c                       | 120 +++++-----
 bsd-user/main.c                    |   4 +-
 cpus.c                             |  21 +-
 disas.c                            |   5 +-
 disas/alpha.c                      |   2 +-
 disas/arm-a64.cc                   |   2 +-
 disas/arm.c                        |   2 +-
 disas/cris.c                       |   2 +-
 disas/hppa.c                       |   2 +-
 disas/i386.c                       |   2 +-
 disas/lm32.c                       |   2 +-
 disas/m68k.c                       |   2 +-
 disas/microblaze.c                 |   2 +-
 disas/mips.c                       |   2 +-
 disas/moxie.c                      |   2 +-
 disas/nanomips.cpp                 |   2 +-
 disas/nios2.c                      |   2 +-
 disas/ppc.c                        |   2 +-
 disas/riscv.c                      |   2 +-
 disas/s390.c                       |   2 +-
 disas/sh4.c                        |   2 +-
 disas/sparc.c                      |   2 +-
 disas/tci.c                        |   2 +-
 disas/xtensa.c                     |   2 +-
 exec.c                             |  42 ++--
 hmp.c                              |  12 +-
 include/block/qapi.h               |   9 +-
 include/disas/{bfd.h => dis-asm.h} |   5 +-
 include/exec/cpu-all.h             |   4 +-
 include/exec/cpu-common.h          |  13 --
 include/exec/log.h                 |   2 +-
 include/exec/memory-internal.h     |   3 +-
 include/exec/memory.h              |   3 +-
 include/monitor/monitor.h          |   1 -
 include/qemu-common.h              |   2 -
 include/qemu/cutils.h              |   2 -
 include/qemu/fprintf-fn.h          |  14 --
 include/qemu/qemu-print.h          |   4 +
 include/qemu/qsp.h                 |   6 +-
 include/qom/cpu.h                  |  24 +-
 include/sysemu/cpus.h              |   4 +-
 linux-user/alpha/cpu_loop.c        |   2 +-
 linux-user/cpu_loop-common.h       |   2 +-
 linux-user/cris/cpu_loop.c         |   2 +-
 linux-user/main.c                  |   2 +-
 linux-user/microblaze/cpu_loop.c   |   4 +-
 linux-user/s390x/cpu_loop.c        |   4 +-
 linux-user/sh4/cpu_loop.c          |   2 +-
 linux-user/sparc/cpu_loop.c        |   2 +-
 memory.c                           | 156 ++++++-------
 monitor.c                          |  30 +--
 qemu-img.c                         |   6 +-
 qemu-io-cmds.c                     |   2 +-
 qom/cpu.c                          |  11 +-
 target/alpha/cpu.c                 |  15 +-
 target/alpha/cpu.h                 |   5 +-
 target/alpha/helper.c              |  24 +-
 target/arm/arm-semi.c              |   2 +-
 target/arm/cpu.c                   |   1 -
 target/arm/cpu.h                   |   5 +-
 target/arm/helper.c                |  15 +-
 target/arm/translate-a64.c         |  82 +++----
 target/arm/translate.c             |  58 ++---
 target/arm/translate.h             |   7 +-
 target/cris/cpu.c                  |  14 +-
 target/cris/cpu.h                  |   5 +-
 target/cris/helper.c               |   2 +-
 target/cris/translate.c            |  36 +--
 target/hppa/cpu.c                  |  14 +-
 target/hppa/cpu.h                  |   4 +-
 target/hppa/helper.c               |  24 +-
 target/i386/cpu.c                  |  29 +--
 target/i386/cpu.h                  |   8 +-
 target/i386/hax-all.c              |   4 +-
 target/i386/helper.c               | 356 ++++++++++++++---------------
 target/i386/monitor.c              |   3 +-
 target/lm32/cpu.c                  |  14 +-
 target/lm32/cpu.h                  |   5 +-
 target/lm32/translate.c            |  36 +--
 target/m68k/cpu.h                  |   8 +-
 target/m68k/helper.c               | 129 +++++------
 target/m68k/monitor.c              |   2 +-
 target/m68k/translate.c            |  86 +++----
 target/microblaze/cpu.h            |   3 +-
 target/microblaze/helper.c         |   2 +-
 target/microblaze/translate.c      |  39 ++--
 target/mips/cpu.h                  |   2 +-
 target/mips/internal.h             |   3 +-
 target/mips/translate.c            |  77 ++++---
 target/mips/translate_init.inc.c   |   5 +-
 target/moxie/cpu.h                 |   3 +-
 target/moxie/helper.c              |   2 +-
 target/moxie/translate.c           |  22 +-
 target/nios2/cpu.h                 |   5 +-
 target/nios2/helper.c              |   2 +-
 target/nios2/mmu.c                 |   7 +-
 target/nios2/monitor.c             |   2 +-
 target/nios2/translate.c           |  24 +-
 target/openrisc/cpu.c              |  15 +-
 target/openrisc/cpu.h              |   5 +-
 target/openrisc/disas.c            |   2 +-
 target/openrisc/translate.c        |  11 +-
 target/ppc/cpu.h                   |  10 +-
 target/ppc/mmu-hash64.c            |   7 +-
 target/ppc/mmu-hash64.h            |   2 +-
 target/ppc/mmu_helper.c            |  70 +++---
 target/ppc/monitor.c               |   2 +-
 target/ppc/translate.c             | 170 +++++++-------
 target/ppc/translate_init.inc.c    |  28 +--
 target/riscv/cpu.c                 |  54 ++---
 target/riscv/cpu.h                 |   2 +-
 target/s390x/cpu.h                 |   2 +-
 target/s390x/cpu_models.c          |  21 +-
 target/s390x/helper.c              |  42 ++--
 target/s390x/internal.h            |   3 +-
 target/sh4/cpu.c                   |  17 +-
 target/sh4/cpu.h                   |   5 +-
 target/sh4/translate.c             |  27 +--
 target/sparc/cpu.c                 | 133 ++++++-----
 target/sparc/cpu.h                 |   7 +-
 target/sparc/ldst_helper.c         |  18 +-
 target/sparc/mmu_helper.c          |  97 ++++----
 target/sparc/monitor.c             |   2 +-
 target/tilegx/cpu.c                |  14 +-
 target/tricore/cpu.h               |   5 +-
 target/tricore/helper.c            |  15 +-
 target/tricore/translate.c         |  26 +--
 target/unicore32/cpu.h             |   3 +-
 target/unicore32/translate.c       |  39 ++--
 target/xtensa/cpu.h                |   7 +-
 target/xtensa/helper.c             |   7 +-
 target/xtensa/mmu_helper.c         |  24 +-
 target/xtensa/monitor.c            |   2 +-
 target/xtensa/translate.c          |  40 ++--
 tcg/tcg.c                          |  50 ++--
 tcg/tcg.h                          |   4 +-
 trace/simple.c                     |   7 +-
 trace/simple.h                     |   2 +-
 util/qemu-print.c                  |  27 +++
 util/qsp.c                         |  21 +-
 vl.c                               |   2 +-
 143 files changed, 1353 insertions(+), 1503 deletions(-)
 rename include/disas/{bfd.h => dis-asm.h} (99%)
 delete mode 100644 include/qemu/fprintf-fn.h

-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 01/17] include: Include fprintf-fn.h only where needed
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 02/17] trace: Simplify how st_print_trace_file_status() prints Markus Armbruster
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/qemu-common.h | 2 --
 include/qemu/cutils.h | 2 --
 include/sysemu/cpus.h | 1 +
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/include/qemu-common.h b/include/qemu-common.h
index a102245519..f891e05e7e 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -12,8 +12,6 @@
 #ifndef QEMU_COMMON_H
 #define QEMU_COMMON_H
 
-#include "qemu/fprintf-fn.h"
-
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 /* Copyright string for -version arguments, About dialogs, etc */
diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
index d2dad3057c..12301340a4 100644
--- a/include/qemu/cutils.h
+++ b/include/qemu/cutils.h
@@ -1,8 +1,6 @@
 #ifndef QEMU_CUTILS_H
 #define QEMU_CUTILS_H
 
-#include "qemu/fprintf-fn.h"
-
 /**
  * pstrcpy:
  * @buf: buffer to copy string into
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index 731756d948..eea0010b53 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -1,6 +1,7 @@
 #ifndef QEMU_CPUS_H
 #define QEMU_CPUS_H
 
+#include "qemu/fprintf-fn.h"
 #include "qemu/timer.h"
 
 /* cpus.c */
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 02/17] trace: Simplify how st_print_trace_file_status() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 01/17] include: Include fprintf-fn.h only where needed Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 03/17] tcg: Simplify how dump_opcount_info() prints Markus Armbruster
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

st_print_trace_file_status() takes an fprintf()-like callback and a
FILE * to pass to it.

Its only caller hmp_trace_file() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 monitor.c      | 2 +-
 trace/simple.c | 7 ++++---
 trace/simple.h | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/monitor.c b/monitor.c
index 10be8bdb86..a3e66b7159 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1056,7 +1056,7 @@ static void hmp_trace_file(Monitor *mon, const QDict *qdict)
     const char *arg = qdict_get_try_str(qdict, "arg");
 
     if (!op) {
-        st_print_trace_file_status((FILE *)mon, &monitor_fprintf);
+        st_print_trace_file_status();
     } else if (!strcmp(op, "on")) {
         st_set_trace_file_enabled(true);
     } else if (!strcmp(op, "off")) {
diff --git a/trace/simple.c b/trace/simple.c
index ac904eca91..fc7106ec49 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -16,6 +16,7 @@
 #include "trace/control.h"
 #include "trace/simple.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 
 /** Trace file header event ID, picked to avoid conflict with real event IDs */
 #define HEADER_EVENT_ID (~(uint64_t)0)
@@ -363,10 +364,10 @@ void st_set_trace_file(const char *file)
     st_set_trace_file_enabled(true);
 }
 
-void st_print_trace_file_status(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...))
+void st_print_trace_file_status(void)
 {
-    stream_printf(stream, "Trace file \"%s\" %s.\n",
-                  trace_file_name, trace_fp ? "on" : "off");
+    qemu_printf("Trace file \"%s\" %s.\n",
+                trace_file_name, trace_fp ? "on" : "off");
 }
 
 void st_flush_trace_buffer(void)
diff --git a/trace/simple.h b/trace/simple.h
index 9931808c05..5771a0634f 100644
--- a/trace/simple.h
+++ b/trace/simple.h
@@ -11,7 +11,7 @@
 #ifndef TRACE_SIMPLE_H
 #define TRACE_SIMPLE_H
 
-void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf);
+void st_print_trace_file_status(void);
 void st_set_trace_file_enabled(bool enable);
 void st_set_trace_file(const char *file);
 bool st_init(void);
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 03/17] tcg: Simplify how dump_opcount_info() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 01/17] include: Include fprintf-fn.h only where needed Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 02/17] trace: Simplify how st_print_trace_file_status() prints Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 04/17] tcg: Simplify how dump_exec_info() prints Markus Armbruster
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

dump_opcount_info() takes an fprintf()-like callback and a FILE * to
pass to it.

Its only caller hmp_info_opcount() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 accel/tcg/translate-all.c | 4 ++--
 include/exec/cpu-all.h    | 2 +-
 monitor.c                 | 2 +-
 tcg/tcg.c                 | 9 +++++----
 tcg/tcg.h                 | 2 +-
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 8f593b926f..85e80a1fad 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -2333,9 +2333,9 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
     tcg_dump_info(f, cpu_fprintf);
 }
 
-void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf)
+void dump_opcount_info(void)
 {
-    tcg_dump_op_count(f, cpu_fprintf);
+    tcg_dump_op_count();
 }
 
 #else /* CONFIG_USER_ONLY */
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index b16c9ec513..40f5edf4dc 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -363,7 +363,7 @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr)
 }
 
 void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
-void dump_opcount_info(FILE *f, fprintf_function cpu_fprintf);
+void dump_opcount_info(void);
 #endif /* !CONFIG_USER_ONLY */
 
 int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
diff --git a/monitor.c b/monitor.c
index a3e66b7159..30a7ffe32b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1324,7 +1324,7 @@ static void hmp_info_jit(Monitor *mon, const QDict *qdict)
 
 static void hmp_info_opcount(Monitor *mon, const QDict *qdict)
 {
-    dump_opcount_info((FILE *)mon, monitor_fprintf);
+    dump_opcount_info();
 }
 #endif
 
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 9b2bf7f439..cc5f4e2a03 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -33,6 +33,7 @@
 #include "qemu/error-report.h"
 #include "qemu/cutils.h"
 #include "qemu/host-utils.h"
+#include "qemu/qemu-print.h"
 #include "qemu/timer.h"
 
 /* Note: the long term plan is to reduce the dependencies on the QEMU
@@ -3768,14 +3769,14 @@ static void tcg_profile_snapshot_table(TCGProfile *prof)
     tcg_profile_snapshot(prof, false, true);
 }
 
-void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf)
+void tcg_dump_op_count(void)
 {
     TCGProfile prof = {};
     int i;
 
     tcg_profile_snapshot_table(&prof);
     for (i = 0; i < NB_OPS; i++) {
-        cpu_fprintf(f, "%s %" PRId64 "\n", tcg_op_defs[i].name,
+        qemu_printf("%s %" PRId64 "\n", tcg_op_defs[i].name,
                     prof.table_op_count[i]);
     }
 }
@@ -3795,9 +3796,9 @@ int64_t tcg_cpu_exec_time(void)
     return ret;
 }
 #else
-void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf)
+void tcg_dump_op_count(void)
 {
-    cpu_fprintf(f, "[TCG profiler not compiled]\n");
+    qemu_printf("[TCG profiler not compiled]\n");
 }
 
 int64_t tcg_cpu_exec_time(void)
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 32b7cf3489..9f2b03f119 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -1018,7 +1018,7 @@ int tcg_check_temp_count(void);
 
 int64_t tcg_cpu_exec_time(void);
 void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf);
-void tcg_dump_op_count(FILE *f, fprintf_function cpu_fprintf);
+void tcg_dump_op_count(void);
 
 #define TCG_CT_ALIAS  0x80
 #define TCG_CT_IALIAS 0x40
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 04/17] tcg: Simplify how dump_exec_info() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (2 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 03/17] tcg: Simplify how dump_opcount_info() prints Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 05/17] tcg: Simplify how dump_drift_info() prints Markus Armbruster
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

dump_exec_info() takes an fprintf()-like callback and a FILE * to pass
to it.

Its only caller hmp_info_jit() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 accel/tcg/translate-all.c | 45 ++++++++++++++++++++-------------------
 include/exec/cpu-all.h    |  2 +-
 monitor.c                 |  2 +-
 tcg/tcg.c                 | 41 ++++++++++++++++++-----------------
 tcg/tcg.h                 |  2 +-
 5 files changed, 47 insertions(+), 45 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 85e80a1fad..75a6cf49f1 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -50,6 +50,7 @@
 #include "translate-all.h"
 #include "qemu/bitmap.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
 #include "exec/log.h"
@@ -2214,8 +2215,7 @@ void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr)
     tb_jmp_cache_clear_page(cpu, addr);
 }
 
-static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,
-                                 struct qht_stats hst)
+static void print_qht_statistics(struct qht_stats hst)
 {
     uint32_t hgram_opts;
     size_t hgram_bins;
@@ -2224,7 +2224,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,
     if (!hst.head_buckets) {
         return;
     }
-    cpu_fprintf(f, "TB hash buckets     %zu/%zu (%0.2f%% head buckets used)\n",
+    qemu_printf("TB hash buckets     %zu/%zu (%0.2f%% head buckets used)\n",
                 hst.used_head_buckets, hst.head_buckets,
                 (double)hst.used_head_buckets / hst.head_buckets * 100);
 
@@ -2234,7 +2234,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,
         hgram_opts |= QDIST_PR_NODECIMAL;
     }
     hgram = qdist_pr(&hst.occupancy, 10, hgram_opts);
-    cpu_fprintf(f, "TB hash occupancy   %0.2f%% avg chain occ. Histogram: %s\n",
+    qemu_printf("TB hash occupancy   %0.2f%% avg chain occ. Histogram: %s\n",
                 qdist_avg(&hst.occupancy) * 100, hgram);
     g_free(hgram);
 
@@ -2247,7 +2247,7 @@ static void print_qht_statistics(FILE *f, fprintf_function cpu_fprintf,
         hgram_opts |= QDIST_PR_NODECIMAL | QDIST_PR_NOBINRANGE;
     }
     hgram = qdist_pr(&hst.chain, hgram_bins, hgram_opts);
-    cpu_fprintf(f, "TB hash avg chain   %0.3f buckets. Histogram: %s\n",
+    qemu_printf("TB hash avg chain   %0.3f buckets. Histogram: %s\n",
                 qdist_avg(&hst.chain), hgram);
     g_free(hgram);
 }
@@ -2285,7 +2285,7 @@ static gboolean tb_tree_stats_iter(gpointer key, gpointer value, gpointer data)
     return false;
 }
 
-void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
+void dump_exec_info(void)
 {
     struct tb_tree_stats tst = {};
     struct qht_stats hst;
@@ -2294,43 +2294,44 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf)
     tcg_tb_foreach(tb_tree_stats_iter, &tst);
     nb_tbs = tst.nb_tbs;
     /* XXX: avoid using doubles ? */
-    cpu_fprintf(f, "Translation buffer state:\n");
+    qemu_printf("Translation buffer state:\n");
     /*
      * Report total code size including the padding and TB structs;
      * otherwise users might think "-tb-size" is not honoured.
      * For avg host size we use the precise numbers from tb_tree_stats though.
      */
-    cpu_fprintf(f, "gen code size       %zu/%zu\n",
+    qemu_printf("gen code size       %zu/%zu\n",
                 tcg_code_size(), tcg_code_capacity());
-    cpu_fprintf(f, "TB count            %zu\n", nb_tbs);
-    cpu_fprintf(f, "TB avg target size  %zu max=%zu bytes\n",
+    qemu_printf("TB count            %zu\n", nb_tbs);
+    qemu_printf("TB avg target size  %zu max=%zu bytes\n",
                 nb_tbs ? tst.target_size / nb_tbs : 0,
                 tst.max_target_size);
-    cpu_fprintf(f, "TB avg host size    %zu bytes (expansion ratio: %0.1f)\n",
+    qemu_printf("TB avg host size    %zu bytes (expansion ratio: %0.1f)\n",
                 nb_tbs ? tst.host_size / nb_tbs : 0,
                 tst.target_size ? (double)tst.host_size / tst.target_size : 0);
-    cpu_fprintf(f, "cross page TB count %zu (%zu%%)\n", tst.cross_page,
-            nb_tbs ? (tst.cross_page * 100) / nb_tbs : 0);
-    cpu_fprintf(f, "direct jump count   %zu (%zu%%) (2 jumps=%zu %zu%%)\n",
+    qemu_printf("cross page TB count %zu (%zu%%)\n", tst.cross_page,
+                nb_tbs ? (tst.cross_page * 100) / nb_tbs : 0);
+    qemu_printf("direct jump count   %zu (%zu%%) (2 jumps=%zu %zu%%)\n",
                 tst.direct_jmp_count,
                 nb_tbs ? (tst.direct_jmp_count * 100) / nb_tbs : 0,
                 tst.direct_jmp2_count,
                 nb_tbs ? (tst.direct_jmp2_count * 100) / nb_tbs : 0);
 
     qht_statistics_init(&tb_ctx.htable, &hst);
-    print_qht_statistics(f, cpu_fprintf, hst);
+    print_qht_statistics(hst);
     qht_statistics_destroy(&hst);
 
-    cpu_fprintf(f, "\nStatistics:\n");
-    cpu_fprintf(f, "TB flush count      %u\n",
+    qemu_printf("\nStatistics:\n");
+    qemu_printf("TB flush count      %u\n",
                 atomic_read(&tb_ctx.tb_flush_count));
-    cpu_fprintf(f, "TB invalidate count %zu\n", tcg_tb_phys_invalidate_count());
+    qemu_printf("TB invalidate count %zu\n",
+                tcg_tb_phys_invalidate_count());
 
     tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
-    cpu_fprintf(f, "TLB full flushes    %zu\n", flush_full);
-    cpu_fprintf(f, "TLB partial flushes %zu\n", flush_part);
-    cpu_fprintf(f, "TLB elided flushes  %zu\n", flush_elide);
-    tcg_dump_info(f, cpu_fprintf);
+    qemu_printf("TLB full flushes    %zu\n", flush_full);
+    qemu_printf("TLB partial flushes %zu\n", flush_part);
+    qemu_printf("TLB elided flushes  %zu\n", flush_elide);
+    tcg_dump_info();
 }
 
 void dump_opcount_info(void)
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 40f5edf4dc..da07ce311f 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -362,7 +362,7 @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr)
     return tlb_hit_page(tlb_addr, addr & TARGET_PAGE_MASK);
 }
 
-void dump_exec_info(FILE *f, fprintf_function cpu_fprintf);
+void dump_exec_info(void);
 void dump_opcount_info(void);
 #endif /* !CONFIG_USER_ONLY */
 
diff --git a/monitor.c b/monitor.c
index 30a7ffe32b..24e4d49d11 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1318,7 +1318,7 @@ static void hmp_info_jit(Monitor *mon, const QDict *qdict)
         return;
     }
 
-    dump_exec_info((FILE *)mon, monitor_fprintf);
+    dump_exec_info();
     dump_drift_info((FILE *)mon, monitor_fprintf);
 }
 
diff --git a/tcg/tcg.c b/tcg/tcg.c
index cc5f4e2a03..6a22c8746c 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -4015,7 +4015,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
 }
 
 #ifdef CONFIG_PROFILER
-void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf)
+void tcg_dump_info(void)
 {
     TCGProfile prof = {};
     const TCGProfile *s;
@@ -4029,52 +4029,53 @@ void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf)
     tb_div_count = tb_count ? tb_count : 1;
     tot = s->interm_time + s->code_time;
 
-    cpu_fprintf(f, "JIT cycles          %" PRId64 " (%0.3f s at 2.4 GHz)\n",
+    qemu_printf("JIT cycles          %" PRId64 " (%0.3f s at 2.4 GHz)\n",
                 tot, tot / 2.4e9);
-    cpu_fprintf(f, "translated TBs      %" PRId64 " (aborted=%" PRId64 " %0.1f%%)\n", 
+    qemu_printf("translated TBs      %" PRId64 " (aborted=%" PRId64
+                " %0.1f%%)\n",
                 tb_count, s->tb_count1 - tb_count,
                 (double)(s->tb_count1 - s->tb_count)
                 / (s->tb_count1 ? s->tb_count1 : 1) * 100.0);
-    cpu_fprintf(f, "avg ops/TB          %0.1f max=%d\n", 
+    qemu_printf("avg ops/TB          %0.1f max=%d\n",
                 (double)s->op_count / tb_div_count, s->op_count_max);
-    cpu_fprintf(f, "deleted ops/TB      %0.2f\n",
+    qemu_printf("deleted ops/TB      %0.2f\n",
                 (double)s->del_op_count / tb_div_count);
-    cpu_fprintf(f, "avg temps/TB        %0.2f max=%d\n",
+    qemu_printf("avg temps/TB        %0.2f max=%d\n",
                 (double)s->temp_count / tb_div_count, s->temp_count_max);
-    cpu_fprintf(f, "avg host code/TB    %0.1f\n",
+    qemu_printf("avg host code/TB    %0.1f\n",
                 (double)s->code_out_len / tb_div_count);
-    cpu_fprintf(f, "avg search data/TB  %0.1f\n",
+    qemu_printf("avg search data/TB  %0.1f\n",
                 (double)s->search_out_len / tb_div_count);
     
-    cpu_fprintf(f, "cycles/op           %0.1f\n", 
+    qemu_printf("cycles/op           %0.1f\n",
                 s->op_count ? (double)tot / s->op_count : 0);
-    cpu_fprintf(f, "cycles/in byte      %0.1f\n", 
+    qemu_printf("cycles/in byte      %0.1f\n",
                 s->code_in_len ? (double)tot / s->code_in_len : 0);
-    cpu_fprintf(f, "cycles/out byte     %0.1f\n", 
+    qemu_printf("cycles/out byte     %0.1f\n",
                 s->code_out_len ? (double)tot / s->code_out_len : 0);
-    cpu_fprintf(f, "cycles/search byte     %0.1f\n",
+    qemu_printf("cycles/search byte     %0.1f\n",
                 s->search_out_len ? (double)tot / s->search_out_len : 0);
     if (tot == 0) {
         tot = 1;
     }
-    cpu_fprintf(f, "  gen_interm time   %0.1f%%\n", 
+    qemu_printf("  gen_interm time   %0.1f%%\n",
                 (double)s->interm_time / tot * 100.0);
-    cpu_fprintf(f, "  gen_code time     %0.1f%%\n", 
+    qemu_printf("  gen_code time     %0.1f%%\n",
                 (double)s->code_time / tot * 100.0);
-    cpu_fprintf(f, "optim./code time    %0.1f%%\n",
+    qemu_printf("optim./code time    %0.1f%%\n",
                 (double)s->opt_time / (s->code_time ? s->code_time : 1)
                 * 100.0);
-    cpu_fprintf(f, "liveness/code time  %0.1f%%\n", 
+    qemu_printf("liveness/code time  %0.1f%%\n",
                 (double)s->la_time / (s->code_time ? s->code_time : 1) * 100.0);
-    cpu_fprintf(f, "cpu_restore count   %" PRId64 "\n",
+    qemu_printf("cpu_restore count   %" PRId64 "\n",
                 s->restore_count);
-    cpu_fprintf(f, "  avg cycles        %0.1f\n",
+    qemu_printf("  avg cycles        %0.1f\n",
                 s->restore_count ? (double)s->restore_time / s->restore_count : 0);
 }
 #else
-void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf)
+void tcg_dump_info(void)
 {
-    cpu_fprintf(f, "[TCG profiler not compiled]\n");
+    qemu_printf("[TCG profiler not compiled]\n");
 }
 #endif
 
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 9f2b03f119..a394d78237 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -1017,7 +1017,7 @@ int tcg_check_temp_count(void);
 #endif
 
 int64_t tcg_cpu_exec_time(void);
-void tcg_dump_info(FILE *f, fprintf_function cpu_fprintf);
+void tcg_dump_info(void);
 void tcg_dump_op_count(void);
 
 #define TCG_CT_ALIAS  0x80
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 05/17] tcg: Simplify how dump_drift_info() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (3 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 04/17] tcg: Simplify how dump_exec_info() prints Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 06/17] qsp: Simplify how qsp_report() prints Markus Armbruster
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

dump_drift_info() takes an fprintf()-like callback and a FILE * to pass
to it.

Its only caller hmp_info_jit() passes monitor_fprintf() and a Monitor
* cast to FILE *.  monitor_fprintf() casts it right back, and is
otherwise identical to monitor_printf().  The type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 cpus.c                | 15 +++++++++------
 include/sysemu/cpus.h |  2 +-
 monitor.c             |  2 +-
 3 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/cpus.c b/cpus.c
index e83f72b48b..684aa9679a 100644
--- a/cpus.c
+++ b/cpus.c
@@ -31,6 +31,7 @@
 #include "qapi/qapi-events-run-state.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/block-backend.h"
 #include "exec/gdbstub.h"
@@ -2454,19 +2455,21 @@ void qmp_inject_nmi(Error **errp)
     nmi_monitor_handle(monitor_get_cpu_index(), errp);
 }
 
-void dump_drift_info(FILE *f, fprintf_function cpu_fprintf)
+void dump_drift_info(void)
 {
     if (!use_icount) {
         return;
     }
 
-    cpu_fprintf(f, "Host - Guest clock  %"PRIi64" ms\n",
+    qemu_printf("Host - Guest clock  %"PRIi64" ms\n",
                 (cpu_get_clock() - cpu_get_icount())/SCALE_MS);
     if (icount_align_option) {
-        cpu_fprintf(f, "Max guest delay     %"PRIi64" ms\n", -max_delay/SCALE_MS);
-        cpu_fprintf(f, "Max guest advance   %"PRIi64" ms\n", max_advance/SCALE_MS);
+        qemu_printf("Max guest delay     %"PRIi64" ms\n",
+                    -max_delay / SCALE_MS);
+        qemu_printf("Max guest advance   %"PRIi64" ms\n",
+                    max_advance / SCALE_MS);
     } else {
-        cpu_fprintf(f, "Max guest delay     NA\n");
-        cpu_fprintf(f, "Max guest advance   NA\n");
+        qemu_printf("Max guest delay     NA\n");
+        qemu_printf("Max guest advance   NA\n");
     }
 }
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index eea0010b53..ef13a120cc 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -19,7 +19,7 @@ extern int icount_align_option;
 /* drift information for info jit command */
 extern int64_t max_delay;
 extern int64_t max_advance;
-void dump_drift_info(FILE *f, fprintf_function cpu_fprintf);
+void dump_drift_info(void);
 
 /* Unblock cpu */
 void qemu_cpu_kick_self(void);
diff --git a/monitor.c b/monitor.c
index 24e4d49d11..7573689585 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1319,7 +1319,7 @@ static void hmp_info_jit(Monitor *mon, const QDict *qdict)
     }
 
     dump_exec_info();
-    dump_drift_info((FILE *)mon, monitor_fprintf);
+    dump_drift_info();
 }
 
 static void hmp_info_opcount(Monitor *mon, const QDict *qdict)
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 06/17] qsp: Simplify how qsp_report() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (4 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 05/17] tcg: Simplify how dump_drift_info() prints Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 07/17] block/qapi: Clean up how we print to monitor or stdout Markus Armbruster
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

qsp_report() takes an fprintf()-like callback and a FILE * to pass to
it.

Its only caller hmp_sync_profile() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/block/qapi.h |  1 +
 include/qemu/qsp.h   |  6 ++----
 monitor.c            |  2 +-
 util/qsp.c           | 21 +++++++++++----------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/block/qapi.h b/include/block/qapi.h
index 83bdb098bd..a891f43b9c 100644
--- a/include/block/qapi.h
+++ b/include/block/qapi.h
@@ -27,6 +27,7 @@
 
 #include "block/block.h"
 #include "block/snapshot.h"
+#include "qemu/fprintf-fn.h"
 
 BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
                                         BlockDriverState *bs, Error **errp);
diff --git a/include/qemu/qsp.h b/include/qemu/qsp.h
index a94c464f90..bf36aabfa8 100644
--- a/include/qemu/qsp.h
+++ b/include/qemu/qsp.h
@@ -11,15 +11,13 @@
 #ifndef QEMU_QSP_H
 #define QEMU_QSP_H
 
-#include "qemu/fprintf-fn.h"
-
 enum QSPSortBy {
     QSP_SORT_BY_TOTAL_WAIT_TIME,
     QSP_SORT_BY_AVG_WAIT_TIME,
 };
 
-void qsp_report(FILE *f, fprintf_function cpu_fprintf, size_t max,
-                enum QSPSortBy sort_by, bool callsite_coalesce);
+void qsp_report(size_t max, enum QSPSortBy sort_by,
+                bool callsite_coalesce);
 
 bool qsp_is_enabled(void);
 void qsp_enable(void);
diff --git a/monitor.c b/monitor.c
index 7573689585..1650ceec3a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1336,7 +1336,7 @@ static void hmp_info_sync_profile(Monitor *mon, const QDict *qdict)
     enum QSPSortBy sort_by;
 
     sort_by = mean ? QSP_SORT_BY_AVG_WAIT_TIME : QSP_SORT_BY_TOTAL_WAIT_TIME;
-    qsp_report((FILE *)mon, monitor_fprintf, max, sort_by, coalesce);
+    qsp_report(max, sort_by, coalesce);
 }
 
 static void hmp_info_history(Monitor *mon, const QDict *qdict)
diff --git a/util/qsp.c b/util/qsp.c
index 410f1ba004..5264c97342 100644
--- a/util/qsp.c
+++ b/util/qsp.c
@@ -56,7 +56,9 @@
  *   Critical-Section Execution to Improve the Performance of Multithreaded
  *   Applications", USENIX ATC'12.
  */
+
 #include "qemu/osdep.h"
+#include "qemu/qemu-print.h"
 #include "qemu/thread.h"
 #include "qemu/timer.h"
 #include "qemu/qht.h"
@@ -678,8 +680,7 @@ static gboolean qsp_tree_report(gpointer key, gpointer value, gpointer udata)
     return FALSE;
 }
 
-static void
-pr_report(const QSPReport *rep, FILE *f, fprintf_function pr)
+static void pr_report(const QSPReport *rep)
 {
     char *dashes;
     size_t max_len = 0;
@@ -702,15 +703,15 @@ pr_report(const QSPReport *rep, FILE *f, fprintf_function pr)
     /* white space to leave to the right of "Call site" */
     callsite_rspace = callsite_len - strlen("Call site");
 
-    pr(f, "Type               Object  Call site%*s  Wait Time (s)  "
-       "       Count  Average (us)\n", callsite_rspace, "");
+    qemu_printf("Type               Object  Call site%*s  Wait Time (s)  "
+                "       Count  Average (us)\n", callsite_rspace, "");
 
     /* build a horizontal rule with dashes */
     n_dashes = 79 + callsite_rspace;
     dashes = g_malloc(n_dashes + 1);
     memset(dashes, '-', n_dashes);
     dashes[n_dashes] = '\0';
-    pr(f, "%s\n", dashes);
+    qemu_printf("%s\n", dashes);
 
     for (i = 0; i < rep->n_entries; i++) {
         const QSPReportEntry *e = &rep->entries[i];
@@ -726,11 +727,11 @@ pr_report(const QSPReport *rep, FILE *f, fprintf_function pr)
                                e->callsite_at,
                                callsite_len - (int)strlen(e->callsite_at), "",
                                e->time_s, e->n_acqs, e->ns_avg * 1e-3);
-        pr(f, "%s", s->str);
+        qemu_printf("%s", s->str);
         g_string_free(s, TRUE);
     }
 
-    pr(f, "%s\n", dashes);
+    qemu_printf("%s\n", dashes);
     g_free(dashes);
 }
 
@@ -746,8 +747,8 @@ static void report_destroy(QSPReport *rep)
     g_free(rep->entries);
 }
 
-void qsp_report(FILE *f, fprintf_function cpu_fprintf, size_t max,
-                enum QSPSortBy sort_by, bool callsite_coalesce)
+void qsp_report(size_t max, enum QSPSortBy sort_by,
+                bool callsite_coalesce)
 {
     GTree *tree = g_tree_new_full(qsp_tree_cmp, &sort_by, g_free, NULL);
     QSPReport rep;
@@ -762,7 +763,7 @@ void qsp_report(FILE *f, fprintf_function cpu_fprintf, size_t max,
     g_tree_foreach(tree, qsp_tree_report, &rep);
     g_tree_destroy(tree);
 
-    pr_report(&rep, f, cpu_fprintf);
+    pr_report(&rep);
     report_destroy(&rep);
 }
 
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 07/17] block/qapi: Clean up how we print to monitor or stdout
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (5 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 06/17] qsp: Simplify how qsp_report() prints Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 08/17] memory: Clean up how mtree_info() prints Markus Armbruster
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

bdrv_snapshot_dump(), bdrv_image_info_specific_dump(),
bdrv_image_info_dump() and their helpers take an fprintf()-like
callback and a FILE * to pass to it.

hmp.c passes monitor_printf() cast to fprintf_function and the current
monitor cast to FILE *.

qemu-img.c and qemu-io-cmds.c pass fprintf and stdout.

The type-punning is technically undefined behaviour, but works in
practice.  Clean up: drop the callback, and call qemu_printf()
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 block/qapi.c         | 120 ++++++++++++++++++++-----------------------
 hmp.c                |  12 ++---
 include/block/qapi.h |  10 ++--
 qemu-img.c           |   6 +--
 qemu-io-cmds.c       |   2 +-
 5 files changed, 67 insertions(+), 83 deletions(-)

diff --git a/block/qapi.c b/block/qapi.c
index 21edab34fc..e3e74f898f 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -36,6 +36,7 @@
 #include "qapi/qmp/qlist.h"
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
+#include "qemu/qemu-print.h"
 #include "sysemu/block-backend.h"
 #include "qemu/cutils.h"
 
@@ -660,8 +661,7 @@ static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
     return buf;
 }
 
-void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
-                        QEMUSnapshotInfo *sn)
+void bdrv_snapshot_dump(QEMUSnapshotInfo *sn)
 {
     char buf1[128], date_buf[128], clock_buf[128];
     struct tm tm;
@@ -669,9 +669,8 @@ void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
     int64_t secs;
 
     if (!sn) {
-        func_fprintf(f,
-                     "%-10s%-20s%7s%20s%15s",
-                     "ID", "TAG", "VM SIZE", "DATE", "VM CLOCK");
+        qemu_printf("%-10s%-20s%7s%20s%15s",
+                    "ID", "TAG", "VM SIZE", "DATE", "VM CLOCK");
     } else {
         ti = sn->date_sec;
         localtime_r(&ti, &tm);
@@ -684,50 +683,46 @@ void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
                  (int)((secs / 60) % 60),
                  (int)(secs % 60),
                  (int)((sn->vm_clock_nsec / 1000000) % 1000));
-        func_fprintf(f,
-                     "%-10s%-20s%7s%20s%15s",
-                     sn->id_str, sn->name,
-                     get_human_readable_size(buf1, sizeof(buf1),
-                                             sn->vm_state_size),
-                     date_buf,
-                     clock_buf);
+        qemu_printf("%-10s%-20s%7s%20s%15s",
+                    sn->id_str, sn->name,
+                    get_human_readable_size(buf1, sizeof(buf1),
+                                            sn->vm_state_size),
+                    date_buf,
+                    clock_buf);
     }
 }
 
-static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
-                       QDict *dict);
-static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
-                       QList *list);
+static void dump_qdict(int indentation, QDict *dict);
+static void dump_qlist(int indentation, QList *list);
 
-static void dump_qobject(fprintf_function func_fprintf, void *f,
-                         int comp_indent, QObject *obj)
+static void dump_qobject(int comp_indent, QObject *obj)
 {
     switch (qobject_type(obj)) {
         case QTYPE_QNUM: {
             QNum *value = qobject_to(QNum, obj);
             char *tmp = qnum_to_string(value);
-            func_fprintf(f, "%s", tmp);
+            qemu_printf("%s", tmp);
             g_free(tmp);
             break;
         }
         case QTYPE_QSTRING: {
             QString *value = qobject_to(QString, obj);
-            func_fprintf(f, "%s", qstring_get_str(value));
+            qemu_printf("%s", qstring_get_str(value));
             break;
         }
         case QTYPE_QDICT: {
             QDict *value = qobject_to(QDict, obj);
-            dump_qdict(func_fprintf, f, comp_indent, value);
+            dump_qdict(comp_indent, value);
             break;
         }
         case QTYPE_QLIST: {
             QList *value = qobject_to(QList, obj);
-            dump_qlist(func_fprintf, f, comp_indent, value);
+            dump_qlist(comp_indent, value);
             break;
         }
         case QTYPE_QBOOL: {
             QBool *value = qobject_to(QBool, obj);
-            func_fprintf(f, "%s", qbool_get_bool(value) ? "true" : "false");
+            qemu_printf("%s", qbool_get_bool(value) ? "true" : "false");
             break;
         }
         default:
@@ -735,8 +730,7 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
     }
 }
 
-static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
-                       QList *list)
+static void dump_qlist(int indentation, QList *list)
 {
     const QListEntry *entry;
     int i = 0;
@@ -744,17 +738,16 @@ static void dump_qlist(fprintf_function func_fprintf, void *f, int indentation,
     for (entry = qlist_first(list); entry; entry = qlist_next(entry), i++) {
         QType type = qobject_type(entry->value);
         bool composite = (type == QTYPE_QDICT || type == QTYPE_QLIST);
-        func_fprintf(f, "%*s[%i]:%c", indentation * 4, "", i,
-                     composite ? '\n' : ' ');
-        dump_qobject(func_fprintf, f, indentation + 1, entry->value);
+        qemu_printf("%*s[%i]:%c", indentation * 4, "", i,
+                    composite ? '\n' : ' ');
+        dump_qobject(indentation + 1, entry->value);
         if (!composite) {
-            func_fprintf(f, "\n");
+            qemu_printf("\n");
         }
     }
 }
 
-static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
-                       QDict *dict)
+static void dump_qdict(int indentation, QDict *dict)
 {
     const QDictEntry *entry;
 
@@ -769,18 +762,17 @@ static void dump_qdict(fprintf_function func_fprintf, void *f, int indentation,
             key[i] = entry->key[i] == '-' ? ' ' : entry->key[i];
         }
         key[i] = 0;
-        func_fprintf(f, "%*s%s:%c", indentation * 4, "", key,
-                     composite ? '\n' : ' ');
-        dump_qobject(func_fprintf, f, indentation + 1, entry->value);
+        qemu_printf("%*s%s:%c", indentation * 4, "", key,
+                    composite ? '\n' : ' ');
+        dump_qobject(indentation + 1, entry->value);
         if (!composite) {
-            func_fprintf(f, "\n");
+            qemu_printf("\n");
         }
         g_free(key);
     }
 }
 
-void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
-                                   ImageInfoSpecific *info_spec)
+void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec)
 {
     QObject *obj, *data;
     Visitor *v = qobject_output_visitor_new(&obj);
@@ -788,13 +780,12 @@ void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
     visit_type_ImageInfoSpecific(v, NULL, &info_spec, &error_abort);
     visit_complete(v, &obj);
     data = qdict_get(qobject_to(QDict, obj), "data");
-    dump_qobject(func_fprintf, f, 1, data);
+    dump_qobject(1, data);
     qobject_unref(obj);
     visit_free(v);
 }
 
-void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
-                          ImageInfo *info)
+void bdrv_image_info_dump(ImageInfo *info)
 {
     char size_buf[128], dsize_buf[128];
     if (!info->has_actual_size) {
@@ -804,49 +795,48 @@ void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
                                 info->actual_size);
     }
     get_human_readable_size(size_buf, sizeof(size_buf), info->virtual_size);
-    func_fprintf(f,
-                 "image: %s\n"
-                 "file format: %s\n"
-                 "virtual size: %s (%" PRId64 " bytes)\n"
-                 "disk size: %s\n",
-                 info->filename, info->format, size_buf,
-                 info->virtual_size,
-                 dsize_buf);
+    qemu_printf("image: %s\n"
+                "file format: %s\n"
+                "virtual size: %s (%" PRId64 " bytes)\n"
+                "disk size: %s\n",
+                info->filename, info->format, size_buf,
+                info->virtual_size,
+                dsize_buf);
 
     if (info->has_encrypted && info->encrypted) {
-        func_fprintf(f, "encrypted: yes\n");
+        qemu_printf("encrypted: yes\n");
     }
 
     if (info->has_cluster_size) {
-        func_fprintf(f, "cluster_size: %" PRId64 "\n",
-                       info->cluster_size);
+        qemu_printf("cluster_size: %" PRId64 "\n",
+                    info->cluster_size);
     }
 
     if (info->has_dirty_flag && info->dirty_flag) {
-        func_fprintf(f, "cleanly shut down: no\n");
+        qemu_printf("cleanly shut down: no\n");
     }
 
     if (info->has_backing_filename) {
-        func_fprintf(f, "backing file: %s", info->backing_filename);
+        qemu_printf("backing file: %s", info->backing_filename);
         if (!info->has_full_backing_filename) {
-            func_fprintf(f, " (cannot determine actual path)");
+            qemu_printf(" (cannot determine actual path)");
         } else if (strcmp(info->backing_filename,
                           info->full_backing_filename) != 0) {
-            func_fprintf(f, " (actual path: %s)", info->full_backing_filename);
+            qemu_printf(" (actual path: %s)", info->full_backing_filename);
         }
-        func_fprintf(f, "\n");
+        qemu_printf("\n");
         if (info->has_backing_filename_format) {
-            func_fprintf(f, "backing file format: %s\n",
-                         info->backing_filename_format);
+            qemu_printf("backing file format: %s\n",
+                        info->backing_filename_format);
         }
     }
 
     if (info->has_snapshots) {
         SnapshotInfoList *elem;
 
-        func_fprintf(f, "Snapshot list:\n");
-        bdrv_snapshot_dump(func_fprintf, f, NULL);
-        func_fprintf(f, "\n");
+        qemu_printf("Snapshot list:\n");
+        bdrv_snapshot_dump(NULL);
+        qemu_printf("\n");
 
         /* Ideally bdrv_snapshot_dump() would operate on SnapshotInfoList but
          * we convert to the block layer's native QEMUSnapshotInfo for now.
@@ -862,13 +852,13 @@ void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
 
             pstrcpy(sn.id_str, sizeof(sn.id_str), elem->value->id);
             pstrcpy(sn.name, sizeof(sn.name), elem->value->name);
-            bdrv_snapshot_dump(func_fprintf, f, &sn);
-            func_fprintf(f, "\n");
+            bdrv_snapshot_dump(&sn);
+            qemu_printf("\n");
         }
     }
 
     if (info->has_format_specific) {
-        func_fprintf(f, "Format specific information:\n");
-        bdrv_image_info_specific_dump(func_fprintf, f, info->format_specific);
+        qemu_printf("Format specific information:\n");
+        bdrv_image_info_specific_dump(info->format_specific);
     }
 }
diff --git a/hmp.c b/hmp.c
index 8eec768088..4bb3af748e 100644
--- a/hmp.c
+++ b/hmp.c
@@ -580,8 +580,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
         monitor_printf(mon, "\nImages:\n");
         image_info = inserted->image;
         while (1) {
-                bdrv_image_info_dump((fprintf_function)monitor_printf,
-                                     mon, image_info);
+                bdrv_image_info_dump(image_info);
             if (image_info->has_backing_image) {
                 image_info = image_info->backing_image;
             } else {
@@ -1586,7 +1585,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
     monitor_printf(mon, "List of snapshots present on all disks:\n");
 
     if (total > 0) {
-        bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL);
+        bdrv_snapshot_dump(NULL);
         monitor_printf(mon, "\n");
         for (i = 0; i < total; i++) {
             sn = &sn_tab[global_snapshots[i]];
@@ -1594,7 +1593,7 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
              * overwrite it.
              */
             pstrcpy(sn->id_str, sizeof(sn->id_str), "--");
-            bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, sn);
+            bdrv_snapshot_dump(sn);
             monitor_printf(mon, "\n");
         }
     } else {
@@ -1608,11 +1607,10 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
         monitor_printf(mon,
                        "\nList of partial (non-loadable) snapshots on '%s':\n",
                        image_entry->imagename);
-        bdrv_snapshot_dump((fprintf_function)monitor_printf, mon, NULL);
+        bdrv_snapshot_dump(NULL);
         monitor_printf(mon, "\n");
         QTAILQ_FOREACH(snapshot_entry, &image_entry->snapshots, next) {
-            bdrv_snapshot_dump((fprintf_function)monitor_printf, mon,
-                               &snapshot_entry->sn);
+            bdrv_snapshot_dump(&snapshot_entry->sn);
             monitor_printf(mon, "\n");
         }
     }
diff --git a/include/block/qapi.h b/include/block/qapi.h
index a891f43b9c..cd9410dee3 100644
--- a/include/block/qapi.h
+++ b/include/block/qapi.h
@@ -27,7 +27,6 @@
 
 #include "block/block.h"
 #include "block/snapshot.h"
-#include "qemu/fprintf-fn.h"
 
 BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
                                         BlockDriverState *bs, Error **errp);
@@ -38,10 +37,7 @@ void bdrv_query_image_info(BlockDriverState *bs,
                            ImageInfo **p_info,
                            Error **errp);
 
-void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f,
-                        QEMUSnapshotInfo *sn);
-void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
-                                   ImageInfoSpecific *info_spec);
-void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
-                          ImageInfo *info);
+void bdrv_snapshot_dump(QEMUSnapshotInfo *sn);
+void bdrv_image_info_specific_dump(ImageInfoSpecific *info_spec);
+void bdrv_image_info_dump(ImageInfo *info);
 #endif
diff --git a/qemu-img.c b/qemu-img.c
index c376e91ca0..d7fe546b85 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2483,11 +2483,11 @@ static void dump_snapshots(BlockDriverState *bs)
     if (nb_sns <= 0)
         return;
     printf("Snapshot list:\n");
-    bdrv_snapshot_dump(fprintf, stdout, NULL);
+    bdrv_snapshot_dump(NULL);
     printf("\n");
     for(i = 0; i < nb_sns; i++) {
         sn = &sn_tab[i];
-        bdrv_snapshot_dump(fprintf, stdout, sn);
+        bdrv_snapshot_dump(sn);
         printf("\n");
     }
     g_free(sn_tab);
@@ -2536,7 +2536,7 @@ static void dump_human_image_info_list(ImageInfoList *list)
         }
         delim = true;
 
-        bdrv_image_info_dump(fprintf, stdout, elem->value);
+        bdrv_image_info_dump(elem->value);
     }
 }
 
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 09750a23ce..8826bebaf6 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -1699,7 +1699,7 @@ static int info_f(BlockBackend *blk, int argc, char **argv)
     }
     if (spec_info) {
         printf("Format specific information:\n");
-        bdrv_image_info_specific_dump(fprintf, stdout, spec_info);
+        bdrv_image_info_specific_dump(spec_info);
         qapi_free_ImageInfoSpecific(spec_info);
     }
 
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 08/17] memory: Clean up how mtree_info() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (6 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 07/17] block/qapi: Clean up how we print to monitor or stdout Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 09/17] target: Simplify how the TARGET_cpu_list() print Markus Armbruster
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

mtree_info() takes an fprintf()-like callback and a FILE * to pass to
it, and so do its helper functions.  Passing around callback and
argument is rather tiresome.

Its only caller hmp_info_mtree() passes monitor_printf() cast to
fprintf_function and the current monitor cast to FILE *.

The type-punning is technically undefined behaviour, but works in
practice.  Clean up: drop the callback, and call qemu_printf()
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 exec.c                         |  40 ++++-----
 include/exec/memory-internal.h |   3 +-
 include/exec/memory.h          |   3 +-
 memory.c                       | 156 ++++++++++++++++-----------------
 monitor.c                      |   3 +-
 5 files changed, 98 insertions(+), 107 deletions(-)

diff --git a/exec.c b/exec.c
index 6ab62f4eee..85d15606f1 100644
--- a/exec.c
+++ b/exec.c
@@ -35,6 +35,7 @@
 #include "qemu/timer.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #if defined(CONFIG_USER_ONLY)
 #include "qemu.h"
 #else /* !CONFIG_USER_ONLY */
@@ -4117,42 +4118,41 @@ void page_size_init(void)
 
 #if !defined(CONFIG_USER_ONLY)
 
-static void mtree_print_phys_entries(fprintf_function mon, void *f,
-                                     int start, int end, int skip, int ptr)
+static void mtree_print_phys_entries(int start, int end, int skip, int ptr)
 {
     if (start == end - 1) {
-        mon(f, "\t%3d      ", start);
+        qemu_printf("\t%3d      ", start);
     } else {
-        mon(f, "\t%3d..%-3d ", start, end - 1);
+        qemu_printf("\t%3d..%-3d ", start, end - 1);
     }
-    mon(f, " skip=%d ", skip);
+    qemu_printf(" skip=%d ", skip);
     if (ptr == PHYS_MAP_NODE_NIL) {
-        mon(f, " ptr=NIL");
+        qemu_printf(" ptr=NIL");
     } else if (!skip) {
-        mon(f, " ptr=#%d", ptr);
+        qemu_printf(" ptr=#%d", ptr);
     } else {
-        mon(f, " ptr=[%d]", ptr);
+        qemu_printf(" ptr=[%d]", ptr);
     }
-    mon(f, "\n");
+    qemu_printf("\n");
 }
 
 #define MR_SIZE(size) (int128_nz(size) ? (hwaddr)int128_get64( \
                            int128_sub((size), int128_one())) : 0)
 
-void mtree_print_dispatch(fprintf_function mon, void *f,
-                          AddressSpaceDispatch *d, MemoryRegion *root)
+void mtree_print_dispatch(AddressSpaceDispatch *d, MemoryRegion *root)
 {
     int i;
 
-    mon(f, "  Dispatch\n");
-    mon(f, "    Physical sections\n");
+    qemu_printf("  Dispatch\n");
+    qemu_printf("    Physical sections\n");
 
     for (i = 0; i < d->map.sections_nb; ++i) {
         MemoryRegionSection *s = d->map.sections + i;
         const char *names[] = { " [unassigned]", " [not dirty]",
                                 " [ROM]", " [watch]" };
 
-        mon(f, "      #%d @" TARGET_FMT_plx ".." TARGET_FMT_plx " %s%s%s%s%s",
+        qemu_printf("      #%d @" TARGET_FMT_plx ".." TARGET_FMT_plx
+                    " %s%s%s%s%s",
             i,
             s->offset_within_address_space,
             s->offset_within_address_space + MR_SIZE(s->mr->size),
@@ -4163,20 +4163,20 @@ void mtree_print_dispatch(fprintf_function mon, void *f,
             s->mr->is_iommu ? " [iommu]" : "");
 
         if (s->mr->alias) {
-            mon(f, " alias=%s", s->mr->alias->name ?
+            qemu_printf(" alias=%s", s->mr->alias->name ?
                     s->mr->alias->name : "noname");
         }
-        mon(f, "\n");
+        qemu_printf("\n");
     }
 
-    mon(f, "    Nodes (%d bits per level, %d levels) ptr=[%d] skip=%d\n",
+    qemu_printf("    Nodes (%d bits per level, %d levels) ptr=[%d] skip=%d\n",
                P_L2_BITS, P_L2_LEVELS, d->phys_map.ptr, d->phys_map.skip);
     for (i = 0; i < d->map.nodes_nb; ++i) {
         int j, jprev;
         PhysPageEntry prev;
         Node *n = d->map.nodes + i;
 
-        mon(f, "      [%d]\n", i);
+        qemu_printf("      [%d]\n", i);
 
         for (j = 0, jprev = 0, prev = *n[0]; j < ARRAY_SIZE(*n); ++j) {
             PhysPageEntry *pe = *n + j;
@@ -4185,14 +4185,14 @@ void mtree_print_dispatch(fprintf_function mon, void *f,
                 continue;
             }
 
-            mtree_print_phys_entries(mon, f, jprev, j, prev.skip, prev.ptr);
+            mtree_print_phys_entries(jprev, j, prev.skip, prev.ptr);
 
             jprev = j;
             prev = *pe;
         }
 
         if (jprev != ARRAY_SIZE(*n)) {
-            mtree_print_phys_entries(mon, f, jprev, j, prev.skip, prev.ptr);
+            mtree_print_phys_entries(jprev, j, prev.skip, prev.ptr);
         }
     }
 }
diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
index bb08fa4d2f..d1a9dd1ec8 100644
--- a/include/exec/memory-internal.h
+++ b/include/exec/memory-internal.h
@@ -45,8 +45,7 @@ AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv);
 void address_space_dispatch_compact(AddressSpaceDispatch *d);
 void address_space_dispatch_free(AddressSpaceDispatch *d);
 
-void mtree_print_dispatch(fprintf_function mon, void *f,
-                          struct AddressSpaceDispatch *d,
+void mtree_print_dispatch(struct AddressSpaceDispatch *d,
                           MemoryRegion *root);
 
 struct page_collection;
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 1625913f84..9144a47f57 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1720,8 +1720,7 @@ void memory_global_dirty_log_start(void);
  */
 void memory_global_dirty_log_stop(void);
 
-void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
-                bool dispatch_tree, bool owner);
+void mtree_info(bool flatview, bool dispatch_tree, bool owner);
 
 /**
  * memory_region_dispatch_read: perform a read directly to the specified
diff --git a/memory.c b/memory.c
index 9fbca52e05..bb2b71ee38 100644
--- a/memory.c
+++ b/memory.c
@@ -22,6 +22,7 @@
 #include "qapi/visitor.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "qom/object.h"
 #include "trace-root.h"
 
@@ -2800,46 +2801,43 @@ typedef QTAILQ_HEAD(, MemoryRegionList) MemoryRegionListHead;
                            int128_sub((size), int128_one())) : 0)
 #define MTREE_INDENT "  "
 
-static void mtree_expand_owner(fprintf_function mon_printf, void *f,
-                               const char *label, Object *obj)
+static void mtree_expand_owner(const char *label, Object *obj)
 {
     DeviceState *dev = (DeviceState *) object_dynamic_cast(obj, TYPE_DEVICE);
 
-    mon_printf(f, " %s:{%s", label, dev ? "dev" : "obj");
+    qemu_printf(" %s:{%s", label, dev ? "dev" : "obj");
     if (dev && dev->id) {
-        mon_printf(f, " id=%s", dev->id);
+        qemu_printf(" id=%s", dev->id);
     } else {
         gchar *canonical_path = object_get_canonical_path(obj);
         if (canonical_path) {
-            mon_printf(f, " path=%s", canonical_path);
+            qemu_printf(" path=%s", canonical_path);
             g_free(canonical_path);
         } else {
-            mon_printf(f, " type=%s", object_get_typename(obj));
+            qemu_printf(" type=%s", object_get_typename(obj));
         }
     }
-    mon_printf(f, "}");
+    qemu_printf("}");
 }
 
-static void mtree_print_mr_owner(fprintf_function mon_printf, void *f,
-                                 const MemoryRegion *mr)
+static void mtree_print_mr_owner(const MemoryRegion *mr)
 {
     Object *owner = mr->owner;
     Object *parent = memory_region_owner((MemoryRegion *)mr);
 
     if (!owner && !parent) {
-        mon_printf(f, " orphan");
+        qemu_printf(" orphan");
         return;
     }
     if (owner) {
-        mtree_expand_owner(mon_printf, f, "owner", owner);
+        mtree_expand_owner("owner", owner);
     }
     if (parent && parent != owner) {
-        mtree_expand_owner(mon_printf, f, "parent", parent);
+        mtree_expand_owner("parent", parent);
     }
 }
 
-static void mtree_print_mr(fprintf_function mon_printf, void *f,
-                           const MemoryRegion *mr, unsigned int level,
+static void mtree_print_mr(const MemoryRegion *mr, unsigned int level,
                            hwaddr base,
                            MemoryRegionListHead *alias_print_queue,
                            bool owner)
@@ -2855,7 +2853,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
     }
 
     for (i = 0; i < level; i++) {
-        mon_printf(f, MTREE_INDENT);
+        qemu_printf(MTREE_INDENT);
     }
 
     cur_start = base + mr->addr;
@@ -2867,7 +2865,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
      * user who is observing this.
      */
     if (cur_start < base || cur_end < cur_start) {
-        mon_printf(f, "[DETECTED OVERFLOW!] ");
+        qemu_printf("[DETECTED OVERFLOW!] ");
     }
 
     if (mr->alias) {
@@ -2886,35 +2884,35 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
             ml->mr = mr->alias;
             QTAILQ_INSERT_TAIL(alias_print_queue, ml, mrqueue);
         }
-        mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx
-                   " (prio %d, %s%s): alias %s @%s " TARGET_FMT_plx
-                   "-" TARGET_FMT_plx "%s",
-                   cur_start, cur_end,
-                   mr->priority,
-                   mr->nonvolatile ? "nv-" : "",
-                   memory_region_type((MemoryRegion *)mr),
-                   memory_region_name(mr),
-                   memory_region_name(mr->alias),
-                   mr->alias_offset,
-                   mr->alias_offset + MR_SIZE(mr->size),
-                   mr->enabled ? "" : " [disabled]");
+        qemu_printf(TARGET_FMT_plx "-" TARGET_FMT_plx
+                    " (prio %d, %s%s): alias %s @%s " TARGET_FMT_plx
+                    "-" TARGET_FMT_plx "%s",
+                    cur_start, cur_end,
+                    mr->priority,
+                    mr->nonvolatile ? "nv-" : "",
+                    memory_region_type((MemoryRegion *)mr),
+                    memory_region_name(mr),
+                    memory_region_name(mr->alias),
+                    mr->alias_offset,
+                    mr->alias_offset + MR_SIZE(mr->size),
+                    mr->enabled ? "" : " [disabled]");
         if (owner) {
-            mtree_print_mr_owner(mon_printf, f, mr);
+            mtree_print_mr_owner(mr);
         }
     } else {
-        mon_printf(f,
-                   TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s%s): %s%s",
-                   cur_start, cur_end,
-                   mr->priority,
-                   mr->nonvolatile ? "nv-" : "",
-                   memory_region_type((MemoryRegion *)mr),
-                   memory_region_name(mr),
-                   mr->enabled ? "" : " [disabled]");
+        qemu_printf(TARGET_FMT_plx "-" TARGET_FMT_plx
+                    " (prio %d, %s%s): %s%s",
+                    cur_start, cur_end,
+                    mr->priority,
+                    mr->nonvolatile ? "nv-" : "",
+                    memory_region_type((MemoryRegion *)mr),
+                    memory_region_name(mr),
+                    mr->enabled ? "" : " [disabled]");
         if (owner) {
-            mtree_print_mr_owner(mon_printf, f, mr);
+            mtree_print_mr_owner(mr);
         }
     }
-    mon_printf(f, "\n");
+    qemu_printf("\n");
 
     QTAILQ_INIT(&submr_print_queue);
 
@@ -2936,7 +2934,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
     }
 
     QTAILQ_FOREACH(ml, &submr_print_queue, mrqueue) {
-        mtree_print_mr(mon_printf, f, ml->mr, level + 1, cur_start,
+        mtree_print_mr(ml->mr, level + 1, cur_start,
                        alias_print_queue, owner);
     }
 
@@ -2946,8 +2944,6 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
 }
 
 struct FlatViewInfo {
-    fprintf_function mon_printf;
-    void *f;
     int counter;
     bool dispatch_tree;
     bool owner;
@@ -2959,70 +2955,71 @@ static void mtree_print_flatview(gpointer key, gpointer value,
     FlatView *view = key;
     GArray *fv_address_spaces = value;
     struct FlatViewInfo *fvi = user_data;
-    fprintf_function p = fvi->mon_printf;
-    void *f = fvi->f;
     FlatRange *range = &view->ranges[0];
     MemoryRegion *mr;
     int n = view->nr;
     int i;
     AddressSpace *as;
 
-    p(f, "FlatView #%d\n", fvi->counter);
+    qemu_printf("FlatView #%d\n", fvi->counter);
     ++fvi->counter;
 
     for (i = 0; i < fv_address_spaces->len; ++i) {
         as = g_array_index(fv_address_spaces, AddressSpace*, i);
-        p(f, " AS \"%s\", root: %s", as->name, memory_region_name(as->root));
+        qemu_printf(" AS \"%s\", root: %s",
+                    as->name, memory_region_name(as->root));
         if (as->root->alias) {
-            p(f, ", alias %s", memory_region_name(as->root->alias));
+            qemu_printf(", alias %s", memory_region_name(as->root->alias));
         }
-        p(f, "\n");
+        qemu_printf("\n");
     }
 
-    p(f, " Root memory region: %s\n",
+    qemu_printf(" Root memory region: %s\n",
       view->root ? memory_region_name(view->root) : "(none)");
 
     if (n <= 0) {
-        p(f, MTREE_INDENT "No rendered FlatView\n\n");
+        qemu_printf(MTREE_INDENT "No rendered FlatView\n\n");
         return;
     }
 
     while (n--) {
         mr = range->mr;
         if (range->offset_in_region) {
-            p(f, MTREE_INDENT TARGET_FMT_plx "-"
-              TARGET_FMT_plx " (prio %d, %s%s): %s @" TARGET_FMT_plx,
-              int128_get64(range->addr.start),
-              int128_get64(range->addr.start) + MR_SIZE(range->addr.size),
-              mr->priority,
-              range->nonvolatile ? "nv-" : "",
-              range->readonly ? "rom" : memory_region_type(mr),
-              memory_region_name(mr),
-              range->offset_in_region);
+            qemu_printf(MTREE_INDENT TARGET_FMT_plx "-" TARGET_FMT_plx
+                        " (prio %d, %s%s): %s @" TARGET_FMT_plx,
+                        int128_get64(range->addr.start),
+                        int128_get64(range->addr.start)
+                        + MR_SIZE(range->addr.size),
+                        mr->priority,
+                        range->nonvolatile ? "nv-" : "",
+                        range->readonly ? "rom" : memory_region_type(mr),
+                        memory_region_name(mr),
+                        range->offset_in_region);
         } else {
-            p(f, MTREE_INDENT TARGET_FMT_plx "-"
-              TARGET_FMT_plx " (prio %d, %s%s): %s",
-              int128_get64(range->addr.start),
-              int128_get64(range->addr.start) + MR_SIZE(range->addr.size),
-              mr->priority,
-              range->nonvolatile ? "nv-" : "",
-              range->readonly ? "rom" : memory_region_type(mr),
-              memory_region_name(mr));
+            qemu_printf(MTREE_INDENT TARGET_FMT_plx "-" TARGET_FMT_plx
+                        " (prio %d, %s%s): %s",
+                        int128_get64(range->addr.start),
+                        int128_get64(range->addr.start)
+                        + MR_SIZE(range->addr.size),
+                        mr->priority,
+                        range->nonvolatile ? "nv-" : "",
+                        range->readonly ? "rom" : memory_region_type(mr),
+                        memory_region_name(mr));
         }
         if (fvi->owner) {
-            mtree_print_mr_owner(p, f, mr);
+            mtree_print_mr_owner(mr);
         }
-        p(f, "\n");
+        qemu_printf("\n");
         range++;
     }
 
 #if !defined(CONFIG_USER_ONLY)
     if (fvi->dispatch_tree && view->root) {
-        mtree_print_dispatch(p, f, view->dispatch, view->root);
+        mtree_print_dispatch(view->dispatch, view->root);
     }
 #endif
 
-    p(f, "\n");
+    qemu_printf("\n");
 }
 
 static gboolean mtree_info_flatview_free(gpointer key, gpointer value,
@@ -3037,8 +3034,7 @@ static gboolean mtree_info_flatview_free(gpointer key, gpointer value,
     return true;
 }
 
-void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
-                bool dispatch_tree, bool owner)
+void mtree_info(bool flatview, bool dispatch_tree, bool owner)
 {
     MemoryRegionListHead ml_head;
     MemoryRegionList *ml, *ml2;
@@ -3047,8 +3043,6 @@ void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
     if (flatview) {
         FlatView *view;
         struct FlatViewInfo fvi = {
-            .mon_printf = mon_printf,
-            .f = f,
             .counter = 0,
             .dispatch_tree = dispatch_tree,
             .owner = owner,
@@ -3082,16 +3076,16 @@ void mtree_info(fprintf_function mon_printf, void *f, bool flatview,
     QTAILQ_INIT(&ml_head);
 
     QTAILQ_FOREACH(as, &address_spaces, address_spaces_link) {
-        mon_printf(f, "address-space: %s\n", as->name);
-        mtree_print_mr(mon_printf, f, as->root, 1, 0, &ml_head, owner);
-        mon_printf(f, "\n");
+        qemu_printf("address-space: %s\n", as->name);
+        mtree_print_mr(as->root, 1, 0, &ml_head, owner);
+        qemu_printf("\n");
     }
 
     /* print aliased regions */
     QTAILQ_FOREACH(ml, &ml_head, mrqueue) {
-        mon_printf(f, "memory-region: %s\n", memory_region_name(ml->mr));
-        mtree_print_mr(mon_printf, f, ml->mr, 1, 0, &ml_head, owner);
-        mon_printf(f, "\n");
+        qemu_printf("memory-region: %s\n", memory_region_name(ml->mr));
+        mtree_print_mr(ml->mr, 1, 0, &ml_head, owner);
+        qemu_printf("\n");
     }
 
     QTAILQ_FOREACH_SAFE(ml, &ml_head, mrqueue, ml2) {
diff --git a/monitor.c b/monitor.c
index 1650ceec3a..0819b99ef7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1907,8 +1907,7 @@ static void hmp_info_mtree(Monitor *mon, const QDict *qdict)
     bool dispatch_tree = qdict_get_try_bool(qdict, "dispatch_tree", false);
     bool owner = qdict_get_try_bool(qdict, "owner", false);
 
-    mtree_info((fprintf_function)monitor_printf, mon, flatview, dispatch_tree,
-               owner);
+    mtree_info(flatview, dispatch_tree, owner);
 }
 
 static void hmp_info_numa(Monitor *mon, const QDict *qdict)
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 09/17] target: Simplify how the TARGET_cpu_list() print
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (7 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 08/17] memory: Clean up how mtree_info() prints Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-18 11:28   ` Dr. David Alan Gilbert
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 10/17] target: Clean up how the dump_mmu() print Markus Armbruster
                   ` (18 subsequent siblings)
  27 siblings, 1 reply; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

The various TARGET_cpu_list() take an fprintf()-like callback and a
FILE * to pass to it.  Their callers (vl.c's main() via list_cpus(),
bsd-user/main.c's main(), linux-user/main.c's main()) all pass
fprintf() and stdout.  Thus, the flexibility provided by the (rather
tiresome) indirection isn't actually used.

Drop the callback, and call qemu_printf() instead.

Calling printf() would also work, but would make the code unsuitable
for monitor context without making it simpler.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 bsd-user/main.c                  |  2 +-
 cpus.c                           |  4 +--
 include/exec/cpu-common.h        | 13 ---------
 include/sysemu/cpus.h            |  3 +-
 linux-user/main.c                |  2 +-
 target/alpha/cpu.c               | 15 ++++------
 target/alpha/cpu.h               |  2 +-
 target/arm/cpu.c                 |  1 -
 target/arm/cpu.h                 |  2 +-
 target/arm/helper.c              | 15 ++++------
 target/cris/cpu.c                | 14 ++++-----
 target/cris/cpu.h                |  2 +-
 target/hppa/cpu.c                | 14 ++++-----
 target/hppa/cpu.h                |  2 +-
 target/i386/cpu.c                | 29 ++++++++-----------
 target/i386/cpu.h                |  2 +-
 target/lm32/cpu.c                | 14 ++++-----
 target/lm32/cpu.h                |  2 +-
 target/m68k/cpu.h                |  2 +-
 target/m68k/helper.c             | 14 +++------
 target/mips/cpu.h                |  2 +-
 target/mips/translate.c          |  1 +
 target/mips/translate_init.inc.c |  5 ++--
 target/openrisc/cpu.c            | 15 ++++------
 target/openrisc/cpu.h            |  2 +-
 target/ppc/cpu.h                 |  2 +-
 target/ppc/translate_init.inc.c  | 26 +++++++----------
 target/riscv/cpu.c               | 17 +++--------
 target/riscv/cpu.h               |  2 +-
 target/s390x/cpu.h               |  2 +-
 target/s390x/cpu_models.c        | 21 ++++++--------
 target/sh4/cpu.c                 | 17 +++--------
 target/sh4/cpu.h                 |  2 +-
 target/sparc/cpu.c               | 49 +++++++++++++++-----------------
 target/sparc/cpu.h               |  2 +-
 target/tricore/cpu.h             |  2 +-
 target/tricore/helper.c          | 15 ++++------
 target/xtensa/cpu.h              |  2 +-
 target/xtensa/helper.c           |  7 +++--
 vl.c                             |  2 +-
 40 files changed, 129 insertions(+), 218 deletions(-)

diff --git a/bsd-user/main.c b/bsd-user/main.c
index 8fd8ae4127..7657c6851d 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -819,7 +819,7 @@ int main(int argc, char **argv)
             if (is_help_option(cpu_model)) {
 /* XXX: implement xxx_cpu_list for targets that still miss it */
 #if defined(cpu_list)
-                    cpu_list(stdout, &fprintf);
+                    cpu_list();
 #endif
                 exit(1);
             }
diff --git a/cpus.c b/cpus.c
index 684aa9679a..b4eecf70f0 100644
--- a/cpus.c
+++ b/cpus.c
@@ -2181,11 +2181,11 @@ int vm_stop_force_state(RunState state)
     }
 }
 
-void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
+void list_cpus(const char *optarg)
 {
     /* XXX: implement xxx_cpu_list for targets that still miss it */
 #if defined(cpu_list)
-    cpu_list(f, cpu_fprintf);
+    cpu_list();
 #endif
 }
 
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index cef8b88a2a..848a4b94ab 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -9,19 +9,6 @@
 
 #include "qemu/bswap.h"
 #include "qemu/queue.h"
-#include "qemu/fprintf-fn.h"
-
-/**
- * CPUListState:
- * @cpu_fprintf: Print function.
- * @file: File to print to using @cpu_fprint.
- *
- * State commonly used for iterating over CPU models.
- */
-typedef struct CPUListState {
-    fprintf_function cpu_fprintf;
-    FILE *file;
-} CPUListState;
 
 /* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
 void qemu_init_cpu_list(void);
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index ef13a120cc..32c05f27e7 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -1,7 +1,6 @@
 #ifndef QEMU_CPUS_H
 #define QEMU_CPUS_H
 
-#include "qemu/fprintf-fn.h"
 #include "qemu/timer.h"
 
 /* cpus.c */
@@ -39,7 +38,7 @@ extern int smp_cores;
 extern int smp_threads;
 #endif
 
-void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg);
+void list_cpus(const char *optarg);
 
 void qemu_tcg_configure(QemuOpts *opts, Error **errp);
 
diff --git a/linux-user/main.c b/linux-user/main.c
index f9efe9ff6e..17387166ab 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -317,7 +317,7 @@ static void handle_arg_cpu(const char *arg)
     if (cpu_model == NULL || is_help_option(cpu_model)) {
         /* XXX: implement xxx_cpu_list for targets that still miss it */
 #if defined(cpu_list)
-        cpu_list(stdout, &fprintf);
+        cpu_list();
 #endif
         exit(EXIT_FAILURE);
     }
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index 1fd95d6c0f..ad3588a44a 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -21,6 +21,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/qemu-print.h"
 #include "cpu.h"
 #include "qemu-common.h"
 #include "exec/exec-all.h"
@@ -74,23 +75,17 @@ static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
 static void alpha_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
-    CPUListState *s = user_data;
 
-    (*s->cpu_fprintf)(s->file, "  %s\n",
-                      object_class_get_name(oc));
+    qemu_printf("  %s\n", object_class_get_name(oc));
 }
 
-void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void alpha_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list_sorted(TYPE_ALPHA_CPU, false);
-    (*cpu_fprintf)(f, "Available CPUs:\n");
-    g_slist_foreach(list, alpha_cpu_list_entry, &s);
+    qemu_printf("Available CPUs:\n");
+    g_slist_foreach(list, alpha_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h
index 7b50be785d..732764f23c 100644
--- a/target/alpha/cpu.h
+++ b/target/alpha/cpu.h
@@ -470,7 +470,7 @@ void alpha_translate_init(void);
 #define ALPHA_CPU_TYPE_NAME(model) model ALPHA_CPU_TYPE_SUFFIX
 #define CPU_RESOLVING_TYPE TYPE_ALPHA_CPU
 
-void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void alpha_cpu_list(void);
 /* you can call this signal handler from your SIGBUS and SIGSEGV
    signal handlers to inform the virtual CPU of exceptions. non zero
    is returned if the signal was handled by the virtual CPU.  */
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 4155782197..bb9fdc6304 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -20,7 +20,6 @@
 
 #include "qemu/osdep.h"
 #include "target/arm/idau.h"
-#include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "qapi/visitor.h"
 #include "cpu.h"
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index d4d2836923..85c3bd642a 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -1936,7 +1936,7 @@ static inline bool access_secure_reg(CPUARMState *env)
                        (arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)), \
                        (_val))
 
-void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void arm_cpu_list(void);
 uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
                                  uint32_t cur_el, bool secure);
 
diff --git a/target/arm/helper.c b/target/arm/helper.c
index a36f4b3d69..57ef75b3fc 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -10,6 +10,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/bitops.h"
 #include "qemu/crc32c.h"
+#include "qemu/qemu-print.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "arm_ldst.h"
@@ -6724,29 +6725,23 @@ static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b)
 static void arm_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
-    CPUListState *s = user_data;
     const char *typename;
     char *name;
 
     typename = object_class_get_name(oc);
     name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU));
-    (*s->cpu_fprintf)(s->file, "  %s\n",
-                      name);
+    qemu_printf("  %s\n", name);
     g_free(name);
 }
 
-void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void arm_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list(TYPE_ARM_CPU, false);
     list = g_slist_sort(list, arm_cpu_list_compare);
-    (*cpu_fprintf)(f, "Available CPUs:\n");
-    g_slist_foreach(list, arm_cpu_list_entry, &s);
+    qemu_printf("Available CPUs:\n");
+    g_slist_foreach(list, arm_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
index a23aba2688..75729bfdd5 100644
--- a/target/cris/cpu.c
+++ b/target/cris/cpu.c
@@ -23,6 +23,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/qemu-print.h"
 #include "cpu.h"
 #include "qemu-common.h"
 #include "mmu.h"
@@ -103,27 +104,22 @@ static gint cris_cpu_list_compare(gconstpointer a, gconstpointer b)
 static void cris_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
-    CPUListState *s = user_data;
     const char *typename = object_class_get_name(oc);
     char *name;
 
     name = g_strndup(typename, strlen(typename) - strlen(CRIS_CPU_TYPE_SUFFIX));
-    (*s->cpu_fprintf)(s->file, "  %s\n", name);
+    qemu_printf("  %s\n", name);
     g_free(name);
 }
 
-void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void cris_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list(TYPE_CRIS_CPU, false);
     list = g_slist_sort(list, cris_cpu_list_compare);
-    (*cpu_fprintf)(f, "Available CPUs:\n");
-    g_slist_foreach(list, cris_cpu_list_entry, &s);
+    qemu_printf("Available CPUs:\n");
+    g_slist_foreach(list, cris_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/cris/cpu.h b/target/cris/cpu.h
index 8bb1dbc989..3d11922fb2 100644
--- a/target/cris/cpu.h
+++ b/target/cris/cpu.h
@@ -308,6 +308,6 @@ static inline void cpu_get_tb_cpu_state(CPUCRISState *env, target_ulong *pc,
 }
 
 #define cpu_list cris_cpu_list
-void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void cris_cpu_list(void);
 
 #endif
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 00bf444620..e64f48581e 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/qemu-print.h"
 #include "cpu.h"
 #include "qemu-common.h"
 #include "exec/exec-all.h"
@@ -113,22 +114,17 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
 static void hppa_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
-    CPUListState *s = user_data;
 
-    (*s->cpu_fprintf)(s->file, "  %s\n", object_class_get_name(oc));
+    qemu_printf("  %s\n", object_class_get_name(oc));
 }
 
-void hppa_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void hppa_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list_sorted(TYPE_HPPA_CPU, false);
-    (*cpu_fprintf)(f, "Available CPUs:\n");
-    g_slist_foreach(list, hppa_cpu_list_entry, &s);
+    qemu_printf("Available CPUs:\n");
+    g_slist_foreach(list, hppa_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index c062c7969c..db8c9b812c 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -272,7 +272,7 @@ void hppa_translate_init(void);
 
 #define CPU_RESOLVING_TYPE TYPE_HPPA_CPU
 
-void hppa_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void hppa_cpu_list(void);
 
 static inline target_ulong hppa_form_gva_psw(target_ureg psw, uint64_t spc,
                                              target_ureg off)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index d6bb57d210..e1687f7547 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -21,6 +21,7 @@
 #include "qemu/units.h"
 #include "qemu/cutils.h"
 #include "qemu/bitops.h"
+#include "qemu/qemu-print.h"
 
 #include "cpu.h"
 #include "exec/exec-all.h"
@@ -3671,7 +3672,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
 
 /* Print all cpuid feature names in featureset
  */
-static void listflags(FILE *f, fprintf_function print, GList *features)
+static void listflags(GList *features)
 {
     size_t len = 0;
     GList *tmp;
@@ -3679,13 +3680,13 @@ static void listflags(FILE *f, fprintf_function print, GList *features)
     for (tmp = features; tmp; tmp = tmp->next) {
         const char *name = tmp->data;
         if ((len + strlen(name) + 1) >= 75) {
-            print(f, "\n");
+            qemu_printf("\n");
             len = 0;
         }
-        print(f, "%s%s", len == 0 ? "  " : " ", name);
+        qemu_printf("%s%s", len == 0 ? "  " : " ", name);
         len += strlen(name) + 1;
     }
-    print(f, "\n");
+    qemu_printf("\n");
 }
 
 /* Sort alphabetically by type name, respecting X86CPUClass::ordering. */
@@ -3721,32 +3722,26 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
     X86CPUClass *cc = X86_CPU_CLASS(oc);
-    CPUListState *s = user_data;
     char *name = x86_cpu_class_get_model_name(cc);
     const char *desc = cc->model_description;
     if (!desc && cc->cpu_def) {
         desc = cc->cpu_def->model_id;
     }
 
-    (*s->cpu_fprintf)(s->file, "x86 %-20s  %-48s\n",
-                      name, desc);
+    qemu_printf("x86 %-20s  %-48s\n", name, desc);
     g_free(name);
 }
 
 /* list available CPU models and flags */
-void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void x86_cpu_list(void)
 {
     int i, j;
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
     GList *names = NULL;
 
-    (*cpu_fprintf)(f, "Available CPUs:\n");
+    qemu_printf("Available CPUs:\n");
     list = get_sorted_cpu_model_list();
-    g_slist_foreach(list, x86_cpu_list_entry, &s);
+    g_slist_foreach(list, x86_cpu_list_entry, NULL);
     g_slist_free(list);
 
     names = NULL;
@@ -3761,9 +3756,9 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
 
     names = g_list_sort(names, (GCompareFunc)strcmp);
 
-    (*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
-    listflags(f, cpu_fprintf, names);
-    (*cpu_fprintf)(f, "\n");
+    qemu_printf("\nRecognized CPUID flags:\n");
+    listflags(names);
+    qemu_printf("\n");
     g_list_free(names);
 }
 
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 83fb522554..b39327dcb7 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1532,7 +1532,7 @@ int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 void x86_cpu_exec_enter(CPUState *cpu);
 void x86_cpu_exec_exit(CPUState *cpu);
 
-void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void x86_cpu_list(void);
 int cpu_x86_support_mca_broadcast(CPUX86State *env);
 
 int cpu_get_pic_interrupt(CPUX86State *s);
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
index b7499cb627..282da19994 100644
--- a/target/lm32/cpu.c
+++ b/target/lm32/cpu.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/qemu-print.h"
 #include "cpu.h"
 #include "qemu-common.h"
 
@@ -34,27 +35,22 @@ static void lm32_cpu_set_pc(CPUState *cs, vaddr value)
 static void lm32_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
-    CPUListState *s = user_data;
     const char *typename = object_class_get_name(oc);
     char *name;
 
     name = g_strndup(typename, strlen(typename) - strlen(LM32_CPU_TYPE_SUFFIX));
-    (*s->cpu_fprintf)(s->file, "  %s\n", name);
+    qemu_printf("  %s\n", name);
     g_free(name);
 }
 
 
-void lm32_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void lm32_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list_sorted(TYPE_LM32_CPU, false);
-    (*cpu_fprintf)(f, "Available CPUs:\n");
-    g_slist_foreach(list, lm32_cpu_list_entry, &s);
+    qemu_printf("Available CPUs:\n");
+    g_slist_foreach(list, lm32_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h
index 66157eefe9..b8d539ead8 100644
--- a/target/lm32/cpu.h
+++ b/target/lm32/cpu.h
@@ -243,7 +243,7 @@ static inline lm32_wp_t lm32_wp_type(uint32_t dc, int idx)
    is returned if the signal was handled by the virtual CPU.  */
 int cpu_lm32_signal_handler(int host_signum, void *pinfo,
                           void *puc);
-void lm32_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void lm32_cpu_list(void);
 void lm32_translate_init(void);
 void cpu_lm32_set_phys_msb_ignore(CPULM32State *env, int value);
 void QEMU_NORETURN raise_exception(CPULM32State *env, int index);
diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
index f154565117..9c1f0a2458 100644
--- a/target/m68k/cpu.h
+++ b/target/m68k/cpu.h
@@ -499,7 +499,7 @@ static inline int m68k_feature(CPUM68KState *env, int feature)
     return (env->features & (1u << feature)) != 0;
 }
 
-void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void m68k_cpu_list(void);
 
 void register_m68k_insns (CPUM68KState *env);
 
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 3e26d337bf..bb64cf15c0 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -22,9 +22,9 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/gdbstub.h"
-
 #include "exec/helper-proto.h"
 #include "fpu/softfloat.h"
+#include "qemu/qemu-print.h"
 
 #define SIGNBIT (1u << 31)
 
@@ -49,28 +49,22 @@ static gint m68k_cpu_list_compare(gconstpointer a, gconstpointer b)
 static void m68k_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *c = data;
-    CPUListState *s = user_data;
     const char *typename;
     char *name;
 
     typename = object_class_get_name(c);
     name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_M68K_CPU));
-    (*s->cpu_fprintf)(s->file, "%s\n",
-                      name);
+    qemu_printf("%s\n", name);
     g_free(name);
 }
 
-void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void m68k_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list(TYPE_M68K_CPU, false);
     list = g_slist_sort(list, m68k_cpu_list_compare);
-    g_slist_foreach(list, m68k_cpu_list_entry, &s);
+    g_slist_foreach(list, m68k_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/mips/cpu.h b/target/mips/cpu.h
index a10eeb0de3..1f41cf66d5 100644
--- a/target/mips/cpu.h
+++ b/target/mips/cpu.h
@@ -1065,7 +1065,7 @@ static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env)
 
 #define ENV_OFFSET offsetof(MIPSCPU, env)
 
-void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf);
+void mips_cpu_list(void);
 
 #define cpu_signal_handler cpu_mips_signal_handler
 #define cpu_list mips_cpu_list
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 364bd6dc4f..d886a0c9b2 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -38,6 +38,7 @@
 #include "trace-tcg.h"
 #include "exec/translator.h"
 #include "exec/log.h"
+#include "qemu/qemu-print.h"
 
 #define MIPS_DEBUG_DISAS 0
 
diff --git a/target/mips/translate_init.inc.c b/target/mips/translate_init.inc.c
index bf559aff08..1c2d017d36 100644
--- a/target/mips/translate_init.inc.c
+++ b/target/mips/translate_init.inc.c
@@ -835,13 +835,12 @@ const mips_def_t mips_defs[] =
 };
 const int mips_defs_number = ARRAY_SIZE(mips_defs);
 
-void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf)
+void mips_cpu_list(void)
 {
     int i;
 
     for (i = 0; i < ARRAY_SIZE(mips_defs); i++) {
-        (*cpu_fprintf)(f, "MIPS '%s'\n",
-                       mips_defs[i].name);
+        qemu_printf("MIPS '%s'\n", mips_defs[i].name);
     }
 }
 
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
index 541b2a66c7..d125236977 100644
--- a/target/openrisc/cpu.c
+++ b/target/openrisc/cpu.c
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/qemu-print.h"
 #include "cpu.h"
 #include "qemu-common.h"
 
@@ -180,30 +181,24 @@ static gint openrisc_cpu_list_compare(gconstpointer a, gconstpointer b)
 static void openrisc_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
-    CPUListState *s = user_data;
     const char *typename;
     char *name;
 
     typename = object_class_get_name(oc);
     name = g_strndup(typename,
                      strlen(typename) - strlen("-" TYPE_OPENRISC_CPU));
-    (*s->cpu_fprintf)(s->file, "  %s\n",
-                      name);
+    qemu_printf("  %s\n", name);
     g_free(name);
 }
 
-void cpu_openrisc_list(FILE *f, fprintf_function cpu_fprintf)
+void cpu_openrisc_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list(TYPE_OPENRISC_CPU, false);
     list = g_slist_sort(list, openrisc_cpu_list_compare);
-    (*cpu_fprintf)(f, "Available CPUs:\n");
-    g_slist_foreach(list, openrisc_cpu_list_entry, &s);
+    qemu_printf("Available CPUs:\n");
+    g_slist_foreach(list, openrisc_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h
index f1b31bc24a..9d2d49631e 100644
--- a/target/openrisc/cpu.h
+++ b/target/openrisc/cpu.h
@@ -336,7 +336,7 @@ static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)
 
 #define ENV_OFFSET offsetof(OpenRISCCPU, env)
 
-void cpu_openrisc_list(FILE *f, fprintf_function cpu_fprintf);
+void cpu_openrisc_list(void);
 void openrisc_cpu_do_interrupt(CPUState *cpu);
 bool openrisc_cpu_exec_interrupt(CPUState *cpu, int int_req);
 void openrisc_cpu_dump_state(CPUState *cpu, FILE *f,
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 0707177584..382a323c61 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1308,7 +1308,7 @@ void ppc_store_ptcr(CPUPPCState *env, target_ulong value);
 #endif /* !defined(CONFIG_USER_ONLY) */
 void ppc_store_msr (CPUPPCState *env, target_ulong value);
 
-void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf);
+void ppc_cpu_list(void);
 
 /* Time-base and decrementer management */
 #ifndef NO_CPU_IO_DEFS
diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
index 0bd555eb19..996356dd99 100644
--- a/target/ppc/translate_init.inc.c
+++ b/target/ppc/translate_init.inc.c
@@ -28,6 +28,7 @@
 #include "mmu-hash32.h"
 #include "mmu-hash64.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qnull.h"
 #include "qapi/visitor.h"
@@ -10215,7 +10216,6 @@ static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b)
 static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
-    CPUListState *s = user_data;
     PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
     DeviceClass *family = DEVICE_CLASS(ppc_cpu_get_family_class(pcc));
     const char *typename = object_class_get_name(oc);
@@ -10228,8 +10228,7 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
 
     name = g_strndup(typename,
                      strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
-    (*s->cpu_fprintf)(s->file, "PowerPC %-16s PVR %08x\n",
-                      name, pcc->pvr);
+    qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr);
     for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
         PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
         ObjectClass *alias_oc = ppc_cpu_class_by_name(alias->model);
@@ -10242,33 +10241,28 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
          * avoid printing the wrong alias here and use "preferred" instead
          */
         if (strcmp(alias->alias, family->desc) == 0) {
-            (*s->cpu_fprintf)(s->file,
-                              "PowerPC %-16s (alias for preferred %s CPU)\n",
-                              alias->alias, family->desc);
+            qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n",
+                        alias->alias, family->desc);
         } else {
-            (*s->cpu_fprintf)(s->file, "PowerPC %-16s (alias for %s)\n",
-                              alias->alias, name);
+            qemu_printf("PowerPC %-16s (alias for %s)\n",
+                        alias->alias, name);
         }
     }
     g_free(name);
 }
 
-void ppc_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void ppc_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list(TYPE_POWERPC_CPU, false);
     list = g_slist_sort(list, ppc_cpu_list_compare);
-    g_slist_foreach(list, ppc_cpu_list_entry, &s);
+    g_slist_foreach(list, ppc_cpu_list_entry, NULL);
     g_slist_free(list);
 
 #ifdef CONFIG_KVM
-    cpu_fprintf(f, "\n");
-    cpu_fprintf(f, "PowerPC %-16s\n", "host");
+    qemu_printf("\n");
+    qemu_printf("PowerPC %-16s\n", "host");
 #endif
 }
 
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index d61bce6d55..104e676ab0 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -18,6 +18,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/qemu-print.h"
 #include "qemu/log.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
@@ -383,11 +384,6 @@ char *riscv_isa_string(RISCVCPU *cpu)
     return isa_str;
 }
 
-typedef struct RISCVCPUListState {
-    fprintf_function cpu_fprintf;
-    FILE *file;
-} RISCVCPUListState;
-
 static gint riscv_cpu_list_compare(gconstpointer a, gconstpointer b)
 {
     ObjectClass *class_a = (ObjectClass *)a;
@@ -401,24 +397,19 @@ static gint riscv_cpu_list_compare(gconstpointer a, gconstpointer b)
 
 static void riscv_cpu_list_entry(gpointer data, gpointer user_data)
 {
-    RISCVCPUListState *s = user_data;
     const char *typename = object_class_get_name(OBJECT_CLASS(data));
     int len = strlen(typename) - strlen(RISCV_CPU_TYPE_SUFFIX);
 
-    (*s->cpu_fprintf)(s->file, "%.*s\n", len, typename);
+    qemu_printf("%.*s\n", len, typename);
 }
 
-void riscv_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void riscv_cpu_list(void)
 {
-    RISCVCPUListState s = {
-        .cpu_fprintf = cpu_fprintf,
-        .file = f,
-    };
     GSList *list;
 
     list = object_class_get_list(TYPE_RISCV_CPU, false);
     list = g_slist_sort(list, riscv_cpu_list_compare);
-    g_slist_foreach(list, riscv_cpu_list_entry, &s);
+    g_slist_foreach(list, riscv_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 20bce8742e..7d9f48973f 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -264,7 +264,7 @@ void  riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
 int riscv_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size,
                               int rw, int mmu_idx);
 char *riscv_isa_string(RISCVCPU *cpu);
-void riscv_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void riscv_cpu_list(void);
 
 #define cpu_signal_handler riscv_cpu_signal_handler
 #define cpu_list riscv_cpu_list
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index cb6d77053a..d8990c405a 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -753,7 +753,7 @@ static inline uint8_t s390_cpu_get_state(S390CPU *cpu)
 
 
 /* cpu_models.c */
-void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void s390_cpu_list(void);
 #define cpu_list s390_cpu_list
 void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga,
                              const S390FeatInit feat_init);
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index eb125d4d0d..e5afa15512 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -18,6 +18,7 @@
 #include "qapi/error.h"
 #include "qapi/visitor.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/qobject-input-visitor.h"
 #include "qapi/qmp/qdict.h"
@@ -308,7 +309,6 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga,
 
 static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_data)
 {
-    CPUListState *s = user_data;
     const S390CPUClass *scc = S390_CPU_CLASS((ObjectClass *)data);
     char *name = g_strdup(object_class_get_name((ObjectClass *)data));
     const char *details = "";
@@ -321,8 +321,7 @@ static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_data)
 
     /* strip off the -s390x-cpu */
     g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
-    (*s->cpu_fprintf)(s->file, "s390 %-15s %-35s %s\n", name, scc->desc,
-                      details);
+    qemu_printf("s390 %-15s %-35s %s\n", name, scc->desc, details);
     g_free(name);
 }
 
@@ -360,33 +359,29 @@ static gint s390_cpu_list_compare(gconstpointer a, gconstpointer b)
     return cc_a->is_static ? -1 : 1;
 }
 
-void s390_cpu_list(FILE *f, fprintf_function print)
+void s390_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = print,
-    };
     S390FeatGroup group;
     S390Feat feat;
     GSList *list;
 
     list = object_class_get_list(TYPE_S390_CPU, false);
     list = g_slist_sort(list, s390_cpu_list_compare);
-    g_slist_foreach(list, s390_print_cpu_model_list_entry, &s);
+    g_slist_foreach(list, s390_print_cpu_model_list_entry, NULL);
     g_slist_free(list);
 
-    (*print)(f, "\nRecognized feature flags:\n");
+    qemu_printf("\nRecognized feature flags:\n");
     for (feat = 0; feat < S390_FEAT_MAX; feat++) {
         const S390FeatDef *def = s390_feat_def(feat);
 
-        (*print)(f, "%-20s %-50s\n", def->name, def->desc);
+        qemu_printf("%-20s %-50s\n", def->name, def->desc);
     }
 
-    (*print)(f, "\nRecognized feature groups:\n");
+    qemu_printf("\nRecognized feature groups:\n");
     for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
         const S390FeatGroupDef *def = s390_feat_group_def(group);
 
-        (*print)(f, "%-20s %-50s\n", def->name, def->desc);
+        qemu_printf("%-20s %-50s\n", def->name, def->desc);
     }
 }
 
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
index b9f393b7c7..da2799082e 100644
--- a/target/sh4/cpu.c
+++ b/target/sh4/cpu.c
@@ -21,6 +21,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
+#include "qemu/qemu-print.h"
 #include "cpu.h"
 #include "qemu-common.h"
 #include "migration/vmstate.h"
@@ -79,30 +80,20 @@ static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
     info->print_insn = print_insn_sh;
 }
 
-typedef struct SuperHCPUListState {
-    fprintf_function cpu_fprintf;
-    FILE *file;
-} SuperHCPUListState;
-
 static void superh_cpu_list_entry(gpointer data, gpointer user_data)
 {
-    SuperHCPUListState *s = user_data;
     const char *typename = object_class_get_name(OBJECT_CLASS(data));
     int len = strlen(typename) - strlen(SUPERH_CPU_TYPE_SUFFIX);
 
-    (*s->cpu_fprintf)(s->file, "%.*s\n", len, typename);
+    qemu_printf("%.*s\n", len, typename);
 }
 
-void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void sh4_cpu_list(void)
 {
-    SuperHCPUListState s = {
-        .cpu_fprintf = cpu_fprintf,
-        .file = f,
-    };
     GSList *list;
 
     list = object_class_get_list_sorted(TYPE_SUPERH_CPU, false);
-    g_slist_foreach(list, superh_cpu_list_entry, &s);
+    g_slist_foreach(list, superh_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h
index 775b5743bf..3e43f0a1a5 100644
--- a/target/sh4/cpu.h
+++ b/target/sh4/cpu.h
@@ -247,7 +247,7 @@ int cpu_sh4_signal_handler(int host_signum, void *pinfo,
 int superh_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int rw,
                                 int mmu_idx);
 
-void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void sh4_cpu_list(void);
 #if !defined(CONFIG_USER_ONLY)
 void cpu_sh4_invalidate_tlb(CPUSH4State *s);
 uint32_t cpu_sh4_read_mmaped_itlb_addr(CPUSH4State *s,
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 4a4445bdf5..fd88a31806 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -20,7 +20,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "cpu.h"
-#include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "exec/exec-all.h"
 #include "hw/qdev-properties.h"
 #include "qapi/visitor.h"
@@ -556,47 +556,44 @@ static const char * const feature_name[] = {
     "gl",
 };
 
-static void print_features(FILE *f, fprintf_function cpu_fprintf,
-                           uint32_t features, const char *prefix)
+static void print_features(uint32_t features, const char *prefix)
 {
     unsigned int i;
 
     for (i = 0; i < ARRAY_SIZE(feature_name); i++) {
         if (feature_name[i] && (features & (1 << i))) {
             if (prefix) {
-                (*cpu_fprintf)(f, "%s", prefix);
+                qemu_printf("%s", prefix);
             }
-            (*cpu_fprintf)(f, "%s ", feature_name[i]);
+            qemu_printf("%s ", feature_name[i]);
         }
     }
 }
 
-void sparc_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void sparc_cpu_list(void)
 {
     unsigned int i;
 
     for (i = 0; i < ARRAY_SIZE(sparc_defs); i++) {
-        (*cpu_fprintf)(f, "Sparc %16s IU " TARGET_FMT_lx
-                       " FPU %08x MMU %08x NWINS %d ",
-                       sparc_defs[i].name,
-                       sparc_defs[i].iu_version,
-                       sparc_defs[i].fpu_version,
-                       sparc_defs[i].mmu_version,
-                       sparc_defs[i].nwindows);
-        print_features(f, cpu_fprintf, CPU_DEFAULT_FEATURES &
-                       ~sparc_defs[i].features, "-");
-        print_features(f, cpu_fprintf, ~CPU_DEFAULT_FEATURES &
-                       sparc_defs[i].features, "+");
-        (*cpu_fprintf)(f, "\n");
+        qemu_printf("Sparc %16s IU " TARGET_FMT_lx
+                    " FPU %08x MMU %08x NWINS %d ",
+                    sparc_defs[i].name,
+                    sparc_defs[i].iu_version,
+                    sparc_defs[i].fpu_version,
+                    sparc_defs[i].mmu_version,
+                    sparc_defs[i].nwindows);
+        print_features(CPU_DEFAULT_FEATURES & ~sparc_defs[i].features, "-");
+        print_features(~CPU_DEFAULT_FEATURES & sparc_defs[i].features, "+");
+        qemu_printf("\n");
     }
-    (*cpu_fprintf)(f, "Default CPU feature flags (use '-' to remove): ");
-    print_features(f, cpu_fprintf, CPU_DEFAULT_FEATURES, NULL);
-    (*cpu_fprintf)(f, "\n");
-    (*cpu_fprintf)(f, "Available CPU feature flags (use '+' to add): ");
-    print_features(f, cpu_fprintf, ~CPU_DEFAULT_FEATURES, NULL);
-    (*cpu_fprintf)(f, "\n");
-    (*cpu_fprintf)(f, "Numerical features (use '=' to set): iu_version "
-                   "fpu_version mmu_version nwindows\n");
+    qemu_printf("Default CPU feature flags (use '-' to remove): ");
+    print_features(CPU_DEFAULT_FEATURES, NULL);
+    qemu_printf("\n");
+    qemu_printf("Available CPU feature flags (use '+' to add): ");
+    print_features(~CPU_DEFAULT_FEATURES, NULL);
+    qemu_printf("\n");
+    qemu_printf("Numerical features (use '=' to set): iu_version "
+                "fpu_version mmu_version nwindows\n");
 }
 
 static void cpu_print_cc(FILE *f, fprintf_function cpu_fprintf,
diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h
index 4972ebcfd4..ab9fa3ddbf 100644
--- a/target/sparc/cpu.h
+++ b/target/sparc/cpu.h
@@ -578,7 +578,7 @@ void cpu_raise_exception_ra(CPUSPARCState *, int, uintptr_t) QEMU_NORETURN;
 #ifndef NO_CPU_IO_DEFS
 /* cpu_init.c */
 void cpu_sparc_set_id(CPUSPARCState *env, unsigned int cpu);
-void sparc_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void sparc_cpu_list(void);
 /* mmu_helper.c */
 int sparc_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int rw,
                                int mmu_idx);
diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
index 00e69dc154..43d577ce8e 100644
--- a/target/tricore/cpu.h
+++ b/target/tricore/cpu.h
@@ -375,7 +375,7 @@ void fpu_set_state(CPUTriCoreState *env);
 
 #define MMU_USER_IDX 2
 
-void tricore_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void tricore_cpu_list(void);
 
 #define cpu_signal_handler cpu_tricore_signal_handler
 #define cpu_list tricore_cpu_list
diff --git a/target/tricore/helper.c b/target/tricore/helper.c
index 0769046993..78ee87c9ea 100644
--- a/target/tricore/helper.c
+++ b/target/tricore/helper.c
@@ -20,6 +20,7 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "fpu/softfloat.h"
+#include "qemu/qemu-print.h"
 
 enum {
     TLBRET_DIRTY = -4,
@@ -82,28 +83,22 @@ int cpu_tricore_handle_mmu_fault(CPUState *cs, target_ulong address,
 static void tricore_cpu_list_entry(gpointer data, gpointer user_data)
 {
     ObjectClass *oc = data;
-    CPUListState *s = user_data;
     const char *typename;
     char *name;
 
     typename = object_class_get_name(oc);
     name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_TRICORE_CPU));
-    (*s->cpu_fprintf)(s->file, "  %s\n",
-                      name);
+    qemu_printf("  %s\n", name);
     g_free(name);
 }
 
-void tricore_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void tricore_cpu_list(void)
 {
-    CPUListState s = {
-        .file = f,
-        .cpu_fprintf = cpu_fprintf,
-    };
     GSList *list;
 
     list = object_class_get_list_sorted(TYPE_TRICORE_CPU, false);
-    (*cpu_fprintf)(f, "Available CPUs:\n");
-    g_slist_foreach(list, tricore_cpu_list_entry, &s);
+    qemu_printf("Available CPUs:\n");
+    g_slist_foreach(list, tricore_cpu_list_entry, NULL);
     g_slist_free(list);
 }
 
diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h
index 4d8152682f..4aaf1f7bb2 100644
--- a/target/xtensa/cpu.h
+++ b/target/xtensa/cpu.h
@@ -600,7 +600,7 @@ void xtensa_irq_init(CPUXtensaState *env);
 qemu_irq *xtensa_get_extints(CPUXtensaState *env);
 qemu_irq xtensa_get_runstall(CPUXtensaState *env);
 int cpu_xtensa_signal_handler(int host_signum, void *pinfo, void *puc);
-void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void xtensa_cpu_list(void);
 void xtensa_sync_window_from_phys(CPUXtensaState *env);
 void xtensa_sync_phys_from_window(CPUXtensaState *env);
 void xtensa_rotate_window(CPUXtensaState *env, uint32_t delta);
diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
index f4867a9b56..5f37f378a3 100644
--- a/target/xtensa/helper.c
+++ b/target/xtensa/helper.c
@@ -31,6 +31,7 @@
 #include "exec/gdbstub.h"
 #include "exec/helper-proto.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "qemu/host-utils.h"
 
 static struct XtensaConfigList *xtensa_cores;
@@ -228,12 +229,12 @@ void xtensa_breakpoint_handler(CPUState *cs)
     }
 }
 
-void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf)
+void xtensa_cpu_list(void)
 {
     XtensaConfigList *core = xtensa_cores;
-    cpu_fprintf(f, "Available CPUs:\n");
+    qemu_printf("Available CPUs:\n");
     for (; core; core = core->next) {
-        cpu_fprintf(f, "  %s\n", core->config->name);
+        qemu_printf("  %s\n", core->config->name);
     }
 }
 
diff --git a/vl.c b/vl.c
index 190c773176..ff5dfb6fbc 100644
--- a/vl.c
+++ b/vl.c
@@ -4051,7 +4051,7 @@ int main(int argc, char **argv, char **envp)
     }
 
     if (cpu_model && is_help_option(cpu_model)) {
-        list_cpus(stdout, &fprintf, cpu_model);
+        list_cpus(cpu_model);
         exit(0);
     }
 
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 10/17] target: Clean up how the dump_mmu() print
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (8 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 09/17] target: Simplify how the TARGET_cpu_list() print Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 11/17] target/i386: Simplify how x86_cpu_dump_local_apic_state() prints Markus Armbruster
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

The various dump_mmu() take an fprintf()-like callback and a FILE * to
pass to it, and so do their helper functions.  Passing around callback
and argument is rather tiresome.

Most dump_mmu() are called only by the target's hmp_info_tlb().  These
all pass monitor_printf() cast to fprintf_function and the current
monitor cast to FILE *.

SPARC's dump_mmu() gets also called from target/sparc/ldst_helper.c a
few times #ifdef DEBUG_MMU.  These calls pass fprintf() and stdout.

The type-punning is technically undefined behaviour, but works in
practice.  Clean up: drop the callback, and call qemu_printf()
instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 target/m68k/cpu.h          |   3 +-
 target/m68k/helper.c       | 115 ++++++++++++++++++-------------------
 target/m68k/monitor.c      |   2 +-
 target/nios2/cpu.h         |   2 +-
 target/nios2/mmu.c         |   7 ++-
 target/nios2/monitor.c     |   2 +-
 target/ppc/cpu.h           |   2 +-
 target/ppc/mmu-hash64.c    |   7 ++-
 target/ppc/mmu-hash64.h    |   2 +-
 target/ppc/mmu_helper.c    |  70 +++++++++++-----------
 target/ppc/monitor.c       |   2 +-
 target/sparc/cpu.h         |   2 +-
 target/sparc/ldst_helper.c |  18 +++---
 target/sparc/mmu_helper.c  |  97 +++++++++++++++----------------
 target/sparc/monitor.c     |   2 +-
 target/xtensa/cpu.h        |   2 +-
 target/xtensa/mmu_helper.c |  24 ++++----
 target/xtensa/monitor.c    |   2 +-
 18 files changed, 178 insertions(+), 183 deletions(-)

diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
index 9c1f0a2458..73952f6ece 100644
--- a/target/m68k/cpu.h
+++ b/target/m68k/cpu.h
@@ -573,5 +573,6 @@ static inline void cpu_get_tb_cpu_state(CPUM68KState *env, target_ulong *pc,
     }
 }
 
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUM68KState *env);
+void dump_mmu(CPUM68KState *env);
+
 #endif
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index bb64cf15c0..d958a34959 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -369,30 +369,28 @@ int m68k_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw,
 
 /* MMU: 68040 only */
 
-static void print_address_zone(FILE *f, fprintf_function cpu_fprintf,
-                               uint32_t logical, uint32_t physical,
+static void print_address_zone(uint32_t logical, uint32_t physical,
                                uint32_t size, int attr)
 {
-    cpu_fprintf(f, "%08x - %08x -> %08x - %08x %c ",
+    qemu_printf("%08x - %08x -> %08x - %08x %c ",
                 logical, logical + size - 1,
                 physical, physical + size - 1,
                 attr & 4 ? 'W' : '-');
     size >>= 10;
     if (size < 1024) {
-        cpu_fprintf(f, "(%d KiB)\n", size);
+        qemu_printf("(%d KiB)\n", size);
     } else {
         size >>= 10;
         if (size < 1024) {
-            cpu_fprintf(f, "(%d MiB)\n", size);
+            qemu_printf("(%d MiB)\n", size);
         } else {
             size >>= 10;
-            cpu_fprintf(f, "(%d GiB)\n", size);
+            qemu_printf("(%d GiB)\n", size);
         }
     }
 }
 
-static void dump_address_map(FILE *f, fprintf_function cpu_fprintf,
-                             CPUM68KState *env, uint32_t root_pointer)
+static void dump_address_map(CPUM68KState *env, uint32_t root_pointer)
 {
     int i, j, k;
     int tic_size, tic_shift;
@@ -454,7 +452,7 @@ static void dump_address_map(FILE *f, fprintf_function cpu_fprintf,
                     if (first_logical != 0xffffffff) {
                         size = last_logical + (1 << tic_shift) -
                                first_logical;
-                        print_address_zone(f, cpu_fprintf, first_logical,
+                        print_address_zone(first_logical,
                                            first_physical, size, last_attr);
                     }
                     first_logical = logical;
@@ -465,126 +463,125 @@ static void dump_address_map(FILE *f, fprintf_function cpu_fprintf,
     }
     if (first_logical != logical || (attr & 4) != (last_attr & 4)) {
         size = logical + (1 << tic_shift) - first_logical;
-        print_address_zone(f, cpu_fprintf, first_logical, first_physical, size,
-                           last_attr);
+        print_address_zone(first_logical, first_physical, size, last_attr);
     }
 }
 
 #define DUMP_CACHEFLAGS(a) \
     switch (a & M68K_DESC_CACHEMODE) { \
     case M68K_DESC_CM_WRTHRU: /* cachable, write-through */ \
-        cpu_fprintf(f, "T"); \
+        qemu_printf("T"); \
         break; \
     case M68K_DESC_CM_COPYBK: /* cachable, copyback */ \
-        cpu_fprintf(f, "C"); \
+        qemu_printf("C"); \
         break; \
     case M68K_DESC_CM_SERIAL: /* noncachable, serialized */ \
-        cpu_fprintf(f, "S"); \
+        qemu_printf("S"); \
         break; \
     case M68K_DESC_CM_NCACHE: /* noncachable */ \
-        cpu_fprintf(f, "N"); \
+        qemu_printf("N"); \
         break; \
     }
 
-static void dump_ttr(FILE *f, fprintf_function cpu_fprintf, uint32_t ttr)
+static void dump_ttr(uint32_t ttr)
 {
     if ((ttr & M68K_TTR_ENABLED) == 0) {
-        cpu_fprintf(f, "disabled\n");
+        qemu_printf("disabled\n");
         return;
     }
-    cpu_fprintf(f, "Base: 0x%08x Mask: 0x%08x Control: ",
+    qemu_printf("Base: 0x%08x Mask: 0x%08x Control: ",
                 ttr & M68K_TTR_ADDR_BASE,
                 (ttr & M68K_TTR_ADDR_MASK) << M68K_TTR_ADDR_MASK_SHIFT);
     switch (ttr & M68K_TTR_SFIELD) {
     case M68K_TTR_SFIELD_USER:
-        cpu_fprintf(f, "U");
+        qemu_printf("U");
         break;
     case M68K_TTR_SFIELD_SUPER:
-        cpu_fprintf(f, "S");
+        qemu_printf("S");
         break;
     default:
-        cpu_fprintf(f, "*");
+        qemu_printf("*");
         break;
     }
     DUMP_CACHEFLAGS(ttr);
     if (ttr & M68K_DESC_WRITEPROT) {
-        cpu_fprintf(f, "R");
+        qemu_printf("R");
     } else {
-        cpu_fprintf(f, "W");
+        qemu_printf("W");
     }
-    cpu_fprintf(f, " U: %d\n", (ttr & M68K_DESC_USERATTR) >>
+    qemu_printf(" U: %d\n", (ttr & M68K_DESC_USERATTR) >>
                                M68K_DESC_USERATTR_SHIFT);
 }
 
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUM68KState *env)
+void dump_mmu(CPUM68KState *env)
 {
     if ((env->mmu.tcr & M68K_TCR_ENABLED) == 0) {
-        cpu_fprintf(f, "Translation disabled\n");
+        qemu_printf("Translation disabled\n");
         return;
     }
-    cpu_fprintf(f, "Page Size: ");
+    qemu_printf("Page Size: ");
     if (env->mmu.tcr & M68K_TCR_PAGE_8K) {
-        cpu_fprintf(f, "8kB\n");
+        qemu_printf("8kB\n");
     } else {
-        cpu_fprintf(f, "4kB\n");
+        qemu_printf("4kB\n");
     }
 
-    cpu_fprintf(f, "MMUSR: ");
+    qemu_printf("MMUSR: ");
     if (env->mmu.mmusr & M68K_MMU_B_040) {
-        cpu_fprintf(f, "BUS ERROR\n");
+        qemu_printf("BUS ERROR\n");
     } else {
-        cpu_fprintf(f, "Phy=%08x Flags: ", env->mmu.mmusr & 0xfffff000);
+        qemu_printf("Phy=%08x Flags: ", env->mmu.mmusr & 0xfffff000);
         /* flags found on the page descriptor */
         if (env->mmu.mmusr & M68K_MMU_G_040) {
-            cpu_fprintf(f, "G"); /* Global */
+            qemu_printf("G"); /* Global */
         } else {
-            cpu_fprintf(f, ".");
+            qemu_printf(".");
         }
         if (env->mmu.mmusr & M68K_MMU_S_040) {
-            cpu_fprintf(f, "S"); /* Supervisor */
+            qemu_printf("S"); /* Supervisor */
         } else {
-            cpu_fprintf(f, ".");
+            qemu_printf(".");
         }
         if (env->mmu.mmusr & M68K_MMU_M_040) {
-            cpu_fprintf(f, "M"); /* Modified */
+            qemu_printf("M"); /* Modified */
         } else {
-            cpu_fprintf(f, ".");
+            qemu_printf(".");
         }
         if (env->mmu.mmusr & M68K_MMU_WP_040) {
-            cpu_fprintf(f, "W"); /* Write protect */
+            qemu_printf("W"); /* Write protect */
         } else {
-            cpu_fprintf(f, ".");
+            qemu_printf(".");
         }
         if (env->mmu.mmusr & M68K_MMU_T_040) {
-            cpu_fprintf(f, "T"); /* Transparent */
+            qemu_printf("T"); /* Transparent */
         } else {
-            cpu_fprintf(f, ".");
+            qemu_printf(".");
         }
         if (env->mmu.mmusr & M68K_MMU_R_040) {
-            cpu_fprintf(f, "R"); /* Resident */
+            qemu_printf("R"); /* Resident */
         } else {
-            cpu_fprintf(f, ".");
+            qemu_printf(".");
         }
-        cpu_fprintf(f, " Cache: ");
+        qemu_printf(" Cache: ");
         DUMP_CACHEFLAGS(env->mmu.mmusr);
-        cpu_fprintf(f, " U: %d\n", (env->mmu.mmusr >> 8) & 3);
-        cpu_fprintf(f, "\n");
+        qemu_printf(" U: %d\n", (env->mmu.mmusr >> 8) & 3);
+        qemu_printf("\n");
     }
 
-    cpu_fprintf(f, "ITTR0: ");
-    dump_ttr(f, cpu_fprintf, env->mmu.ttr[M68K_ITTR0]);
-    cpu_fprintf(f, "ITTR1: ");
-    dump_ttr(f, cpu_fprintf, env->mmu.ttr[M68K_ITTR1]);
-    cpu_fprintf(f, "DTTR0: ");
-    dump_ttr(f, cpu_fprintf, env->mmu.ttr[M68K_DTTR0]);
-    cpu_fprintf(f, "DTTR1: ");
-    dump_ttr(f, cpu_fprintf, env->mmu.ttr[M68K_DTTR1]);
+    qemu_printf("ITTR0: ");
+    dump_ttr(env->mmu.ttr[M68K_ITTR0]);
+    qemu_printf("ITTR1: ");
+    dump_ttr(env->mmu.ttr[M68K_ITTR1]);
+    qemu_printf("DTTR0: ");
+    dump_ttr(env->mmu.ttr[M68K_DTTR0]);
+    qemu_printf("DTTR1: ");
+    dump_ttr(env->mmu.ttr[M68K_DTTR1]);
 
-    cpu_fprintf(f, "SRP: 0x%08x\n", env->mmu.srp);
-    dump_address_map(f, cpu_fprintf, env, env->mmu.srp);
+    qemu_printf("SRP: 0x%08x\n", env->mmu.srp);
+    dump_address_map(env, env->mmu.srp);
 
-    cpu_fprintf(f, "URP: 0x%08x\n", env->mmu.urp);
-    dump_address_map(f, cpu_fprintf, env, env->mmu.urp);
+    qemu_printf("URP: 0x%08x\n", env->mmu.urp);
+    dump_address_map(env, env->mmu.urp);
 }
 
 static int check_TTR(uint32_t ttr, int *prot, target_ulong addr,
diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c
index db582a34ac..2055fe8a00 100644
--- a/target/m68k/monitor.c
+++ b/target/m68k/monitor.c
@@ -19,7 +19,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         return;
     }
 
-    dump_mmu((FILE *)mon, (fprintf_function)monitor_printf, env1);
+    dump_mmu(env1);
 }
 
 static const MonitorDef monitor_defs[] = {
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
index 047f3764b7..6fa993bb0d 100644
--- a/target/nios2/cpu.h
+++ b/target/nios2/cpu.h
@@ -212,7 +212,7 @@ static inline Nios2CPU *nios2_env_get_cpu(CPUNios2State *env)
 void nios2_tcg_init(void);
 void nios2_cpu_do_interrupt(CPUState *cs);
 int cpu_nios2_signal_handler(int host_signum, void *pinfo, void *puc);
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUNios2State *env);
+void dump_mmu(CPUNios2State *env);
 void nios2_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
                           int flags);
 hwaddr nios2_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
diff --git a/target/nios2/mmu.c b/target/nios2/mmu.c
index 69b71cba4a..5acf442d8b 100644
--- a/target/nios2/mmu.c
+++ b/target/nios2/mmu.c
@@ -20,6 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "qemu/qemu-print.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "mmu.h"
@@ -264,18 +265,18 @@ void mmu_init(CPUNios2State *env)
     mmu->tlb = g_new0(Nios2TLBEntry, cpu->tlb_num_entries);
 }
 
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUNios2State *env)
+void dump_mmu(CPUNios2State *env)
 {
     Nios2CPU *cpu = nios2_env_get_cpu(env);
     int i;
 
-    cpu_fprintf(f, "MMU: ways %d, entries %d, pid bits %d\n",
+    qemu_printf("MMU: ways %d, entries %d, pid bits %d\n",
                 cpu->tlb_num_ways, cpu->tlb_num_entries,
                 cpu->pid_num_bits);
 
     for (i = 0; i < cpu->tlb_num_entries; i++) {
         Nios2TLBEntry *entry = &env->mmu.tlb[i];
-        cpu_fprintf(f, "TLB[%d] = %08X %08X %c VPN %05X "
+        qemu_printf("TLB[%d] = %08X %08X %c VPN %05X "
                     "PID %02X %c PFN %05X %c%c%c%c\n",
                     i, entry->tag, entry->data,
                     (entry->tag & (1 << 10)) ? 'V' : '-',
diff --git a/target/nios2/monitor.c b/target/nios2/monitor.c
index 422c81656a..d5e3393716 100644
--- a/target/nios2/monitor.c
+++ b/target/nios2/monitor.c
@@ -31,5 +31,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
 {
     CPUArchState *env1 = mon_get_cpu_env();
 
-    dump_mmu((FILE *)mon, (fprintf_function)monitor_printf, env1);
+    dump_mmu(env1);
 }
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 382a323c61..8572241364 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -2629,7 +2629,7 @@ static inline ppc_avr_t *cpu_avr_ptr(CPUPPCState *env, int i)
     return (ppc_avr_t *)((uintptr_t)env + avr_full_offset(i));
 }
 
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env);
+void dump_mmu(CPUPPCState *env);
 
 void ppc_maybe_bswap_register(CPUPPCState *env, uint8_t *mem_buf, int len);
 #endif /* PPC_CPU_H */
diff --git a/target/ppc/mmu-hash64.c b/target/ppc/mmu-hash64.c
index a2b1ec5040..214149f65b 100644
--- a/target/ppc/mmu-hash64.c
+++ b/target/ppc/mmu-hash64.c
@@ -22,6 +22,7 @@
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
 #include "mmu-hash64.h"
@@ -71,7 +72,7 @@ static ppc_slb_t *slb_lookup(PowerPCCPU *cpu, target_ulong eaddr)
     return NULL;
 }
 
-void dump_slb(FILE *f, fprintf_function cpu_fprintf, PowerPCCPU *cpu)
+void dump_slb(PowerPCCPU *cpu)
 {
     CPUPPCState *env = &cpu->env;
     int i;
@@ -79,14 +80,14 @@ void dump_slb(FILE *f, fprintf_function cpu_fprintf, PowerPCCPU *cpu)
 
     cpu_synchronize_state(CPU(cpu));
 
-    cpu_fprintf(f, "SLB\tESID\t\t\tVSID\n");
+    qemu_printf("SLB\tESID\t\t\tVSID\n");
     for (i = 0; i < cpu->hash64_opts->slb_size; i++) {
         slbe = env->slb[i].esid;
         slbv = env->slb[i].vsid;
         if (slbe == 0 && slbv == 0) {
             continue;
         }
-        cpu_fprintf(f, "%d\t0x%016" PRIx64 "\t0x%016" PRIx64 "\n",
+        qemu_printf("%d\t0x%016" PRIx64 "\t0x%016" PRIx64 "\n",
                     i, slbe, slbv);
     }
 }
diff --git a/target/ppc/mmu-hash64.h b/target/ppc/mmu-hash64.h
index 6b555b7220..5be7ad86db 100644
--- a/target/ppc/mmu-hash64.h
+++ b/target/ppc/mmu-hash64.h
@@ -4,7 +4,7 @@
 #ifndef CONFIG_USER_ONLY
 
 #ifdef TARGET_PPC64
-void dump_slb(FILE *f, fprintf_function cpu_fprintf, PowerPCCPU *cpu);
+void dump_slb(PowerPCCPU *cpu);
 int ppc_store_slb(PowerPCCPU *cpu, target_ulong slot,
                   target_ulong esid, target_ulong vsid);
 hwaddr ppc_hash64_get_phys_page_debug(PowerPCCPU *cpu, target_ulong addr);
diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index 4a6be4d63b..ab72473eeb 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -29,6 +29,7 @@
 #include "exec/log.h"
 #include "helper_regs.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "mmu-book3s-v3.h"
 #include "mmu-radix64.h"
 
@@ -1116,19 +1117,18 @@ static const char *book3e_tsize_to_str[32] = {
     "1T", "2T"
 };
 
-static void mmubooke_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
-                                 CPUPPCState *env)
+static void mmubooke_dump_mmu(CPUPPCState *env)
 {
     ppcemb_tlb_t *entry;
     int i;
 
     if (kvm_enabled() && !env->kvm_sw_tlb) {
-        cpu_fprintf(f, "Cannot access KVM TLB\n");
+        qemu_printf("Cannot access KVM TLB\n");
         return;
     }
 
-    cpu_fprintf(f, "\nTLB:\n");
-    cpu_fprintf(f, "Effective          Physical           Size PID   Prot     "
+    qemu_printf("\nTLB:\n");
+    qemu_printf("Effective          Physical           Size PID   Prot     "
                 "Attr\n");
 
     entry = &env->tlb.tlbe[0];
@@ -1153,22 +1153,21 @@ static void mmubooke_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
         } else {
             snprintf(size_buf, sizeof(size_buf), "%3" PRId64 "k", size / KiB);
         }
-        cpu_fprintf(f, "0x%016" PRIx64 " 0x%016" PRIx64 " %s %-5u %08x %08x\n",
+        qemu_printf("0x%016" PRIx64 " 0x%016" PRIx64 " %s %-5u %08x %08x\n",
                     (uint64_t)ea, (uint64_t)pa, size_buf, (uint32_t)entry->PID,
                     entry->prot, entry->attr);
     }
 
 }
 
-static void mmubooke206_dump_one_tlb(FILE *f, fprintf_function cpu_fprintf,
-                                     CPUPPCState *env, int tlbn, int offset,
+static void mmubooke206_dump_one_tlb(CPUPPCState *env, int tlbn, int offset,
                                      int tlbsize)
 {
     ppcmas_tlb_t *entry;
     int i;
 
-    cpu_fprintf(f, "\nTLB%d:\n", tlbn);
-    cpu_fprintf(f, "Effective          Physical           Size TID   TS SRWX"
+    qemu_printf("\nTLB%d:\n", tlbn);
+    qemu_printf("Effective          Physical           Size TID   TS SRWX"
                 " URWX WIMGE U0123\n");
 
     entry = &env->tlb.tlbm[offset];
@@ -1185,7 +1184,7 @@ static void mmubooke206_dump_one_tlb(FILE *f, fprintf_function cpu_fprintf,
         ea = entry->mas2 & ~(size - 1);
         pa = entry->mas7_3 & ~(size - 1);
 
-        cpu_fprintf(f, "0x%016" PRIx64 " 0x%016" PRIx64 " %4s %-5u %1u  S%c%c%c"
+        qemu_printf("0x%016" PRIx64 " 0x%016" PRIx64 " %4s %-5u %1u  S%c%c%c"
                     "U%c%c%c %c%c%c%c%c U%c%c%c%c\n",
                     (uint64_t)ea, (uint64_t)pa,
                     book3e_tsize_to_str[tsize],
@@ -1209,14 +1208,13 @@ static void mmubooke206_dump_one_tlb(FILE *f, fprintf_function cpu_fprintf,
     }
 }
 
-static void mmubooke206_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
-                                 CPUPPCState *env)
+static void mmubooke206_dump_mmu(CPUPPCState *env)
 {
     int offset = 0;
     int i;
 
     if (kvm_enabled() && !env->kvm_sw_tlb) {
-        cpu_fprintf(f, "Cannot access KVM TLB\n");
+        qemu_printf("Cannot access KVM TLB\n");
         return;
     }
 
@@ -1227,13 +1225,12 @@ static void mmubooke206_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
             continue;
         }
 
-        mmubooke206_dump_one_tlb(f, cpu_fprintf, env, i, offset, size);
+        mmubooke206_dump_one_tlb(env, i, offset, size);
         offset += size;
     }
 }
 
-static void mmu6xx_dump_BATs(FILE *f, fprintf_function cpu_fprintf,
-                             CPUPPCState *env, int type)
+static void mmu6xx_dump_BATs(CPUPPCState *env, int type)
 {
     target_ulong *BATlt, *BATut, *BATu, *BATl;
     target_ulong BEPIl, BEPIu, bl;
@@ -1256,7 +1253,7 @@ static void mmu6xx_dump_BATs(FILE *f, fprintf_function cpu_fprintf,
         BEPIu = *BATu & 0xF0000000;
         BEPIl = *BATu & 0x0FFE0000;
         bl = (*BATu & 0x00001FFC) << 15;
-        cpu_fprintf(f, "%s BAT%d BATu " TARGET_FMT_lx
+        qemu_printf("%s BAT%d BATu " TARGET_FMT_lx
                     " BATl " TARGET_FMT_lx "\n\t" TARGET_FMT_lx " "
                     TARGET_FMT_lx " " TARGET_FMT_lx "\n",
                     type == ACCESS_CODE ? "code" : "data", i,
@@ -1264,44 +1261,43 @@ static void mmu6xx_dump_BATs(FILE *f, fprintf_function cpu_fprintf,
     }
 }
 
-static void mmu6xx_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
-                            CPUPPCState *env)
+static void mmu6xx_dump_mmu(CPUPPCState *env)
 {
     PowerPCCPU *cpu = ppc_env_get_cpu(env);
     ppc6xx_tlb_t *tlb;
     target_ulong sr;
     int type, way, entry, i;
 
-    cpu_fprintf(f, "HTAB base = 0x%"HWADDR_PRIx"\n", ppc_hash32_hpt_base(cpu));
-    cpu_fprintf(f, "HTAB mask = 0x%"HWADDR_PRIx"\n", ppc_hash32_hpt_mask(cpu));
+    qemu_printf("HTAB base = 0x%"HWADDR_PRIx"\n", ppc_hash32_hpt_base(cpu));
+    qemu_printf("HTAB mask = 0x%"HWADDR_PRIx"\n", ppc_hash32_hpt_mask(cpu));
 
-    cpu_fprintf(f, "\nSegment registers:\n");
+    qemu_printf("\nSegment registers:\n");
     for (i = 0; i < 32; i++) {
         sr = env->sr[i];
         if (sr & 0x80000000) {
-            cpu_fprintf(f, "%02d T=%d Ks=%d Kp=%d BUID=0x%03x "
+            qemu_printf("%02d T=%d Ks=%d Kp=%d BUID=0x%03x "
                         "CNTLR_SPEC=0x%05x\n", i,
                         sr & 0x80000000 ? 1 : 0, sr & 0x40000000 ? 1 : 0,
                         sr & 0x20000000 ? 1 : 0, (uint32_t)((sr >> 20) & 0x1FF),
                         (uint32_t)(sr & 0xFFFFF));
         } else {
-            cpu_fprintf(f, "%02d T=%d Ks=%d Kp=%d N=%d VSID=0x%06x\n", i,
+            qemu_printf("%02d T=%d Ks=%d Kp=%d N=%d VSID=0x%06x\n", i,
                         sr & 0x80000000 ? 1 : 0, sr & 0x40000000 ? 1 : 0,
                         sr & 0x20000000 ? 1 : 0, sr & 0x10000000 ? 1 : 0,
                         (uint32_t)(sr & 0x00FFFFFF));
         }
     }
 
-    cpu_fprintf(f, "\nBATs:\n");
-    mmu6xx_dump_BATs(f, cpu_fprintf, env, ACCESS_INT);
-    mmu6xx_dump_BATs(f, cpu_fprintf, env, ACCESS_CODE);
+    qemu_printf("\nBATs:\n");
+    mmu6xx_dump_BATs(env, ACCESS_INT);
+    mmu6xx_dump_BATs(env, ACCESS_CODE);
 
     if (env->id_tlbs != 1) {
-        cpu_fprintf(f, "ERROR: 6xx MMU should have separated TLB"
+        qemu_printf("ERROR: 6xx MMU should have separated TLB"
                     " for code and data\n");
     }
 
-    cpu_fprintf(f, "\nTLBs                       [EPN    EPN + SIZE]\n");
+    qemu_printf("\nTLBs                       [EPN    EPN + SIZE]\n");
 
     for (type = 0; type < 2; type++) {
         for (way = 0; way < env->nb_ways; way++) {
@@ -1310,7 +1306,7 @@ static void mmu6xx_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
                  entry++) {
 
                 tlb = &env->tlb.tlb6[entry];
-                cpu_fprintf(f, "%s TLB %02d/%02d way:%d %s ["
+                qemu_printf("%s TLB %02d/%02d way:%d %s ["
                             TARGET_FMT_lx " " TARGET_FMT_lx "]\n",
                             type ? "code" : "data", entry % env->nb_tlb,
                             env->nb_tlb, way,
@@ -1321,31 +1317,31 @@ static void mmu6xx_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
     }
 }
 
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env)
+void dump_mmu(CPUPPCState *env)
 {
     switch (env->mmu_model) {
     case POWERPC_MMU_BOOKE:
-        mmubooke_dump_mmu(f, cpu_fprintf, env);
+        mmubooke_dump_mmu(env);
         break;
     case POWERPC_MMU_BOOKE206:
-        mmubooke206_dump_mmu(f, cpu_fprintf, env);
+        mmubooke206_dump_mmu(env);
         break;
     case POWERPC_MMU_SOFT_6xx:
     case POWERPC_MMU_SOFT_74xx:
-        mmu6xx_dump_mmu(f, cpu_fprintf, env);
+        mmu6xx_dump_mmu(env);
         break;
 #if defined(TARGET_PPC64)
     case POWERPC_MMU_64B:
     case POWERPC_MMU_2_03:
     case POWERPC_MMU_2_06:
     case POWERPC_MMU_2_07:
-        dump_slb(f, cpu_fprintf, ppc_env_get_cpu(env));
+        dump_slb(ppc_env_get_cpu(env));
         break;
     case POWERPC_MMU_3_00:
         if (ppc64_v3_radix(ppc_env_get_cpu(env))) {
             /* TODO - Unsupported */
         } else {
-            dump_slb(f, cpu_fprintf, ppc_env_get_cpu(env));
+            dump_slb(ppc_env_get_cpu(env));
             break;
         }
 #endif
diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c
index 04deec8030..42e58163fc 100644
--- a/target/ppc/monitor.c
+++ b/target/ppc/monitor.c
@@ -66,7 +66,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
+    dump_mmu(env1);
 }
 
 const MonitorDef monitor_defs[] = {
diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h
index ab9fa3ddbf..b298bd9c29 100644
--- a/target/sparc/cpu.h
+++ b/target/sparc/cpu.h
@@ -583,7 +583,7 @@ void sparc_cpu_list(void);
 int sparc_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int rw,
                                int mmu_idx);
 target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev);
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUSPARCState *env);
+void dump_mmu(CPUSPARCState *env);
 
 #if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
 int sparc_cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index 5bc090213c..a7fcb84ac0 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -198,7 +198,7 @@ static void demap_tlb(SparcTLBEntry *tlb, target_ulong demap_addr,
             replace_tlb_entry(&tlb[i], 0, 0, env1);
 #ifdef DEBUG_MMU
             DPRINTF_MMU("%s demap invalidated entry [%02u]\n", strmmu, i);
-            dump_mmu(stdout, fprintf, env1);
+            dump_mmu(env1);
 #endif
         }
     }
@@ -260,7 +260,7 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,
             replace_tlb_entry(&tlb[i], tlb_tag, tlb_tte, env1);
 #ifdef DEBUG_MMU
             DPRINTF_MMU("%s lru replaced invalid entry [%i]\n", strmmu, i);
-            dump_mmu(stdout, fprintf, env1);
+            dump_mmu(env1);
 #endif
             return;
         }
@@ -279,7 +279,7 @@ static void replace_tlb_1bit_lru(SparcTLBEntry *tlb,
 #ifdef DEBUG_MMU
                 DPRINTF_MMU("%s lru replaced unlocked %s entry [%i]\n",
                             strmmu, (replace_used ? "used" : "unused"), i);
-                dump_mmu(stdout, fprintf, env1);
+                dump_mmu(env1);
 #endif
                 return;
             }
@@ -886,7 +886,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val,
                 break;
             }
 #ifdef DEBUG_MMU
-            dump_mmu(stdout, fprintf, env);
+            dump_mmu(env);
 #endif
         }
         break;
@@ -941,7 +941,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, uint64_t val,
                             reg, oldreg, env->mmuregs[reg]);
             }
 #ifdef DEBUG_MMU
-            dump_mmu(stdout, fprintf, env);
+            dump_mmu(env);
 #endif
         }
         break;
@@ -1634,7 +1634,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
                             PRIx64 "\n", reg, oldreg, env->immuregs[reg]);
             }
 #ifdef DEBUG_MMU
-            dump_mmu(stdout, fprintf, env);
+            dump_mmu(env);
 #endif
             return;
         }
@@ -1658,7 +1658,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
             }
 #ifdef DEBUG_MMU
             DPRINTF_MMU("immu data access replaced entry [%i]\n", i);
-            dump_mmu(stdout, fprintf, env);
+            dump_mmu(env);
 #endif
             return;
         }
@@ -1718,7 +1718,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
                             PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]);
             }
 #ifdef DEBUG_MMU
-            dump_mmu(stdout, fprintf, env);
+            dump_mmu(env);
 #endif
             return;
         }
@@ -1740,7 +1740,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong addr, target_ulong val,
             }
 #ifdef DEBUG_MMU
             DPRINTF_MMU("dmmu data access replaced entry [%i]\n", i);
-            dump_mmu(stdout, fprintf, env);
+            dump_mmu(env);
 #endif
             return;
         }
diff --git a/target/sparc/mmu_helper.c b/target/sparc/mmu_helper.c
index 135a9c9d9b..afcc5b617d 100644
--- a/target/sparc/mmu_helper.c
+++ b/target/sparc/mmu_helper.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
+#include "qemu/qemu-print.h"
 #include "trace.h"
 
 /* Sparc MMU emulation */
@@ -320,7 +321,7 @@ target_ulong mmu_probe(CPUSPARCState *env, target_ulong address, int mmulev)
     return 0;
 }
 
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUSPARCState *env)
+void dump_mmu(CPUSPARCState *env)
 {
     CPUState *cs = CPU(sparc_env_get_cpu(env));
     target_ulong va, va1, va2;
@@ -330,29 +331,29 @@ void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUSPARCState *env)
 
     pde_ptr = (env->mmuregs[1] << 4) + (env->mmuregs[2] << 2);
     pde = ldl_phys(cs->as, pde_ptr);
-    (*cpu_fprintf)(f, "Root ptr: " TARGET_FMT_plx ", ctx: %d\n",
-                   (hwaddr)env->mmuregs[1] << 4, env->mmuregs[2]);
+    qemu_printf("Root ptr: " TARGET_FMT_plx ", ctx: %d\n",
+                (hwaddr)env->mmuregs[1] << 4, env->mmuregs[2]);
     for (n = 0, va = 0; n < 256; n++, va += 16 * 1024 * 1024) {
         pde = mmu_probe(env, va, 2);
         if (pde) {
             pa = cpu_get_phys_page_debug(cs, va);
-            (*cpu_fprintf)(f, "VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_plx
-                           " PDE: " TARGET_FMT_lx "\n", va, pa, pde);
+            qemu_printf("VA: " TARGET_FMT_lx ", PA: " TARGET_FMT_plx
+                        " PDE: " TARGET_FMT_lx "\n", va, pa, pde);
             for (m = 0, va1 = va; m < 64; m++, va1 += 256 * 1024) {
                 pde = mmu_probe(env, va1, 1);
                 if (pde) {
                     pa = cpu_get_phys_page_debug(cs, va1);
-                    (*cpu_fprintf)(f, " VA: " TARGET_FMT_lx ", PA: "
-                                   TARGET_FMT_plx " PDE: " TARGET_FMT_lx "\n",
-                                   va1, pa, pde);
+                    qemu_printf(" VA: " TARGET_FMT_lx ", PA: "
+                                TARGET_FMT_plx " PDE: " TARGET_FMT_lx "\n",
+                                va1, pa, pde);
                     for (o = 0, va2 = va1; o < 64; o++, va2 += 4 * 1024) {
                         pde = mmu_probe(env, va2, 0);
                         if (pde) {
                             pa = cpu_get_phys_page_debug(cs, va2);
-                            (*cpu_fprintf)(f, "  VA: " TARGET_FMT_lx ", PA: "
-                                           TARGET_FMT_plx " PTE: "
-                                           TARGET_FMT_lx "\n",
-                                           va2, pa, pde);
+                            qemu_printf("  VA: " TARGET_FMT_lx ", PA: "
+                                        TARGET_FMT_plx " PTE: "
+                                        TARGET_FMT_lx "\n",
+                                        va2, pa, pde);
                         }
                     }
                 }
@@ -739,21 +740,21 @@ int sparc_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw,
     return 1;
 }
 
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUSPARCState *env)
+void dump_mmu(CPUSPARCState *env)
 {
     unsigned int i;
     const char *mask;
 
-    (*cpu_fprintf)(f, "MMU contexts: Primary: %" PRId64 ", Secondary: %"
-                   PRId64 "\n",
-                   env->dmmu.mmu_primary_context,
-                   env->dmmu.mmu_secondary_context);
-    (*cpu_fprintf)(f, "DMMU Tag Access: %" PRIx64 ", TSB Tag Target: %" PRIx64
-                   "\n", env->dmmu.tag_access, env->dmmu.tsb_tag_target);
+    qemu_printf("MMU contexts: Primary: %" PRId64 ", Secondary: %"
+                PRId64 "\n",
+                env->dmmu.mmu_primary_context,
+                env->dmmu.mmu_secondary_context);
+    qemu_printf("DMMU Tag Access: %" PRIx64 ", TSB Tag Target: %" PRIx64
+                "\n", env->dmmu.tag_access, env->dmmu.tsb_tag_target);
     if ((env->lsu & DMMU_E) == 0) {
-        (*cpu_fprintf)(f, "DMMU disabled\n");
+        qemu_printf("DMMU disabled\n");
     } else {
-        (*cpu_fprintf)(f, "DMMU dump\n");
+        qemu_printf("DMMU dump\n");
         for (i = 0; i < 64; i++) {
             switch (TTE_PGSIZE(env->dtlb[i].tte)) {
             default:
@@ -771,26 +772,26 @@ void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUSPARCState *env)
                 break;
             }
             if (TTE_IS_VALID(env->dtlb[i].tte)) {
-                (*cpu_fprintf)(f, "[%02u] VA: %" PRIx64 ", PA: %llx"
-                               ", %s, %s, %s, %s, ctx %" PRId64 " %s\n",
-                               i,
-                               env->dtlb[i].tag & (uint64_t)~0x1fffULL,
-                               TTE_PA(env->dtlb[i].tte),
-                               mask,
-                               TTE_IS_PRIV(env->dtlb[i].tte) ? "priv" : "user",
-                               TTE_IS_W_OK(env->dtlb[i].tte) ? "RW" : "RO",
-                               TTE_IS_LOCKED(env->dtlb[i].tte) ?
-                               "locked" : "unlocked",
-                               env->dtlb[i].tag & (uint64_t)0x1fffULL,
-                               TTE_IS_GLOBAL(env->dtlb[i].tte) ?
-                               "global" : "local");
+                qemu_printf("[%02u] VA: %" PRIx64 ", PA: %llx"
+                            ", %s, %s, %s, %s, ctx %" PRId64 " %s\n",
+                            i,
+                            env->dtlb[i].tag & (uint64_t)~0x1fffULL,
+                            TTE_PA(env->dtlb[i].tte),
+                            mask,
+                            TTE_IS_PRIV(env->dtlb[i].tte) ? "priv" : "user",
+                            TTE_IS_W_OK(env->dtlb[i].tte) ? "RW" : "RO",
+                            TTE_IS_LOCKED(env->dtlb[i].tte) ?
+                            "locked" : "unlocked",
+                            env->dtlb[i].tag & (uint64_t)0x1fffULL,
+                            TTE_IS_GLOBAL(env->dtlb[i].tte) ?
+                            "global" : "local");
             }
         }
     }
     if ((env->lsu & IMMU_E) == 0) {
-        (*cpu_fprintf)(f, "IMMU disabled\n");
+        qemu_printf("IMMU disabled\n");
     } else {
-        (*cpu_fprintf)(f, "IMMU dump\n");
+        qemu_printf("IMMU dump\n");
         for (i = 0; i < 64; i++) {
             switch (TTE_PGSIZE(env->itlb[i].tte)) {
             default:
@@ -808,18 +809,18 @@ void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUSPARCState *env)
                 break;
             }
             if (TTE_IS_VALID(env->itlb[i].tte)) {
-                (*cpu_fprintf)(f, "[%02u] VA: %" PRIx64 ", PA: %llx"
-                               ", %s, %s, %s, ctx %" PRId64 " %s\n",
-                               i,
-                               env->itlb[i].tag & (uint64_t)~0x1fffULL,
-                               TTE_PA(env->itlb[i].tte),
-                               mask,
-                               TTE_IS_PRIV(env->itlb[i].tte) ? "priv" : "user",
-                               TTE_IS_LOCKED(env->itlb[i].tte) ?
-                               "locked" : "unlocked",
-                               env->itlb[i].tag & (uint64_t)0x1fffULL,
-                               TTE_IS_GLOBAL(env->itlb[i].tte) ?
-                               "global" : "local");
+                qemu_printf("[%02u] VA: %" PRIx64 ", PA: %llx"
+                            ", %s, %s, %s, ctx %" PRId64 " %s\n",
+                            i,
+                            env->itlb[i].tag & (uint64_t)~0x1fffULL,
+                            TTE_PA(env->itlb[i].tte),
+                            mask,
+                            TTE_IS_PRIV(env->itlb[i].tte) ? "priv" : "user",
+                            TTE_IS_LOCKED(env->itlb[i].tte) ?
+                            "locked" : "unlocked",
+                            env->itlb[i].tag & (uint64_t)0x1fffULL,
+                            TTE_IS_GLOBAL(env->itlb[i].tte) ?
+                            "global" : "local");
             }
         }
     }
diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
index f3ca524ae9..3ec3b51a3d 100644
--- a/target/sparc/monitor.c
+++ b/target/sparc/monitor.c
@@ -36,7 +36,7 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
+    dump_mmu(env1);
 }
 
 #ifndef TARGET_SPARC64
diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h
index 4aaf1f7bb2..86f6d6d72c 100644
--- a/target/xtensa/cpu.h
+++ b/target/xtensa/cpu.h
@@ -673,7 +673,7 @@ int xtensa_get_physical_addr(CPUXtensaState *env, bool update_tlb,
         uint32_t vaddr, int is_write, int mmu_idx,
         uint32_t *paddr, uint32_t *page_size, unsigned *access);
 void reset_mmu(CPUXtensaState *env);
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUXtensaState *env);
+void dump_mmu(CPUXtensaState *env);
 
 static inline MemoryRegion *xtensa_get_er_region(CPUXtensaState *env)
 {
diff --git a/target/xtensa/mmu_helper.c b/target/xtensa/mmu_helper.c
index 2096fbbd9f..79a10da231 100644
--- a/target/xtensa/mmu_helper.c
+++ b/target/xtensa/mmu_helper.c
@@ -27,6 +27,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/main-loop.h"
+#include "qemu/qemu-print.h"
 #include "qemu/units.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
@@ -740,8 +741,7 @@ int xtensa_get_physical_addr(CPUXtensaState *env, bool update_tlb,
     }
 }
 
-static void dump_tlb(FILE *f, fprintf_function cpu_fprintf,
-                     CPUXtensaState *env, bool dtlb)
+static void dump_tlb(CPUXtensaState *env, bool dtlb)
 {
     unsigned wi, ei;
     const xtensa_tlb *conf =
@@ -780,13 +780,11 @@ static void dump_tlb(FILE *f, fprintf_function cpu_fprintf,
 
                 if (print_header) {
                     print_header = false;
-                    cpu_fprintf(f, "Way %u (%d %s)\n", wi, sz, sz_text);
-                    cpu_fprintf(f,
-                                "\tVaddr       Paddr       ASID  Attr RWX Cache\n"
+                    qemu_printf("Way %u (%d %s)\n", wi, sz, sz_text);
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"
                                 "\t----------  ----------  ----  ---- --- -------\n");
                 }
-                cpu_fprintf(f,
-                            "\t0x%08x  0x%08x  0x%02x  0x%02x %c%c%c %-7s\n",
+                qemu_printf("\t0x%08x  0x%08x  0x%02x  0x%02x %c%c%c %-7s\n",
                             entry->vaddr,
                             entry->paddr,
                             entry->asid,
@@ -801,18 +799,18 @@ static void dump_tlb(FILE *f, fprintf_function cpu_fprintf,
     }
 }
 
-void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUXtensaState *env)
+void dump_mmu(CPUXtensaState *env)
 {
     if (xtensa_option_bits_enabled(env->config,
                 XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_PROTECTION) |
                 XTENSA_OPTION_BIT(XTENSA_OPTION_REGION_TRANSLATION) |
                 XTENSA_OPTION_BIT(XTENSA_OPTION_MMU))) {
 
-        cpu_fprintf(f, "ITLB:\n");
-        dump_tlb(f, cpu_fprintf, env, false);
-        cpu_fprintf(f, "\nDTLB:\n");
-        dump_tlb(f, cpu_fprintf, env, true);
+        qemu_printf("ITLB:\n");
+        dump_tlb(env, false);
+        qemu_printf("\nDTLB:\n");
+        dump_tlb(env, true);
     } else {
-        cpu_fprintf(f, "No TLB for this CPU core\n");
+        qemu_printf("No TLB for this CPU core\n");
     }
 }
diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c
index 2ee2b5b23e..cf7957bb63 100644
--- a/target/xtensa/monitor.c
+++ b/target/xtensa/monitor.c
@@ -35,5 +35,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
+    dump_mmu(env1);
 }
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 11/17] target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (9 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 10/17] target: Clean up how the dump_mmu() print Markus Armbruster
@ 2019-04-17 19:17 ` Markus Armbruster
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 12/17] qom/cpu: Simplify how CPUClass::dump_statistics() prints Markus Armbruster
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

x86_cpu_dump_local_apic_state() takes an fprintf()-like callback and a
FILE * to pass to it, and so do its helper functions.

Its only caller hmp_info_local_apic() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 target/i386/cpu.h     |  3 +-
 target/i386/helper.c  | 79 ++++++++++++++++++++-----------------------
 target/i386/monitor.c |  3 +-
 3 files changed, 39 insertions(+), 46 deletions(-)

diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index b39327dcb7..139fe30960 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1924,8 +1924,7 @@ void enable_compat_apic_id_mode(void);
 #define APIC_DEFAULT_ADDRESS 0xfee00000
 #define APIC_SPACE_SIZE      0x100000
 
-void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
-                                   fprintf_function cpu_fprintf, int flags);
+void x86_cpu_dump_local_apic_state(CPUState *cs, int flags);
 
 /* cpu.c */
 bool cpu_is_bsp(X86CPU *cpu);
diff --git a/target/i386/helper.c b/target/i386/helper.c
index e695f8ba7a..565391a9f6 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
+#include "qemu/qemu-print.h"
 #include "sysemu/kvm.h"
 #include "kvm_i386.h"
 #ifndef CONFIG_USER_ONLY
@@ -231,12 +232,10 @@ static inline const char *dm2str(uint32_t dm)
     return str[dm];
 }
 
-static void dump_apic_lvt(FILE *f, fprintf_function cpu_fprintf,
-                          const char *name, uint32_t lvt, bool is_timer)
+static void dump_apic_lvt(const char *name, uint32_t lvt, bool is_timer)
 {
     uint32_t dm = (lvt & APIC_LVT_DELIV_MOD) >> APIC_LVT_DELIV_MOD_SHIFT;
-    cpu_fprintf(f,
-                "%s\t 0x%08x %s %-5s %-6s %-7s %-12s %-6s",
+    qemu_printf("%s\t 0x%08x %s %-5s %-6s %-7s %-12s %-6s",
                 name, lvt,
                 lvt & APIC_LVT_INT_POLARITY ? "active-lo" : "active-hi",
                 lvt & APIC_LVT_LEVEL_TRIGGER ? "level" : "edge",
@@ -248,9 +247,9 @@ static void dump_apic_lvt(FILE *f, fprintf_function cpu_fprintf,
                                             "tsc-deadline" : "one-shot",
                 dm2str(dm));
     if (dm != APIC_DM_NMI) {
-        cpu_fprintf(f, " (vec %u)\n", lvt & APIC_VECTOR_MASK);
+        qemu_printf(" (vec %u)\n", lvt & APIC_VECTOR_MASK);
     } else {
-        cpu_fprintf(f, "\n");
+        qemu_printf("\n");
     }
 }
 
@@ -282,8 +281,7 @@ static inline void mask2str(char *str, uint32_t val, uint8_t size)
 
 #define MAX_LOGICAL_APIC_ID_MASK_SIZE 16
 
-static void dump_apic_icr(FILE *f, fprintf_function cpu_fprintf,
-                          APICCommonState *s, CPUX86State *env)
+static void dump_apic_icr(APICCommonState *s, CPUX86State *env)
 {
     uint32_t icr = s->icr[0], icr2 = s->icr[1];
     uint8_t dest_shorthand = \
@@ -293,16 +291,16 @@ static void dump_apic_icr(FILE *f, fprintf_function cpu_fprintf,
     uint32_t dest_field;
     bool x2apic;
 
-    cpu_fprintf(f, "ICR\t 0x%08x %s %s %s %s\n",
+    qemu_printf("ICR\t 0x%08x %s %s %s %s\n",
                 icr,
                 logical_mod ? "logical" : "physical",
                 icr & APIC_ICR_TRIGGER_MOD ? "level" : "edge",
                 icr & APIC_ICR_LEVEL ? "assert" : "de-assert",
                 shorthand2str(dest_shorthand));
 
-    cpu_fprintf(f, "ICR2\t 0x%08x", icr2);
+    qemu_printf("ICR2\t 0x%08x", icr2);
     if (dest_shorthand != 0) {
-        cpu_fprintf(f, "\n");
+        qemu_printf("\n");
         return;
     }
     x2apic = env->features[FEAT_1_ECX] & CPUID_EXT_X2APIC;
@@ -310,9 +308,9 @@ static void dump_apic_icr(FILE *f, fprintf_function cpu_fprintf,
 
     if (!logical_mod) {
         if (x2apic) {
-            cpu_fprintf(f, " cpu %u (X2APIC ID)\n", dest_field);
+            qemu_printf(" cpu %u (X2APIC ID)\n", dest_field);
         } else {
-            cpu_fprintf(f, " cpu %u (APIC ID)\n",
+            qemu_printf(" cpu %u (APIC ID)\n",
                         dest_field & APIC_LOGDEST_XAPIC_ID);
         }
         return;
@@ -320,87 +318,84 @@ static void dump_apic_icr(FILE *f, fprintf_function cpu_fprintf,
 
     if (s->dest_mode == 0xf) { /* flat mode */
         mask2str(apic_id_str, icr2 >> APIC_ICR_DEST_SHIFT, 8);
-        cpu_fprintf(f, " mask %s (APIC ID)\n", apic_id_str);
+        qemu_printf(" mask %s (APIC ID)\n", apic_id_str);
     } else if (s->dest_mode == 0) { /* cluster mode */
         if (x2apic) {
             mask2str(apic_id_str, dest_field & APIC_LOGDEST_X2APIC_ID, 16);
-            cpu_fprintf(f, " cluster %u mask %s (X2APIC ID)\n",
+            qemu_printf(" cluster %u mask %s (X2APIC ID)\n",
                         dest_field >> APIC_LOGDEST_X2APIC_SHIFT, apic_id_str);
         } else {
             mask2str(apic_id_str, dest_field & APIC_LOGDEST_XAPIC_ID, 4);
-            cpu_fprintf(f, " cluster %u mask %s (APIC ID)\n",
+            qemu_printf(" cluster %u mask %s (APIC ID)\n",
                         dest_field >> APIC_LOGDEST_XAPIC_SHIFT, apic_id_str);
         }
     }
 }
 
-static void dump_apic_interrupt(FILE *f, fprintf_function cpu_fprintf,
-                                const char *name, uint32_t *ireg_tab,
+static void dump_apic_interrupt(const char *name, uint32_t *ireg_tab,
                                 uint32_t *tmr_tab)
 {
     int i, empty = true;
 
-    cpu_fprintf(f, "%s\t ", name);
+    qemu_printf("%s\t ", name);
     for (i = 0; i < 256; i++) {
         if (apic_get_bit(ireg_tab, i)) {
-            cpu_fprintf(f, "%u%s ", i,
+            qemu_printf("%u%s ", i,
                         apic_get_bit(tmr_tab, i) ? "(level)" : "");
             empty = false;
         }
     }
-    cpu_fprintf(f, "%s\n", empty ? "(none)" : "");
+    qemu_printf("%s\n", empty ? "(none)" : "");
 }
 
-void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
-                                   fprintf_function cpu_fprintf, int flags)
+void x86_cpu_dump_local_apic_state(CPUState *cs, int flags)
 {
     X86CPU *cpu = X86_CPU(cs);
     APICCommonState *s = APIC_COMMON(cpu->apic_state);
     if (!s) {
-        cpu_fprintf(f, "local apic state not available\n");
+        qemu_printf("local apic state not available\n");
         return;
     }
     uint32_t *lvt = s->lvt;
 
-    cpu_fprintf(f, "dumping local APIC state for CPU %-2u\n\n",
+    qemu_printf("dumping local APIC state for CPU %-2u\n\n",
                 CPU(cpu)->cpu_index);
-    dump_apic_lvt(f, cpu_fprintf, "LVT0", lvt[APIC_LVT_LINT0], false);
-    dump_apic_lvt(f, cpu_fprintf, "LVT1", lvt[APIC_LVT_LINT1], false);
-    dump_apic_lvt(f, cpu_fprintf, "LVTPC", lvt[APIC_LVT_PERFORM], false);
-    dump_apic_lvt(f, cpu_fprintf, "LVTERR", lvt[APIC_LVT_ERROR], false);
-    dump_apic_lvt(f, cpu_fprintf, "LVTTHMR", lvt[APIC_LVT_THERMAL], false);
-    dump_apic_lvt(f, cpu_fprintf, "LVTT", lvt[APIC_LVT_TIMER], true);
+    dump_apic_lvt("LVT0", lvt[APIC_LVT_LINT0], false);
+    dump_apic_lvt("LVT1", lvt[APIC_LVT_LINT1], false);
+    dump_apic_lvt("LVTPC", lvt[APIC_LVT_PERFORM], false);
+    dump_apic_lvt("LVTERR", lvt[APIC_LVT_ERROR], false);
+    dump_apic_lvt("LVTTHMR", lvt[APIC_LVT_THERMAL], false);
+    dump_apic_lvt("LVTT", lvt[APIC_LVT_TIMER], true);
 
-    cpu_fprintf(f, "Timer\t DCR=0x%x (divide by %u) initial_count = %u\n",
+    qemu_printf("Timer\t DCR=0x%x (divide by %u) initial_count = %u\n",
                 s->divide_conf & APIC_DCR_MASK,
                 divider_conf(s->divide_conf),
                 s->initial_count);
 
-    cpu_fprintf(f, "SPIV\t 0x%08x APIC %s, focus=%s, spurious vec %u\n",
+    qemu_printf("SPIV\t 0x%08x APIC %s, focus=%s, spurious vec %u\n",
                 s->spurious_vec,
                 s->spurious_vec & APIC_SPURIO_ENABLED ? "enabled" : "disabled",
                 s->spurious_vec & APIC_SPURIO_FOCUS ? "on" : "off",
                 s->spurious_vec & APIC_VECTOR_MASK);
 
-    dump_apic_icr(f, cpu_fprintf, s, &cpu->env);
+    dump_apic_icr(s, &cpu->env);
 
-    cpu_fprintf(f, "ESR\t 0x%08x\n", s->esr);
+    qemu_printf("ESR\t 0x%08x\n", s->esr);
 
-    dump_apic_interrupt(f, cpu_fprintf, "ISR", s->isr, s->tmr);
-    dump_apic_interrupt(f, cpu_fprintf, "IRR", s->irr, s->tmr);
+    dump_apic_interrupt("ISR", s->isr, s->tmr);
+    dump_apic_interrupt("IRR", s->irr, s->tmr);
 
-    cpu_fprintf(f, "\nAPR 0x%02x TPR 0x%02x DFR 0x%02x LDR 0x%02x",
+    qemu_printf("\nAPR 0x%02x TPR 0x%02x DFR 0x%02x LDR 0x%02x",
                 s->arb_id, s->tpr, s->dest_mode, s->log_dest);
     if (s->dest_mode == 0) {
-        cpu_fprintf(f, "(cluster %u: id %u)",
+        qemu_printf("(cluster %u: id %u)",
                     s->log_dest >> APIC_LOGDEST_XAPIC_SHIFT,
                     s->log_dest & APIC_LOGDEST_XAPIC_ID);
     }
-    cpu_fprintf(f, " PPR 0x%02x\n", apic_get_ppr(s));
+    qemu_printf(" PPR 0x%02x\n", apic_get_ppr(s));
 }
 #else
-void x86_cpu_dump_local_apic_state(CPUState *cs, FILE *f,
-                                   fprintf_function cpu_fprintf, int flags)
+void x86_cpu_dump_local_apic_state(CPUState *cs, int flags)
 {
 }
 #endif /* !CONFIG_USER_ONLY */
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 74a13c571b..56e2dbece7 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -664,8 +664,7 @@ void hmp_info_local_apic(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    x86_cpu_dump_local_apic_state(cs, (FILE *)mon, monitor_fprintf,
-                                  CPU_DUMP_FPU);
+    x86_cpu_dump_local_apic_state(cs, CPU_DUMP_FPU);
 }
 
 void hmp_info_io_apic(Monitor *mon, const QDict *qdict)
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 12/17] qom/cpu: Simplify how CPUClass::dump_statistics() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (10 preceding siblings ...)
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 11/17] target/i386: Simplify how x86_cpu_dump_local_apic_state() prints Markus Armbruster
@ 2019-04-17 19:18 ` Markus Armbruster
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 13/17] qemu-print: New qemu_fprintf(), qemu_vfprintf() Markus Armbruster
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

CPUClass method dump_statistics() takes an fprintf()-like callback and
a FILE * to pass to it.

Its only caller hmp_info_cpustats() (via cpu_dump_statistics()) passes
monitor_fprintf() and the current monitor cast to FILE *.
monitor_fprintf() casts it right back, and is otherwise identical to
monitor_printf().  The type-punning is ugly.

Drop the callback, and call qemu_printf() instead.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/qom/cpu.h      | 11 ++++-------
 monitor.c              |  2 +-
 qom/cpu.c              |  5 ++---
 target/ppc/cpu.h       |  3 +--
 target/ppc/translate.c |  9 ++++-----
 5 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 1d6099e5d4..31bafee2b1 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -184,8 +184,7 @@ typedef struct CPUClass {
     void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
                        int flags);
     GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
-    void (*dump_statistics)(CPUState *cpu, FILE *f,
-                            fprintf_function cpu_fprintf, int flags);
+    void (*dump_statistics)(CPUState *cpu, int flags);
     int64_t (*get_arch_id)(CPUState *cpu);
     bool (*get_paging_enabled)(const CPUState *cpu);
     void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
@@ -576,14 +575,12 @@ void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
 /**
  * cpu_dump_statistics:
  * @cpu: The CPU whose state is to be dumped.
- * @f: File to dump to.
- * @cpu_fprintf: Function to dump with.
  * @flags: Flags what to dump.
  *
- * Dumps CPU statistics.
+ * Dump CPU statistics to the current monitor if we have one, else to
+ * stdout.
  */
-void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
+void cpu_dump_statistics(CPUState *cpu, int flags);
 
 #ifndef CONFIG_USER_ONLY
 /**
diff --git a/monitor.c b/monitor.c
index 0819b99ef7..fb5b681099 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1364,7 +1364,7 @@ static void hmp_info_cpustats(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "No CPU available\n");
         return;
     }
-    cpu_dump_statistics(cs, (FILE *)mon, &monitor_fprintf, 0);
+    cpu_dump_statistics(cs, 0);
 }
 
 static void hmp_info_trace_events(Monitor *mon, const QDict *qdict)
diff --git a/qom/cpu.c b/qom/cpu.c
index a8d2958956..029e7fe9b0 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -230,13 +230,12 @@ void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
     }
 }
 
-void cpu_dump_statistics(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags)
+void cpu_dump_statistics(CPUState *cpu, int flags)
 {
     CPUClass *cc = CPU_GET_CLASS(cpu);
 
     if (cc->dump_statistics) {
-        cc->dump_statistics(cpu, f, cpu_fprintf, flags);
+        cc->dump_statistics(cpu, flags);
     }
 }
 
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 8572241364..27a36b9605 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1270,8 +1270,7 @@ void ppc_cpu_do_interrupt(CPUState *cpu);
 bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
 void ppc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
                         int flags);
-void ppc_cpu_dump_statistics(CPUState *cpu, FILE *f,
-                             fprintf_function cpu_fprintf, int flags);
+void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
 hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int ppc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int ppc_cpu_gdb_read_register_apple(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index badc1ae1a3..f99f27a134 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -7593,8 +7593,7 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
 #undef RFPL
 }
 
-void ppc_cpu_dump_statistics(CPUState *cs, FILE*f,
-                             fprintf_function cpu_fprintf, int flags)
+void ppc_cpu_dump_statistics(CPUState *cs, int flags)
 {
 #if defined(DO_PPC_STATISTICS)
     PowerPCCPU *cpu = POWERPC_CPU(cs);
@@ -7614,7 +7613,7 @@ void ppc_cpu_dump_statistics(CPUState *cs, FILE*f,
                         handler = t3[op3];
                         if (handler->count == 0)
                             continue;
-                        cpu_fprintf(f, "%02x %02x %02x (%02x %04d) %16s: "
+                        qemu_printf("%02x %02x %02x (%02x %04d) %16s: "
                                     "%016" PRIx64 " %" PRId64 "\n",
                                     op1, op2, op3, op1, (op3 << 5) | op2,
                                     handler->oname,
@@ -7623,7 +7622,7 @@ void ppc_cpu_dump_statistics(CPUState *cs, FILE*f,
                 } else {
                     if (handler->count == 0)
                         continue;
-                    cpu_fprintf(f, "%02x %02x    (%02x %04d) %16s: "
+                    qemu_printf("%02x %02x    (%02x %04d) %16s: "
                                 "%016" PRIx64 " %" PRId64 "\n",
                                 op1, op2, op1, op2, handler->oname,
                                 handler->count, handler->count);
@@ -7632,7 +7631,7 @@ void ppc_cpu_dump_statistics(CPUState *cs, FILE*f,
         } else {
             if (handler->count == 0)
                 continue;
-            cpu_fprintf(f, "%02x       (%02x     ) %16s: %016" PRIx64
+            qemu_printf("%02x       (%02x     ) %16s: %016" PRIx64
                         " %" PRId64 "\n",
                         op1, op1, handler->oname,
                         handler->count, handler->count);
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 13/17] qemu-print: New qemu_fprintf(), qemu_vfprintf()
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (11 preceding siblings ...)
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 12/17] qom/cpu: Simplify how CPUClass::dump_statistics() prints Markus Armbruster
@ 2019-04-17 19:18 ` Markus Armbruster
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 14/17] qom/cpu: Simplify how CPUClass:cpu_dump_state() prints Markus Armbruster
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Code that doesn't want to know about current monitor vs. stdout
vs. stderr takes an fprintf_function callback and a FILE * argument to
pass to it.  Actual arguments are either fprintf() and stdout or
stderr, or monitor_fprintf() and the current monitor cast to FILE *.
monitor_fprintf() casts it right back, and is otherwise identical to
monitor_printf().  The type-punning is ugly.

New qemu_fprintf() and qemu_vprintf() address this need without type
punning: they are like fprintf() and vfprintf(), except they print to
the current monitor when passed a null FILE *.  The next commits will
put them to use.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/qemu/qemu-print.h |  4 ++++
 util/qemu-print.c         | 27 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/include/qemu/qemu-print.h b/include/qemu/qemu-print.h
index 8fed32bf42..40b596262f 100644
--- a/include/qemu/qemu-print.h
+++ b/include/qemu/qemu-print.h
@@ -16,4 +16,8 @@
 int qemu_vprintf(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
 int qemu_printf(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
 
+int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap)
+    GCC_FMT_ATTR(2, 0);
+int qemu_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
+
 #endif
diff --git a/util/qemu-print.c b/util/qemu-print.c
index 86f9417af8..e79d6b8396 100644
--- a/util/qemu-print.c
+++ b/util/qemu-print.c
@@ -40,3 +40,30 @@ int qemu_printf(const char *fmt, ...)
     va_end(ap);
     return ret;
 }
+
+/*
+ * Print like vfprintf()
+ * Print to @stream if non-null, else to current monitor.
+ */
+int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap)
+{
+    if (!stream) {
+        return monitor_vprintf(cur_mon, fmt, ap);
+    }
+    return vfprintf(stream, fmt, ap);
+}
+
+/*
+ * Print like fprintf().
+ * Print to @stream if non-null, else to current monitor.
+ */
+int qemu_fprintf(FILE *stream, const char *fmt, ...)
+{
+    va_list ap;
+    int ret;
+
+    va_start(ap, fmt);
+    ret = qemu_vfprintf(stream, fmt, ap);
+    va_end(ap);
+    return ret;
+}
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 14/17] qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (12 preceding siblings ...)
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 13/17] qemu-print: New qemu_fprintf(), qemu_vfprintf() Markus Armbruster
@ 2019-04-17 19:18 ` Markus Armbruster
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 15/17] monitor: Clean up how monitor_disas() funnels output to monitor Markus Armbruster
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

CPUClass method dump_statistics() takes an fprintf()-like callback and
a FILE * to pass to it.  Most callers pass fprintf() and stderr.
log_cpu_state() passes fprintf() and qemu_log_file.
hmp_info_registers() passes monitor_fprintf() and the current monitor
cast to FILE *.  monitor_fprintf() casts it right back, and is
otherwise identical to monitor_printf().

The callback gets passed around a lot, which is tiresome.  The
type-punning around monitor_fprintf() is ugly.

Drop the callback, and call qemu_fprintf() instead.  Also gets rid of
the type-punning, since qemu_fprintf() takes NULL instead of the
current monitor cast to FILE *.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 accel/kvm/kvm-all.c              |   4 +-
 bsd-user/main.c                  |   2 +-
 cpus.c                           |   2 +-
 exec.c                           |   2 +-
 include/exec/log.h               |   2 +-
 include/qom/cpu.h                |  11 +-
 linux-user/alpha/cpu_loop.c      |   2 +-
 linux-user/cpu_loop-common.h     |   2 +-
 linux-user/cris/cpu_loop.c       |   2 +-
 linux-user/microblaze/cpu_loop.c |   4 +-
 linux-user/s390x/cpu_loop.c      |   4 +-
 linux-user/sh4/cpu_loop.c        |   2 +-
 linux-user/sparc/cpu_loop.c      |   2 +-
 monitor.c                        |   4 +-
 qom/cpu.c                        |   6 +-
 target/alpha/cpu.h               |   3 +-
 target/alpha/helper.c            |  24 +--
 target/arm/arm-semi.c            |   2 +-
 target/arm/cpu.h                 |   3 +-
 target/arm/translate-a64.c       |  82 ++++-----
 target/arm/translate.c           |  58 +++----
 target/arm/translate.h           |   7 +-
 target/cris/cpu.h                |   3 +-
 target/cris/helper.c             |   2 +-
 target/cris/translate.c          |  36 ++--
 target/hppa/cpu.h                |   2 +-
 target/hppa/helper.c             |  24 +--
 target/i386/cpu.h                |   3 +-
 target/i386/hax-all.c            |   4 +-
 target/i386/helper.c             | 277 +++++++++++++++----------------
 target/lm32/cpu.h                |   3 +-
 target/lm32/translate.c          |  36 ++--
 target/m68k/cpu.h                |   3 +-
 target/m68k/translate.c          |  86 +++++-----
 target/microblaze/cpu.h          |   3 +-
 target/microblaze/helper.c       |   2 +-
 target/microblaze/translate.c    |  39 ++---
 target/mips/internal.h           |   3 +-
 target/mips/translate.c          |  76 ++++-----
 target/moxie/cpu.h               |   3 +-
 target/moxie/helper.c            |   2 +-
 target/moxie/translate.c         |  22 +--
 target/nios2/cpu.h               |   3 +-
 target/nios2/helper.c            |   2 +-
 target/nios2/translate.c         |  24 +--
 target/openrisc/cpu.h            |   3 +-
 target/openrisc/translate.c      |  11 +-
 target/ppc/cpu.h                 |   3 +-
 target/ppc/translate.c           | 161 +++++++++---------
 target/riscv/cpu.c               |  37 ++---
 target/s390x/helper.c            |  42 ++---
 target/s390x/internal.h          |   3 +-
 target/sh4/cpu.h                 |   3 +-
 target/sh4/translate.c           |  27 +--
 target/sparc/cpu.c               |  84 +++++-----
 target/sparc/cpu.h               |   3 +-
 target/tilegx/cpu.c              |  14 +-
 target/tricore/cpu.h             |   3 +-
 target/tricore/translate.c       |  26 +--
 target/unicore32/cpu.h           |   3 +-
 target/unicore32/translate.c     |  39 +++--
 target/xtensa/cpu.h              |   3 +-
 target/xtensa/translate.c        |  40 ++---
 63 files changed, 682 insertions(+), 711 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 241db496c3..524c4ddfbd 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -1798,7 +1798,7 @@ static int kvm_handle_internal_error(CPUState *cpu, struct kvm_run *run)
     if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION) {
         fprintf(stderr, "emulation failure\n");
         if (!kvm_arch_stop_on_emulation_error(cpu)) {
-            cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_CODE);
+            cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
             return EXCP_INTERRUPT;
         }
     }
@@ -2089,7 +2089,7 @@ int kvm_cpu_exec(CPUState *cpu)
     qemu_mutex_lock_iothread();
 
     if (ret < 0) {
-        cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_CODE);
+        cpu_dump_state(cpu, stderr, CPU_DUMP_CODE);
         vm_stop(RUN_STATE_INTERNAL_ERROR);
     }
 
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 7657c6851d..a8c807e8df 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -640,7 +640,7 @@ void cpu_loop(CPUSPARCState *env)
         badtrap:
 #endif
             printf ("Unhandled trap: 0x%x\n", trapnr);
-            cpu_dump_state(cs, stderr, fprintf, 0);
+            cpu_dump_state(cs, stderr, 0);
             exit (1);
         }
         process_pending_signals (env);
diff --git a/cpus.c b/cpus.c
index b4eecf70f0..e58e7ab0f6 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1010,7 +1010,7 @@ void hw_error(const char *fmt, ...)
     fprintf(stderr, "\n");
     CPU_FOREACH(cpu) {
         fprintf(stderr, "CPU #%d:\n", cpu->cpu_index);
-        cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_FPU);
+        cpu_dump_state(cpu, stderr, CPU_DUMP_FPU);
     }
     va_end(ap);
     abort();
diff --git a/exec.c b/exec.c
index 85d15606f1..2646207661 100644
--- a/exec.c
+++ b/exec.c
@@ -1256,7 +1256,7 @@ void cpu_abort(CPUState *cpu, const char *fmt, ...)
     fprintf(stderr, "qemu: fatal: ");
     vfprintf(stderr, fmt, ap);
     fprintf(stderr, "\n");
-    cpu_dump_state(cpu, stderr, fprintf, CPU_DUMP_FPU | CPU_DUMP_CCOP);
+    cpu_dump_state(cpu, stderr, CPU_DUMP_FPU | CPU_DUMP_CCOP);
     if (qemu_log_separate()) {
         qemu_log_lock();
         qemu_log("qemu: fatal: ");
diff --git a/include/exec/log.h b/include/exec/log.h
index c249307911..de067f173b 100644
--- a/include/exec/log.h
+++ b/include/exec/log.h
@@ -16,7 +16,7 @@
 static inline void log_cpu_state(CPUState *cpu, int flags)
 {
     if (qemu_log_enabled()) {
-        cpu_dump_state(cpu, qemu_logfile, fprintf, flags);
+        cpu_dump_state(cpu, qemu_logfile, flags);
     }
 }
 
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 31bafee2b1..9972e07786 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -26,7 +26,6 @@
 #include "exec/memattrs.h"
 #include "qapi/qapi-types-run-state.h"
 #include "qemu/bitmap.h"
-#include "qemu/fprintf-fn.h"
 #include "qemu/rcu_queue.h"
 #include "qemu/queue.h"
 #include "qemu/thread.h"
@@ -181,8 +180,7 @@ typedef struct CPUClass {
     bool (*virtio_is_big_endian)(CPUState *cpu);
     int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
                            uint8_t *buf, int len, bool is_write);
-    void (*dump_state)(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                       int flags);
+    void (*dump_state)(CPUState *cpu, FILE *, int flags);
     GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
     void (*dump_statistics)(CPUState *cpu, int flags);
     int64_t (*get_arch_id)(CPUState *cpu);
@@ -563,14 +561,11 @@ enum CPUDumpFlags {
 /**
  * cpu_dump_state:
  * @cpu: The CPU whose state is to be dumped.
- * @f: File to dump to.
- * @cpu_fprintf: Function to dump with.
- * @flags: Flags what to dump.
+ * @f: If non-null, dump to this stream, else to current print sink.
  *
  * Dumps CPU state.
  */
-void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                    int flags);
+void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 
 /**
  * cpu_dump_statistics:
diff --git a/linux-user/alpha/cpu_loop.c b/linux-user/alpha/cpu_loop.c
index 824b6d6658..61992571e1 100644
--- a/linux-user/alpha/cpu_loop.c
+++ b/linux-user/alpha/cpu_loop.c
@@ -193,7 +193,7 @@ void cpu_loop(CPUAlphaState *env)
             break;
         default:
             fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
-            cpu_dump_state(cs, stderr, fprintf, 0);
+            cpu_dump_state(cs, stderr, 0);
             exit(EXIT_FAILURE);
         }
         process_pending_signals (env);
diff --git a/linux-user/cpu_loop-common.h b/linux-user/cpu_loop-common.h
index ffe3fe9ad5..c1d554a249 100644
--- a/linux-user/cpu_loop-common.h
+++ b/linux-user/cpu_loop-common.h
@@ -26,7 +26,7 @@
 do {                                                                    \
     CPUState *cs = ENV_GET_CPU(env);                                    \
     fprintf(stderr, fmt , ## __VA_ARGS__);                              \
-    cpu_dump_state(cs, stderr, fprintf, 0);                             \
+    cpu_dump_state(cs, stderr, 0);                                      \
     if (qemu_log_separate()) {                                          \
         qemu_log(fmt, ## __VA_ARGS__);                                  \
         log_cpu_state(cs, 0);                                           \
diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c
index dacf604c7d..af8c128bf8 100644
--- a/linux-user/cris/cpu_loop.c
+++ b/linux-user/cris/cpu_loop.c
@@ -74,7 +74,7 @@ void cpu_loop(CPUCRISState *env)
             break;
         default:
             fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
-            cpu_dump_state(cs, stderr, fprintf, 0);
+            cpu_dump_state(cs, stderr, 0);
             exit(EXIT_FAILURE);
         }
         process_pending_signals (env);
diff --git a/linux-user/microblaze/cpu_loop.c b/linux-user/microblaze/cpu_loop.c
index c2190e15fd..076bdb9a61 100644
--- a/linux-user/microblaze/cpu_loop.c
+++ b/linux-user/microblaze/cpu_loop.c
@@ -107,7 +107,7 @@ void cpu_loop(CPUMBState *env)
                 default:
                     fprintf(stderr, "Unhandled hw-exception: 0x%" PRIx64 "\n",
                             env->sregs[SR_ESR] & ESR_EC_MASK);
-                    cpu_dump_state(cs, stderr, fprintf, 0);
+                    cpu_dump_state(cs, stderr, 0);
                     exit(EXIT_FAILURE);
                     break;
             }
@@ -123,7 +123,7 @@ void cpu_loop(CPUMBState *env)
             break;
         default:
             fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
-            cpu_dump_state(cs, stderr, fprintf, 0);
+            cpu_dump_state(cs, stderr, 0);
             exit(EXIT_FAILURE);
         }
         process_pending_signals (env);
diff --git a/linux-user/s390x/cpu_loop.c b/linux-user/s390x/cpu_loop.c
index 51b5412ea2..b8bd1c956c 100644
--- a/linux-user/s390x/cpu_loop.c
+++ b/linux-user/s390x/cpu_loop.c
@@ -124,7 +124,7 @@ void cpu_loop(CPUS390XState *env)
 
             default:
                 fprintf(stderr, "Unhandled program exception: %#x\n", n);
-                cpu_dump_state(cs, stderr, fprintf, 0);
+                cpu_dump_state(cs, stderr, 0);
                 exit(EXIT_FAILURE);
             }
             break;
@@ -144,7 +144,7 @@ void cpu_loop(CPUS390XState *env)
             break;
         default:
             fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
-            cpu_dump_state(cs, stderr, fprintf, 0);
+            cpu_dump_state(cs, stderr, 0);
             exit(EXIT_FAILURE);
         }
         process_pending_signals (env);
diff --git a/linux-user/sh4/cpu_loop.c b/linux-user/sh4/cpu_loop.c
index 47e54b9b61..59cbbeda7e 100644
--- a/linux-user/sh4/cpu_loop.c
+++ b/linux-user/sh4/cpu_loop.c
@@ -76,7 +76,7 @@ void cpu_loop(CPUSH4State *env)
             break;
         default:
             fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
-            cpu_dump_state(cs, stderr, fprintf, 0);
+            cpu_dump_state(cs, stderr, 0);
             exit(EXIT_FAILURE);
         }
         process_pending_signals (env);
diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c
index 7d5b337b97..9e357229c0 100644
--- a/linux-user/sparc/cpu_loop.c
+++ b/linux-user/sparc/cpu_loop.c
@@ -278,7 +278,7 @@ void cpu_loop (CPUSPARCState *env)
             break;
         default:
             fprintf(stderr, "Unhandled trap: 0x%x\n", trapnr);
-            cpu_dump_state(cs, stderr, fprintf, 0);
+            cpu_dump_state(cs, stderr, 0);
             exit(EXIT_FAILURE);
         }
         process_pending_signals (env);
diff --git a/monitor.c b/monitor.c
index fb5b681099..ad6cec54a1 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1296,7 +1296,7 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
     if (all_cpus) {
         CPU_FOREACH(cs) {
             monitor_printf(mon, "\nCPU#%d\n", cs->cpu_index);
-            cpu_dump_state(cs, (FILE *)mon, monitor_fprintf, CPU_DUMP_FPU);
+            cpu_dump_state(cs, NULL, CPU_DUMP_FPU);
         }
     } else {
         cs = mon_get_cpu();
@@ -1306,7 +1306,7 @@ static void hmp_info_registers(Monitor *mon, const QDict *qdict)
             return;
         }
 
-        cpu_dump_state(cs, (FILE *)mon, monitor_fprintf, CPU_DUMP_FPU);
+        cpu_dump_state(cs, NULL, CPU_DUMP_FPU);
     }
 }
 
diff --git a/qom/cpu.c b/qom/cpu.c
index 029e7fe9b0..3c5493c96c 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -28,6 +28,7 @@
 #include "exec/log.h"
 #include "exec/cpu-common.h"
 #include "qemu/error-report.h"
+#include "qemu/qemu-print.h"
 #include "sysemu/sysemu.h"
 #include "hw/boards.h"
 #include "hw/qdev-properties.h"
@@ -219,14 +220,13 @@ GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
     return res;
 }
 
-void cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                    int flags)
+void cpu_dump_state(CPUState *cpu, FILE *f, int flags)
 {
     CPUClass *cc = CPU_GET_CLASS(cpu);
 
     if (cc->dump_state) {
         cpu_synchronize_state(cpu);
-        cc->dump_state(cpu, f, cpu_fprintf, flags);
+        cc->dump_state(cpu, f, flags);
     }
 }
 
diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h
index 732764f23c..63bf3618ff 100644
--- a/target/alpha/cpu.h
+++ b/target/alpha/cpu.h
@@ -311,8 +311,7 @@ extern const struct VMStateDescription vmstate_alpha_cpu;
 
 void alpha_cpu_do_interrupt(CPUState *cpu);
 bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                          int flags);
+void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags);
 hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int alpha_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int alpha_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/alpha/helper.c b/target/alpha/helper.c
index 57e2c212b3..7201576aae 100644
--- a/target/alpha/helper.c
+++ b/target/alpha/helper.c
@@ -23,6 +23,7 @@
 #include "exec/exec-all.h"
 #include "fpu/softfloat.h"
 #include "exec/helper-proto.h"
+#include "qemu/qemu-print.h"
 
 
 #define CONVERT_BIT(X, SRC, DST) \
@@ -426,8 +427,7 @@ bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
     return false;
 }
 
-void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                          int flags)
+void alpha_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     static const char *linux_reg_names[] = {
         "v0 ", "t0 ", "t1 ", "t2 ", "t3 ", "t4 ", "t5 ", "t6 ",
@@ -439,24 +439,24 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
     CPUAlphaState *env = &cpu->env;
     int i;
 
-    cpu_fprintf(f, "     PC  " TARGET_FMT_lx "      PS  %02x\n",
-                env->pc, extract32(env->flags, ENV_FLAG_PS_SHIFT, 8));
+    qemu_fprintf(f, "     PC  " TARGET_FMT_lx "      PS  %02x\n",
+                 env->pc, extract32(env->flags, ENV_FLAG_PS_SHIFT, 8));
     for (i = 0; i < 31; i++) {
-        cpu_fprintf(f, "IR%02d %s " TARGET_FMT_lx "%c", i,
-                    linux_reg_names[i], cpu_alpha_load_gr(env, i),
-                    (i % 3) == 2 ? '\n' : ' ');
+        qemu_fprintf(f, "IR%02d %s " TARGET_FMT_lx "%c", i,
+                     linux_reg_names[i], cpu_alpha_load_gr(env, i),
+                     (i % 3) == 2 ? '\n' : ' ');
     }
 
-    cpu_fprintf(f, "lock_a   " TARGET_FMT_lx " lock_v   " TARGET_FMT_lx "\n",
-                env->lock_addr, env->lock_value);
+    qemu_fprintf(f, "lock_a   " TARGET_FMT_lx " lock_v   " TARGET_FMT_lx "\n",
+                 env->lock_addr, env->lock_value);
 
     if (flags & CPU_DUMP_FPU) {
         for (i = 0; i < 31; i++) {
-            cpu_fprintf(f, "FIR%02d    %016" PRIx64 "%c", i, env->fir[i],
-                        (i % 3) == 2 ? '\n' : ' ');
+            qemu_fprintf(f, "FIR%02d    %016" PRIx64 "%c", i, env->fir[i],
+                         (i % 3) == 2 ? '\n' : ' ');
         }
     }
-    cpu_fprintf(f, "\n");
+    qemu_fprintf(f, "\n");
 }
 
 /* This should only be called from translate, via gen_excp.
diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c
index b2b22d231e..8b5fd7bc6e 100644
--- a/target/arm/arm-semi.c
+++ b/target/arm/arm-semi.c
@@ -650,7 +650,7 @@ target_ulong do_arm_semihosting(CPUARMState *env)
         /* fall through -- invalid for A32/T32 */
     default:
         fprintf(stderr, "qemu: Unsupported SemiHosting SWI 0x%02x\n", nr);
-        cpu_dump_state(cs, stderr, fprintf, 0);
+        cpu_dump_state(cs, stderr, 0);
         abort();
     }
 }
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 85c3bd642a..f7f2f5a99c 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -935,8 +935,7 @@ void arm_cpu_do_interrupt(CPUState *cpu);
 void arm_v7m_cpu_do_interrupt(CPUState *cpu);
 bool arm_cpu_exec_interrupt(CPUState *cpu, int int_req);
 
-void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                        int flags);
+void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags);
 
 hwaddr arm_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
                                          MemTxAttrs *attrs);
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index dcdeb80176..9dcc5ff3a3 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -27,6 +27,7 @@
 #include "translate.h"
 #include "internals.h"
 #include "qemu/host-utils.h"
+#include "qemu/qemu-print.h"
 
 #include "exec/semihost.h"
 #include "exec/gen-icount.h"
@@ -151,8 +152,7 @@ static void set_btype(DisasContext *s, int val)
     s->btype = -1;
 }
 
-void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
-                            fprintf_function cpu_fprintf, int flags)
+void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     ARMCPU *cpu = ARM_CPU(cs);
     CPUARMState *env = &cpu->env;
@@ -161,13 +161,13 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
     int el = arm_current_el(env);
     const char *ns_status;
 
-    cpu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
+    qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc);
     for (i = 0; i < 32; i++) {
         if (i == 31) {
-            cpu_fprintf(f, " SP=%016" PRIx64 "\n", env->xregs[i]);
+            qemu_fprintf(f, " SP=%016" PRIx64 "\n", env->xregs[i]);
         } else {
-            cpu_fprintf(f, "X%02d=%016" PRIx64 "%s", i, env->xregs[i],
-                        (i + 2) % 3 ? " " : "\n");
+            qemu_fprintf(f, "X%02d=%016" PRIx64 "%s", i, env->xregs[i],
+                         (i + 2) % 3 ? " " : "\n");
         }
     }
 
@@ -176,29 +176,29 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
     } else {
         ns_status = "";
     }
-    cpu_fprintf(f, "PSTATE=%08x %c%c%c%c %sEL%d%c",
-                psr,
-                psr & PSTATE_N ? 'N' : '-',
-                psr & PSTATE_Z ? 'Z' : '-',
-                psr & PSTATE_C ? 'C' : '-',
-                psr & PSTATE_V ? 'V' : '-',
-                ns_status,
-                el,
-                psr & PSTATE_SP ? 'h' : 't');
+    qemu_fprintf(f, "PSTATE=%08x %c%c%c%c %sEL%d%c",
+                 psr,
+                 psr & PSTATE_N ? 'N' : '-',
+                 psr & PSTATE_Z ? 'Z' : '-',
+                 psr & PSTATE_C ? 'C' : '-',
+                 psr & PSTATE_V ? 'V' : '-',
+                 ns_status,
+                 el,
+                 psr & PSTATE_SP ? 'h' : 't');
 
     if (cpu_isar_feature(aa64_bti, cpu)) {
-        cpu_fprintf(f, "  BTYPE=%d", (psr & PSTATE_BTYPE) >> 10);
+        qemu_fprintf(f, "  BTYPE=%d", (psr & PSTATE_BTYPE) >> 10);
     }
     if (!(flags & CPU_DUMP_FPU)) {
-        cpu_fprintf(f, "\n");
+        qemu_fprintf(f, "\n");
         return;
     }
     if (fp_exception_el(env, el) != 0) {
-        cpu_fprintf(f, "    FPU disabled\n");
+        qemu_fprintf(f, "    FPU disabled\n");
         return;
     }
-    cpu_fprintf(f, "     FPCR=%08x FPSR=%08x\n",
-                vfp_get_fpcr(env), vfp_get_fpsr(env));
+    qemu_fprintf(f, "     FPCR=%08x FPSR=%08x\n",
+                 vfp_get_fpcr(env), vfp_get_fpsr(env));
 
     if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) == 0) {
         int j, zcr_len = sve_zcr_len_for_el(env, el);
@@ -206,11 +206,11 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
         for (i = 0; i <= FFR_PRED_NUM; i++) {
             bool eol;
             if (i == FFR_PRED_NUM) {
-                cpu_fprintf(f, "FFR=");
+                qemu_fprintf(f, "FFR=");
                 /* It's last, so end the line.  */
                 eol = true;
             } else {
-                cpu_fprintf(f, "P%02d=", i);
+                qemu_fprintf(f, "P%02d=", i);
                 switch (zcr_len) {
                 case 0:
                     eol = i % 8 == 7;
@@ -235,46 +235,46 @@ void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
                 } else {
                     digits = (zcr_len % 4 + 1) * 4;
                 }
-                cpu_fprintf(f, "%0*" PRIx64 "%s", digits,
-                            env->vfp.pregs[i].p[j],
-                            j ? ":" : eol ? "\n" : " ");
+                qemu_fprintf(f, "%0*" PRIx64 "%s", digits,
+                             env->vfp.pregs[i].p[j],
+                             j ? ":" : eol ? "\n" : " ");
             }
         }
 
         for (i = 0; i < 32; i++) {
             if (zcr_len == 0) {
-                cpu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
-                            i, env->vfp.zregs[i].d[1],
-                            env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
+                qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64 "%s",
+                             i, env->vfp.zregs[i].d[1],
+                             env->vfp.zregs[i].d[0], i & 1 ? "\n" : " ");
             } else if (zcr_len == 1) {
-                cpu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
-                            ":%016" PRIx64 ":%016" PRIx64 "\n",
-                            i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
-                            env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
+                qemu_fprintf(f, "Z%02d=%016" PRIx64 ":%016" PRIx64
+                             ":%016" PRIx64 ":%016" PRIx64 "\n",
+                             i, env->vfp.zregs[i].d[3], env->vfp.zregs[i].d[2],
+                             env->vfp.zregs[i].d[1], env->vfp.zregs[i].d[0]);
             } else {
                 for (j = zcr_len; j >= 0; j--) {
                     bool odd = (zcr_len - j) % 2 != 0;
                     if (j == zcr_len) {
-                        cpu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
+                        qemu_fprintf(f, "Z%02d[%x-%x]=", i, j, j - 1);
                     } else if (!odd) {
                         if (j > 0) {
-                            cpu_fprintf(f, "   [%x-%x]=", j, j - 1);
+                            qemu_fprintf(f, "   [%x-%x]=", j, j - 1);
                         } else {
-                            cpu_fprintf(f, "     [%x]=", j);
+                            qemu_fprintf(f, "     [%x]=", j);
                         }
                     }
-                    cpu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
-                                env->vfp.zregs[i].d[j * 2 + 1],
-                                env->vfp.zregs[i].d[j * 2],
-                                odd || j == 0 ? "\n" : ":");
+                    qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%s",
+                                 env->vfp.zregs[i].d[j * 2 + 1],
+                                 env->vfp.zregs[i].d[j * 2],
+                                 odd || j == 0 ? "\n" : ":");
                 }
             }
         }
     } else {
         for (i = 0; i < 32; i++) {
             uint64_t *q = aa64_vfp_qreg(env, i);
-            cpu_fprintf(f, "Q%02d=%016" PRIx64 ":%016" PRIx64 "%s",
-                        i, q[1], q[0], (i & 1 ? "\n" : " "));
+            qemu_fprintf(f, "Q%02d=%016" PRIx64 ":%016" PRIx64 "%s",
+                         i, q[1], q[0], (i & 1 ? "\n" : " "));
         }
     }
 }
diff --git a/target/arm/translate.c b/target/arm/translate.c
index d408e4d7ef..d9e7bb737a 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -28,6 +28,7 @@
 #include "tcg-op-gvec.h"
 #include "qemu/log.h"
 #include "qemu/bitops.h"
+#include "qemu/qemu-print.h"
 #include "arm_ldst.h"
 #include "exec/semihost.h"
 
@@ -13772,24 +13773,23 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)
     translator_loop(ops, &dc.base, cpu, tb);
 }
 
-void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                        int flags)
+void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     ARMCPU *cpu = ARM_CPU(cs);
     CPUARMState *env = &cpu->env;
     int i;
 
     if (is_a64(env)) {
-        aarch64_cpu_dump_state(cs, f, cpu_fprintf, flags);
+        aarch64_cpu_dump_state(cs, f, flags);
         return;
     }
 
     for(i=0;i<16;i++) {
-        cpu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
+        qemu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
         if ((i % 4) == 3)
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         else
-            cpu_fprintf(f, " ");
+            qemu_fprintf(f, " ");
     }
 
     if (arm_feature(env, ARM_FEATURE_M)) {
@@ -13811,15 +13811,15 @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
             }
         }
 
-        cpu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s%s\n",
-                    xpsr,
-                    xpsr & XPSR_N ? 'N' : '-',
-                    xpsr & XPSR_Z ? 'Z' : '-',
-                    xpsr & XPSR_C ? 'C' : '-',
-                    xpsr & XPSR_V ? 'V' : '-',
-                    xpsr & XPSR_T ? 'T' : 'A',
-                    ns_status,
-                    mode);
+        qemu_fprintf(f, "XPSR=%08x %c%c%c%c %c %s%s\n",
+                     xpsr,
+                     xpsr & XPSR_N ? 'N' : '-',
+                     xpsr & XPSR_Z ? 'Z' : '-',
+                     xpsr & XPSR_C ? 'C' : '-',
+                     xpsr & XPSR_V ? 'V' : '-',
+                     xpsr & XPSR_T ? 'T' : 'A',
+                     ns_status,
+                     mode);
     } else {
         uint32_t psr = cpsr_read(env);
         const char *ns_status = "";
@@ -13829,15 +13829,15 @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
             ns_status = env->cp15.scr_el3 & SCR_NS ? "NS " : "S ";
         }
 
-        cpu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%s%d\n",
-                    psr,
-                    psr & CPSR_N ? 'N' : '-',
-                    psr & CPSR_Z ? 'Z' : '-',
-                    psr & CPSR_C ? 'C' : '-',
-                    psr & CPSR_V ? 'V' : '-',
-                    psr & CPSR_T ? 'T' : 'A',
-                    ns_status,
-                    aarch32_mode_name(psr), (psr & 0x10) ? 32 : 26);
+        qemu_fprintf(f, "PSR=%08x %c%c%c%c %c %s%s%d\n",
+                     psr,
+                     psr & CPSR_N ? 'N' : '-',
+                     psr & CPSR_Z ? 'Z' : '-',
+                     psr & CPSR_C ? 'C' : '-',
+                     psr & CPSR_V ? 'V' : '-',
+                     psr & CPSR_T ? 'T' : 'A',
+                     ns_status,
+                     aarch32_mode_name(psr), (psr & 0x10) ? 32 : 26);
     }
 
     if (flags & CPU_DUMP_FPU) {
@@ -13850,12 +13850,12 @@ void arm_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
         }
         for (i = 0; i < numvfpregs; i++) {
             uint64_t v = *aa32_vfp_dreg(env, i);
-            cpu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n",
-                        i * 2, (uint32_t)v,
-                        i * 2 + 1, (uint32_t)(v >> 32),
-                        i, v);
+            qemu_fprintf(f, "s%02d=%08x s%02d=%08x d%02d=%016" PRIx64 "\n",
+                         i * 2, (uint32_t)v,
+                         i * 2 + 1, (uint32_t)(v >> 32),
+                         i, v);
         }
-        cpu_fprintf(f, "FPSCR: %08x\n", vfp_get_fpscr(env));
+        qemu_fprintf(f, "FPSCR: %08x\n", vfp_get_fpscr(env));
     }
 }
 
diff --git a/target/arm/translate.h b/target/arm/translate.h
index 912cc2a4a5..984617786d 100644
--- a/target/arm/translate.h
+++ b/target/arm/translate.h
@@ -166,8 +166,7 @@ static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn)
 #ifdef TARGET_AARCH64
 void a64_translate_init(void);
 void gen_a64_set_pc_im(uint64_t val);
-void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
-                            fprintf_function cpu_fprintf, int flags);
+void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags);
 extern const TranslatorOps aarch64_translator_ops;
 #else
 static inline void a64_translate_init(void)
@@ -178,9 +177,7 @@ static inline void gen_a64_set_pc_im(uint64_t val)
 {
 }
 
-static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f,
-                                          fprintf_function cpu_fprintf,
-                                          int flags)
+static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
 }
 #endif
diff --git a/target/cris/cpu.h b/target/cris/cpu.h
index 3d11922fb2..0fbe771639 100644
--- a/target/cris/cpu.h
+++ b/target/cris/cpu.h
@@ -207,8 +207,7 @@ void cris_cpu_do_interrupt(CPUState *cpu);
 void crisv10_cpu_do_interrupt(CPUState *cpu);
 bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req);
 
-void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
+void cris_cpu_dump_state(CPUState *cs, FILE *f, int flags);
 
 hwaddr cris_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 
diff --git a/target/cris/helper.c b/target/cris/helper.c
index b2dbb2075c..3939603c73 100644
--- a/target/cris/helper.c
+++ b/target/cris/helper.c
@@ -60,7 +60,7 @@ int cris_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw,
 
     cs->exception_index = 0xaa;
     cpu->env.pregs[PR_EDA] = address;
-    cpu_dump_state(cs, stderr, fprintf, 0);
+    cpu_dump_state(cs, stderr, 0);
     return 1;
 }
 
diff --git a/target/cris/translate.c b/target/cris/translate.c
index 11b2c11174..96359c0d7d 100644
--- a/target/cris/translate.c
+++ b/target/cris/translate.c
@@ -33,6 +33,7 @@
 #include "exec/cpu_ldst.h"
 #include "exec/translator.h"
 #include "crisv32-decode.h"
+#include "qemu/qemu-print.h"
 
 #include "exec/helper-gen.h"
 
@@ -3299,8 +3300,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
 #endif
 }
 
-void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                         int flags)
+void cris_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     CRISCPU *cpu = CRIS_CPU(cs);
     CPUCRISState *env = &cpu->env;
@@ -3308,7 +3308,7 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
     const char **pregnames;
     int i;
 
-    if (!env || !f) {
+    if (!env) {
         return;
     }
     if (env->pregs[PR_VR] < 32) {
@@ -3319,40 +3319,40 @@ void cris_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
         regnames = regnames_v32;
     }
 
-    cpu_fprintf(f, "PC=%x CCS=%x btaken=%d btarget=%x\n"
-            "cc_op=%d cc_src=%d cc_dest=%d cc_result=%x cc_mask=%x\n",
-            env->pc, env->pregs[PR_CCS], env->btaken, env->btarget,
-            env->cc_op,
-            env->cc_src, env->cc_dest, env->cc_result, env->cc_mask);
+    qemu_fprintf(f, "PC=%x CCS=%x btaken=%d btarget=%x\n"
+                 "cc_op=%d cc_src=%d cc_dest=%d cc_result=%x cc_mask=%x\n",
+                 env->pc, env->pregs[PR_CCS], env->btaken, env->btarget,
+                 env->cc_op,
+                 env->cc_src, env->cc_dest, env->cc_result, env->cc_mask);
 
 
     for (i = 0; i < 16; i++) {
-        cpu_fprintf(f, "%s=%8.8x ", regnames[i], env->regs[i]);
+        qemu_fprintf(f, "%s=%8.8x ", regnames[i], env->regs[i]);
         if ((i + 1) % 4 == 0) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         }
     }
-    cpu_fprintf(f, "\nspecial regs:\n");
+    qemu_fprintf(f, "\nspecial regs:\n");
     for (i = 0; i < 16; i++) {
-        cpu_fprintf(f, "%s=%8.8x ", pregnames[i], env->pregs[i]);
+        qemu_fprintf(f, "%s=%8.8x ", pregnames[i], env->pregs[i]);
         if ((i + 1) % 4 == 0) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         }
     }
     if (env->pregs[PR_VR] >= 32) {
         uint32_t srs = env->pregs[PR_SRS];
-        cpu_fprintf(f, "\nsupport function regs bank %x:\n", srs);
+        qemu_fprintf(f, "\nsupport function regs bank %x:\n", srs);
         if (srs < ARRAY_SIZE(env->sregs)) {
             for (i = 0; i < 16; i++) {
-                cpu_fprintf(f, "s%2.2d=%8.8x ",
-                        i, env->sregs[srs][i]);
+                qemu_fprintf(f, "s%2.2d=%8.8x ",
+                             i, env->sregs[srs][i]);
                 if ((i + 1) % 4 == 0) {
-                    cpu_fprintf(f, "\n");
+                    qemu_fprintf(f, "\n");
                 }
             }
         }
     }
-    cpu_fprintf(f, "\n\n");
+    qemu_fprintf(f, "\n\n");
 
 }
 
diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
index db8c9b812c..923346adb6 100644
--- a/target/hppa/cpu.h
+++ b/target/hppa/cpu.h
@@ -359,7 +359,7 @@ int hppa_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int hppa_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
 void hppa_cpu_do_interrupt(CPUState *cpu);
 bool hppa_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void hppa_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function, int);
+void hppa_cpu_dump_state(CPUState *cs, FILE *f, int);
 #ifdef CONFIG_USER_ONLY
 int hppa_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size,
                               int rw, int midx);
diff --git a/target/hppa/helper.c b/target/hppa/helper.c
index ac750b62ef..11c61b3ca2 100644
--- a/target/hppa/helper.c
+++ b/target/hppa/helper.c
@@ -23,6 +23,7 @@
 #include "fpu/softfloat.h"
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
+#include "qemu/qemu-print.h"
 
 target_ureg cpu_hppa_get_psw(CPUHPPAState *env)
 {
@@ -76,8 +77,7 @@ void cpu_hppa_put_psw(CPUHPPAState *env, target_ureg psw)
     }
 }
 
-void hppa_cpu_dump_state(CPUState *cs, FILE *f,
-                         fprintf_function cpu_fprintf, int flags)
+void hppa_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     HPPACPU *cpu = HPPA_CPU(cs);
     CPUHPPAState *env = &cpu->env;
@@ -86,9 +86,9 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f,
     char psw_c[20];
     int i;
 
-    cpu_fprintf(f, "IA_F " TARGET_FMT_lx " IA_B " TARGET_FMT_lx "\n",
-                hppa_form_gva_psw(psw, env->iasq_f, env->iaoq_f),
-                hppa_form_gva_psw(psw, env->iasq_b, env->iaoq_b));
+    qemu_fprintf(f, "IA_F " TARGET_FMT_lx " IA_B " TARGET_FMT_lx "\n",
+                 hppa_form_gva_psw(psw, env->iasq_f, env->iaoq_f),
+                 hppa_form_gva_psw(psw, env->iasq_b, env->iaoq_b));
 
     psw_c[0]  = (psw & PSW_W ? 'W' : '-');
     psw_c[1]  = (psw & PSW_E ? 'E' : '-');
@@ -111,20 +111,20 @@ void hppa_cpu_dump_state(CPUState *cs, FILE *f,
     psw_c[18] = '\0';
     psw_cb = ((env->psw_cb >> 4) & 0x01111111) | (env->psw_cb_msb << 28);
 
-    cpu_fprintf(f, "PSW  " TREG_FMT_lx " CB   " TREG_FMT_lx " %s\n",
-                psw, psw_cb, psw_c);
+    qemu_fprintf(f, "PSW  " TREG_FMT_lx " CB   " TREG_FMT_lx " %s\n",
+                 psw, psw_cb, psw_c);
 
     for (i = 0; i < 32; i++) {
-        cpu_fprintf(f, "GR%02d " TREG_FMT_lx "%c", i, env->gr[i],
-                    (i & 3) == 3 ? '\n' : ' ');
+        qemu_fprintf(f, "GR%02d " TREG_FMT_lx "%c", i, env->gr[i],
+                     (i & 3) == 3 ? '\n' : ' ');
     }
 #ifndef CONFIG_USER_ONLY
     for (i = 0; i < 8; i++) {
-        cpu_fprintf(f, "SR%02d %08x%c", i, (uint32_t)(env->sr[i] >> 32),
-                    (i & 3) == 3 ? '\n' : ' ');
+        qemu_fprintf(f, "SR%02d %08x%c", i, (uint32_t)(env->sr[i] >> 32),
+                     (i & 3) == 3 ? '\n' : ' ');
     }
 #endif
-     cpu_fprintf(f, "\n");
+     qemu_fprintf(f, "\n");
 
     /* ??? FR */
 }
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 139fe30960..828067bd1c 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -1521,8 +1521,7 @@ int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
 void x86_cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
                                 Error **errp);
 
-void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                        int flags);
+void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags);
 
 hwaddr x86_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 
diff --git a/target/i386/hax-all.c b/target/i386/hax-all.c
index b978a9b821..44b89c1d74 100644
--- a/target/i386/hax-all.c
+++ b/target/i386/hax-all.c
@@ -540,7 +540,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
                     ht->_exit_reason);
             qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
             hax_vcpu_sync_state(env, 0);
-            cpu_dump_state(cpu, stderr, fprintf, 0);
+            cpu_dump_state(cpu, stderr, 0);
             ret = -1;
             break;
         case HAX_EXIT_HLT:
@@ -571,7 +571,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
             fprintf(stderr, "Unknown exit %x from HAX\n", ht->_exit_status);
             qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
             hax_vcpu_sync_state(env, 0);
-            cpu_dump_state(cpu, stderr, fprintf, 0);
+            cpu_dump_state(cpu, stderr, 0);
             ret = 1;
             break;
         }
diff --git a/target/i386/helper.c b/target/i386/helper.c
index 565391a9f6..96336055f3 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -156,38 +156,41 @@ static const char *cc_op_str[CC_OP_NB] = {
 };
 
 static void
-cpu_x86_dump_seg_cache(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
+cpu_x86_dump_seg_cache(CPUX86State *env, FILE *f,
                        const char *name, struct SegmentCache *sc)
 {
 #ifdef TARGET_X86_64
     if (env->hflags & HF_CS64_MASK) {
-        cpu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
-                    sc->selector, sc->base, sc->limit, sc->flags & 0x00ffff00);
+        qemu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
+                     sc->selector, sc->base, sc->limit,
+                     sc->flags & 0x00ffff00);
     } else
 #endif
     {
-        cpu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,
-                    (uint32_t)sc->base, sc->limit, sc->flags & 0x00ffff00);
+        qemu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,
+                     (uint32_t)sc->base, sc->limit,
+                     sc->flags & 0x00ffff00);
     }
 
     if (!(env->hflags & HF_PE_MASK) || !(sc->flags & DESC_P_MASK))
         goto done;
 
-    cpu_fprintf(f, " DPL=%d ", (sc->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);
+    qemu_fprintf(f, " DPL=%d ",
+                 (sc->flags & DESC_DPL_MASK) >> DESC_DPL_SHIFT);
     if (sc->flags & DESC_S_MASK) {
         if (sc->flags & DESC_CS_MASK) {
-            cpu_fprintf(f, (sc->flags & DESC_L_MASK) ? "CS64" :
-                           ((sc->flags & DESC_B_MASK) ? "CS32" : "CS16"));
-            cpu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',
-                        (sc->flags & DESC_R_MASK) ? 'R' : '-');
+            qemu_fprintf(f, (sc->flags & DESC_L_MASK) ? "CS64" :
+                         ((sc->flags & DESC_B_MASK) ? "CS32" : "CS16"));
+            qemu_fprintf(f, " [%c%c", (sc->flags & DESC_C_MASK) ? 'C' : '-',
+                         (sc->flags & DESC_R_MASK) ? 'R' : '-');
         } else {
-            cpu_fprintf(f,
-                        (sc->flags & DESC_B_MASK || env->hflags & HF_LMA_MASK)
-                        ? "DS  " : "DS16");
-            cpu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',
-                        (sc->flags & DESC_W_MASK) ? 'W' : '-');
+            qemu_fprintf(f, (sc->flags & DESC_B_MASK
+                             || env->hflags & HF_LMA_MASK)
+                         ? "DS  " : "DS16");
+            qemu_fprintf(f, " [%c%c", (sc->flags & DESC_E_MASK) ? 'E' : '-',
+                         (sc->flags & DESC_W_MASK) ? 'W' : '-');
         }
-        cpu_fprintf(f, "%c]", (sc->flags & DESC_A_MASK) ? 'A' : '-');
+        qemu_fprintf(f, "%c]", (sc->flags & DESC_A_MASK) ? 'A' : '-');
     } else {
         static const char *sys_type_name[2][16] = {
             { /* 32 bit mode */
@@ -203,13 +206,12 @@ cpu_x86_dump_seg_cache(CPUX86State *env, FILE *f, fprintf_function cpu_fprintf,
                 "Reserved", "IntGate64", "TrapGate64"
             }
         };
-        cpu_fprintf(f, "%s",
-                    sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
-                                 [(sc->flags & DESC_TYPE_MASK)
-                                  >> DESC_TYPE_SHIFT]);
+        qemu_fprintf(f, "%s",
+                     sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
+                     [(sc->flags & DESC_TYPE_MASK) >> DESC_TYPE_SHIFT]);
     }
 done:
-    cpu_fprintf(f, "\n");
+    qemu_fprintf(f, "\n");
 }
 
 #ifndef CONFIG_USER_ONLY
@@ -403,8 +405,7 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, int flags)
 #define DUMP_CODE_BYTES_TOTAL    50
 #define DUMP_CODE_BYTES_BACKWARD 20
 
-void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                        int flags)
+void x86_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     X86CPU *cpu = X86_CPU(cs);
     CPUX86State *env = &cpu->env;
@@ -415,109 +416,107 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
     eflags = cpu_compute_eflags(env);
 #ifdef TARGET_X86_64
     if (env->hflags & HF_CS64_MASK) {
-        cpu_fprintf(f,
-                    "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
-                    "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
-                    "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
-                    "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"
-                    "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
-                    env->regs[R_EAX],
-                    env->regs[R_EBX],
-                    env->regs[R_ECX],
-                    env->regs[R_EDX],
-                    env->regs[R_ESI],
-                    env->regs[R_EDI],
-                    env->regs[R_EBP],
-                    env->regs[R_ESP],
-                    env->regs[8],
-                    env->regs[9],
-                    env->regs[10],
-                    env->regs[11],
-                    env->regs[12],
-                    env->regs[13],
-                    env->regs[14],
-                    env->regs[15],
-                    env->eip, eflags,
-                    eflags & DF_MASK ? 'D' : '-',
-                    eflags & CC_O ? 'O' : '-',
-                    eflags & CC_S ? 'S' : '-',
-                    eflags & CC_Z ? 'Z' : '-',
-                    eflags & CC_A ? 'A' : '-',
-                    eflags & CC_P ? 'P' : '-',
-                    eflags & CC_C ? 'C' : '-',
-                    env->hflags & HF_CPL_MASK,
-                    (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
-                    (env->a20_mask >> 20) & 1,
-                    (env->hflags >> HF_SMM_SHIFT) & 1,
-                    cs->halted);
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
+                     env->regs[R_EAX],
+                     env->regs[R_EBX],
+                     env->regs[R_ECX],
+                     env->regs[R_EDX],
+                     env->regs[R_ESI],
+                     env->regs[R_EDI],
+                     env->regs[R_EBP],
+                     env->regs[R_ESP],
+                     env->regs[8],
+                     env->regs[9],
+                     env->regs[10],
+                     env->regs[11],
+                     env->regs[12],
+                     env->regs[13],
+                     env->regs[14],
+                     env->regs[15],
+                     env->eip, eflags,
+                     eflags & DF_MASK ? 'D' : '-',
+                     eflags & CC_O ? 'O' : '-',
+                     eflags & CC_S ? 'S' : '-',
+                     eflags & CC_Z ? 'Z' : '-',
+                     eflags & CC_A ? 'A' : '-',
+                     eflags & CC_P ? 'P' : '-',
+                     eflags & CC_C ? 'C' : '-',
+                     env->hflags & HF_CPL_MASK,
+                     (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
+                     (env->a20_mask >> 20) & 1,
+                     (env->hflags >> HF_SMM_SHIFT) & 1,
+                     cs->halted);
     } else
 #endif
     {
-        cpu_fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
-                    "ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
-                    "EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
-                    (uint32_t)env->regs[R_EAX],
-                    (uint32_t)env->regs[R_EBX],
-                    (uint32_t)env->regs[R_ECX],
-                    (uint32_t)env->regs[R_EDX],
-                    (uint32_t)env->regs[R_ESI],
-                    (uint32_t)env->regs[R_EDI],
-                    (uint32_t)env->regs[R_EBP],
-                    (uint32_t)env->regs[R_ESP],
-                    (uint32_t)env->eip, eflags,
-                    eflags & DF_MASK ? 'D' : '-',
-                    eflags & CC_O ? 'O' : '-',
-                    eflags & CC_S ? 'S' : '-',
-                    eflags & CC_Z ? 'Z' : '-',
-                    eflags & CC_A ? 'A' : '-',
-                    eflags & CC_P ? 'P' : '-',
-                    eflags & CC_C ? 'C' : '-',
-                    env->hflags & HF_CPL_MASK,
-                    (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
-                    (env->a20_mask >> 20) & 1,
-                    (env->hflags >> HF_SMM_SHIFT) & 1,
-                    cs->halted);
+        qemu_fprintf(f, "EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n"
+                     "ESI=%08x EDI=%08x EBP=%08x ESP=%08x\n"
+                     "EIP=%08x EFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",
+                     (uint32_t)env->regs[R_EAX],
+                     (uint32_t)env->regs[R_EBX],
+                     (uint32_t)env->regs[R_ECX],
+                     (uint32_t)env->regs[R_EDX],
+                     (uint32_t)env->regs[R_ESI],
+                     (uint32_t)env->regs[R_EDI],
+                     (uint32_t)env->regs[R_EBP],
+                     (uint32_t)env->regs[R_ESP],
+                     (uint32_t)env->eip, eflags,
+                     eflags & DF_MASK ? 'D' : '-',
+                     eflags & CC_O ? 'O' : '-',
+                     eflags & CC_S ? 'S' : '-',
+                     eflags & CC_Z ? 'Z' : '-',
+                     eflags & CC_A ? 'A' : '-',
+                     eflags & CC_P ? 'P' : '-',
+                     eflags & CC_C ? 'C' : '-',
+                     env->hflags & HF_CPL_MASK,
+                     (env->hflags >> HF_INHIBIT_IRQ_SHIFT) & 1,
+                     (env->a20_mask >> 20) & 1,
+                     (env->hflags >> HF_SMM_SHIFT) & 1,
+                     cs->halted);
     }
 
     for(i = 0; i < 6; i++) {
-        cpu_x86_dump_seg_cache(env, f, cpu_fprintf, seg_name[i],
-                               &env->segs[i]);
+        cpu_x86_dump_seg_cache(env, f, seg_name[i], &env->segs[i]);
     }
-    cpu_x86_dump_seg_cache(env, f, cpu_fprintf, "LDT", &env->ldt);
-    cpu_x86_dump_seg_cache(env, f, cpu_fprintf, "TR", &env->tr);
+    cpu_x86_dump_seg_cache(env, f, "LDT", &env->ldt);
+    cpu_x86_dump_seg_cache(env, f, "TR", &env->tr);
 
 #ifdef TARGET_X86_64
     if (env->hflags & HF_LMA_MASK) {
-        cpu_fprintf(f, "GDT=     %016" PRIx64 " %08x\n",
-                    env->gdt.base, env->gdt.limit);
-        cpu_fprintf(f, "IDT=     %016" PRIx64 " %08x\n",
-                    env->idt.base, env->idt.limit);
-        cpu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",
-                    (uint32_t)env->cr[0],
-                    env->cr[2],
-                    env->cr[3],
-                    (uint32_t)env->cr[4]);
+        qemu_fprintf(f, "GDT=     %016" PRIx64 " %08x\n",
+                     env->gdt.base, env->gdt.limit);
+        qemu_fprintf(f, "IDT=     %016" PRIx64 " %08x\n",
+                     env->idt.base, env->idt.limit);
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",
+                     (uint32_t)env->cr[0],
+                     env->cr[2],
+                     env->cr[3],
+                     (uint32_t)env->cr[4]);
         for(i = 0; i < 4; i++)
-            cpu_fprintf(f, "DR%d=%016" PRIx64 " ", i, env->dr[i]);
-        cpu_fprintf(f, "\nDR6=%016" PRIx64 " DR7=%016" PRIx64 "\n",
-                    env->dr[6], env->dr[7]);
+            qemu_fprintf(f, "DR%d=%016" PRIx64 " ", i, env->dr[i]);
+        qemu_fprintf(f, "\nDR6=%016" PRIx64 " DR7=%016" PRIx64 "\n",
+                     env->dr[6], env->dr[7]);
     } else
 #endif
     {
-        cpu_fprintf(f, "GDT=     %08x %08x\n",
-                    (uint32_t)env->gdt.base, env->gdt.limit);
-        cpu_fprintf(f, "IDT=     %08x %08x\n",
-                    (uint32_t)env->idt.base, env->idt.limit);
-        cpu_fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
-                    (uint32_t)env->cr[0],
-                    (uint32_t)env->cr[2],
-                    (uint32_t)env->cr[3],
-                    (uint32_t)env->cr[4]);
+        qemu_fprintf(f, "GDT=     %08x %08x\n",
+                     (uint32_t)env->gdt.base, env->gdt.limit);
+        qemu_fprintf(f, "IDT=     %08x %08x\n",
+                     (uint32_t)env->idt.base, env->idt.limit);
+        qemu_fprintf(f, "CR0=%08x CR2=%08x CR3=%08x CR4=%08x\n",
+                     (uint32_t)env->cr[0],
+                     (uint32_t)env->cr[2],
+                     (uint32_t)env->cr[3],
+                     (uint32_t)env->cr[4]);
         for(i = 0; i < 4; i++) {
-            cpu_fprintf(f, "DR%d=" TARGET_FMT_lx " ", i, env->dr[i]);
+            qemu_fprintf(f, "DR%d=" TARGET_FMT_lx " ", i, env->dr[i]);
         }
-        cpu_fprintf(f, "\nDR6=" TARGET_FMT_lx " DR7=" TARGET_FMT_lx "\n",
-                    env->dr[6], env->dr[7]);
+        qemu_fprintf(f, "\nDR6=" TARGET_FMT_lx " DR7=" TARGET_FMT_lx "\n",
+                     env->dr[6], env->dr[7]);
     }
     if (flags & CPU_DUMP_CCOP) {
         if ((unsigned)env->cc_op < CC_OP_NB)
@@ -526,55 +525,55 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
             snprintf(cc_op_name, sizeof(cc_op_name), "[%d]", env->cc_op);
 #ifdef TARGET_X86_64
         if (env->hflags & HF_CS64_MASK) {
-            cpu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%-8s\n",
-                        env->cc_src, env->cc_dst,
-                        cc_op_name);
+            qemu_fprintf(f, "CCS=%016" PRIx64 " CCD=%016" PRIx64 " CCO=%-8s\n",
+                         env->cc_src, env->cc_dst,
+                         cc_op_name);
         } else
 #endif
         {
-            cpu_fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
-                        (uint32_t)env->cc_src, (uint32_t)env->cc_dst,
-                        cc_op_name);
+            qemu_fprintf(f, "CCS=%08x CCD=%08x CCO=%-8s\n",
+                         (uint32_t)env->cc_src, (uint32_t)env->cc_dst,
+                         cc_op_name);
         }
     }
-    cpu_fprintf(f, "EFER=%016" PRIx64 "\n", env->efer);
+    qemu_fprintf(f, "EFER=%016" PRIx64 "\n", env->efer);
     if (flags & CPU_DUMP_FPU) {
         int fptag;
         fptag = 0;
         for(i = 0; i < 8; i++) {
             fptag |= ((!env->fptags[i]) << i);
         }
-        cpu_fprintf(f, "FCW=%04x FSW=%04x [ST=%d] FTW=%02x MXCSR=%08x\n",
-                    env->fpuc,
-                    (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11,
-                    env->fpstt,
-                    fptag,
-                    env->mxcsr);
+        qemu_fprintf(f, "FCW=%04x FSW=%04x [ST=%d] FTW=%02x MXCSR=%08x\n",
+                     env->fpuc,
+                     (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11,
+                     env->fpstt,
+                     fptag,
+                     env->mxcsr);
         for(i=0;i<8;i++) {
             CPU_LDoubleU u;
             u.d = env->fpregs[i].d;
-            cpu_fprintf(f, "FPR%d=%016" PRIx64 " %04x",
-                        i, u.l.lower, u.l.upper);
+            qemu_fprintf(f, "FPR%d=%016" PRIx64 " %04x",
+                         i, u.l.lower, u.l.upper);
             if ((i & 1) == 1)
-                cpu_fprintf(f, "\n");
+                qemu_fprintf(f, "\n");
             else
-                cpu_fprintf(f, " ");
+                qemu_fprintf(f, " ");
         }
         if (env->hflags & HF_CS64_MASK)
             nb = 16;
         else
             nb = 8;
         for(i=0;i<nb;i++) {
-            cpu_fprintf(f, "XMM%02d=%08x%08x%08x%08x",
-                        i,
-                        env->xmm_regs[i].ZMM_L(3),
-                        env->xmm_regs[i].ZMM_L(2),
-                        env->xmm_regs[i].ZMM_L(1),
-                        env->xmm_regs[i].ZMM_L(0));
+            qemu_fprintf(f, "XMM%02d=%08x%08x%08x%08x",
+                         i,
+                         env->xmm_regs[i].ZMM_L(3),
+                         env->xmm_regs[i].ZMM_L(2),
+                         env->xmm_regs[i].ZMM_L(1),
+                         env->xmm_regs[i].ZMM_L(0));
             if ((i & 1) == 1)
-                cpu_fprintf(f, "\n");
+                qemu_fprintf(f, "\n");
             else
-                cpu_fprintf(f, " ");
+                qemu_fprintf(f, " ");
         }
     }
     if (flags & CPU_DUMP_CODE) {
@@ -583,17 +582,17 @@ void x86_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
         uint8_t code;
         char codestr[3];
 
-        cpu_fprintf(f, "Code=");
+        qemu_fprintf(f, "Code=");
         for (i = 0; i < DUMP_CODE_BYTES_TOTAL; i++) {
             if (cpu_memory_rw_debug(cs, base - offs + i, &code, 1, 0) == 0) {
                 snprintf(codestr, sizeof(codestr), "%02x", code);
             } else {
                 snprintf(codestr, sizeof(codestr), "??");
             }
-            cpu_fprintf(f, "%s%s%s%s", i > 0 ? " " : "",
-                        i == offs ? "<" : "", codestr, i == offs ? ">" : "");
+            qemu_fprintf(f, "%s%s%s%s", i > 0 ? " " : "",
+                         i == offs ? "<" : "", codestr, i == offs ? ">" : "");
         }
-        cpu_fprintf(f, "\n");
+        qemu_fprintf(f, "\n");
     }
 }
 
diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h
index b8d539ead8..9b1e6c2d58 100644
--- a/target/lm32/cpu.h
+++ b/target/lm32/cpu.h
@@ -219,8 +219,7 @@ extern const struct VMStateDescription vmstate_lm32_cpu;
 
 void lm32_cpu_do_interrupt(CPUState *cpu);
 bool lm32_cpu_exec_interrupt(CPUState *cs, int int_req);
-void lm32_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
+void lm32_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr lm32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int lm32_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int lm32_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/lm32/translate.c b/target/lm32/translate.c
index b32feb7564..b8b5e12e63 100644
--- a/target/lm32/translate.c
+++ b/target/lm32/translate.c
@@ -24,6 +24,7 @@
 #include "exec/exec-all.h"
 #include "exec/translator.h"
 #include "tcg-op.h"
+#include "qemu/qemu-print.h"
 
 #include "exec/cpu_ldst.h"
 #include "hw/lm32/lm32_pic.h"
@@ -1161,38 +1162,37 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
 #endif
 }
 
-void lm32_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                         int flags)
+void lm32_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     LM32CPU *cpu = LM32_CPU(cs);
     CPULM32State *env = &cpu->env;
     int i;
 
-    if (!env || !f) {
+    if (!env) {
         return;
     }
 
-    cpu_fprintf(f, "IN: PC=%x %s\n",
-                env->pc, lookup_symbol(env->pc));
+    qemu_fprintf(f, "IN: PC=%x %s\n",
+                 env->pc, lookup_symbol(env->pc));
 
-    cpu_fprintf(f, "ie=%8.8x (IE=%x EIE=%x BIE=%x) im=%8.8x ip=%8.8x\n",
-             env->ie,
-             (env->ie & IE_IE) ? 1 : 0,
-             (env->ie & IE_EIE) ? 1 : 0,
-             (env->ie & IE_BIE) ? 1 : 0,
-             lm32_pic_get_im(env->pic_state),
-             lm32_pic_get_ip(env->pic_state));
-    cpu_fprintf(f, "eba=%8.8x deba=%8.8x\n",
-             env->eba,
-             env->deba);
+    qemu_fprintf(f, "ie=%8.8x (IE=%x EIE=%x BIE=%x) im=%8.8x ip=%8.8x\n",
+                 env->ie,
+                 (env->ie & IE_IE) ? 1 : 0,
+                 (env->ie & IE_EIE) ? 1 : 0,
+                 (env->ie & IE_BIE) ? 1 : 0,
+                 lm32_pic_get_im(env->pic_state),
+                 lm32_pic_get_ip(env->pic_state));
+    qemu_fprintf(f, "eba=%8.8x deba=%8.8x\n",
+                 env->eba,
+                 env->deba);
 
     for (i = 0; i < 32; i++) {
-        cpu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
+        qemu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
         if ((i + 1) % 4 == 0) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         }
     }
-    cpu_fprintf(f, "\n\n");
+    qemu_fprintf(f, "\n\n");
 }
 
 void restore_state_to_opc(CPULM32State *env, TranslationBlock *tb,
diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
index 73952f6ece..ad41608341 100644
--- a/target/m68k/cpu.h
+++ b/target/m68k/cpu.h
@@ -179,8 +179,7 @@ static inline M68kCPU *m68k_env_get_cpu(CPUM68KState *env)
 
 void m68k_cpu_do_interrupt(CPUState *cpu);
 bool m68k_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void m68k_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
+void m68k_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr m68k_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int m68k_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int m68k_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
index 6217a683f1..3b2280b48b 100644
--- a/target/m68k/translate.c
+++ b/target/m68k/translate.c
@@ -24,6 +24,7 @@
 #include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "qemu/log.h"
+#include "qemu/qemu-print.h"
 #include "exec/cpu_ldst.h"
 #include "exec/translator.h"
 
@@ -6187,76 +6188,75 @@ static double floatx80_to_double(CPUM68KState *env, uint16_t high, uint64_t low)
     return u.d;
 }
 
-void m68k_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                         int flags)
+void m68k_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     M68kCPU *cpu = M68K_CPU(cs);
     CPUM68KState *env = &cpu->env;
     int i;
     uint16_t sr;
     for (i = 0; i < 8; i++) {
-        cpu_fprintf(f, "D%d = %08x   A%d = %08x   "
-                    "F%d = %04x %016"PRIx64"  (%12g)\n",
-                    i, env->dregs[i], i, env->aregs[i],
-                    i, env->fregs[i].l.upper, env->fregs[i].l.lower,
-                    floatx80_to_double(env, env->fregs[i].l.upper,
-                                       env->fregs[i].l.lower));
+        qemu_fprintf(f, "D%d = %08x   A%d = %08x   "
+                     "F%d = %04x %016"PRIx64"  (%12g)\n",
+                     i, env->dregs[i], i, env->aregs[i],
+                     i, env->fregs[i].l.upper, env->fregs[i].l.lower,
+                     floatx80_to_double(env, env->fregs[i].l.upper,
+                                        env->fregs[i].l.lower));
     }
-    cpu_fprintf (f, "PC = %08x   ", env->pc);
+    qemu_fprintf(f, "PC = %08x   ", env->pc);
     sr = env->sr | cpu_m68k_get_ccr(env);
-    cpu_fprintf(f, "SR = %04x T:%x I:%x %c%c %c%c%c%c%c\n",
-                sr, (sr & SR_T) >> SR_T_SHIFT, (sr & SR_I) >> SR_I_SHIFT,
-                (sr & SR_S) ? 'S' : 'U', (sr & SR_M) ? '%' : 'I',
-                (sr & CCF_X) ? 'X' : '-', (sr & CCF_N) ? 'N' : '-',
-                (sr & CCF_Z) ? 'Z' : '-', (sr & CCF_V) ? 'V' : '-',
-                (sr & CCF_C) ? 'C' : '-');
-    cpu_fprintf(f, "FPSR = %08x %c%c%c%c ", env->fpsr,
-                (env->fpsr & FPSR_CC_A) ? 'A' : '-',
-                (env->fpsr & FPSR_CC_I) ? 'I' : '-',
-                (env->fpsr & FPSR_CC_Z) ? 'Z' : '-',
-                (env->fpsr & FPSR_CC_N) ? 'N' : '-');
-    cpu_fprintf(f, "\n                                "
-                   "FPCR =     %04x ", env->fpcr);
+    qemu_fprintf(f, "SR = %04x T:%x I:%x %c%c %c%c%c%c%c\n",
+                 sr, (sr & SR_T) >> SR_T_SHIFT, (sr & SR_I) >> SR_I_SHIFT,
+                 (sr & SR_S) ? 'S' : 'U', (sr & SR_M) ? '%' : 'I',
+                 (sr & CCF_X) ? 'X' : '-', (sr & CCF_N) ? 'N' : '-',
+                 (sr & CCF_Z) ? 'Z' : '-', (sr & CCF_V) ? 'V' : '-',
+                 (sr & CCF_C) ? 'C' : '-');
+    qemu_fprintf(f, "FPSR = %08x %c%c%c%c ", env->fpsr,
+                 (env->fpsr & FPSR_CC_A) ? 'A' : '-',
+                 (env->fpsr & FPSR_CC_I) ? 'I' : '-',
+                 (env->fpsr & FPSR_CC_Z) ? 'Z' : '-',
+                 (env->fpsr & FPSR_CC_N) ? 'N' : '-');
+    qemu_fprintf(f, "\n                                "
+                 "FPCR =     %04x ", env->fpcr);
     switch (env->fpcr & FPCR_PREC_MASK) {
     case FPCR_PREC_X:
-        cpu_fprintf(f, "X ");
+        qemu_fprintf(f, "X ");
         break;
     case FPCR_PREC_S:
-        cpu_fprintf(f, "S ");
+        qemu_fprintf(f, "S ");
         break;
     case FPCR_PREC_D:
-        cpu_fprintf(f, "D ");
+        qemu_fprintf(f, "D ");
         break;
     }
     switch (env->fpcr & FPCR_RND_MASK) {
     case FPCR_RND_N:
-        cpu_fprintf(f, "RN ");
+        qemu_fprintf(f, "RN ");
         break;
     case FPCR_RND_Z:
-        cpu_fprintf(f, "RZ ");
+        qemu_fprintf(f, "RZ ");
         break;
     case FPCR_RND_M:
-        cpu_fprintf(f, "RM ");
+        qemu_fprintf(f, "RM ");
         break;
     case FPCR_RND_P:
-        cpu_fprintf(f, "RP ");
+        qemu_fprintf(f, "RP ");
         break;
     }
-    cpu_fprintf(f, "\n");
+    qemu_fprintf(f, "\n");
 #ifdef CONFIG_SOFTMMU
-    cpu_fprintf(f, "%sA7(MSP) = %08x %sA7(USP) = %08x %sA7(ISP) = %08x\n",
-               env->current_sp == M68K_SSP ? "->" : "  ", env->sp[M68K_SSP],
-               env->current_sp == M68K_USP ? "->" : "  ", env->sp[M68K_USP],
-               env->current_sp == M68K_ISP ? "->" : "  ", env->sp[M68K_ISP]);
-    cpu_fprintf(f, "VBR = 0x%08x\n", env->vbr);
-    cpu_fprintf(f, "SFC = %x DFC %x\n", env->sfc, env->dfc);
-    cpu_fprintf(f, "SSW %08x TCR %08x URP %08x SRP %08x\n",
-                env->mmu.ssw, env->mmu.tcr, env->mmu.urp, env->mmu.srp);
-    cpu_fprintf(f, "DTTR0/1: %08x/%08x ITTR0/1: %08x/%08x\n",
-                env->mmu.ttr[M68K_DTTR0], env->mmu.ttr[M68K_DTTR1],
-                env->mmu.ttr[M68K_ITTR0], env->mmu.ttr[M68K_ITTR1]);
-    cpu_fprintf(f, "MMUSR %08x, fault at %08x\n",
-                env->mmu.mmusr, env->mmu.ar);
+    qemu_fprintf(f, "%sA7(MSP) = %08x %sA7(USP) = %08x %sA7(ISP) = %08x\n",
+                 env->current_sp == M68K_SSP ? "->" : "  ", env->sp[M68K_SSP],
+                 env->current_sp == M68K_USP ? "->" : "  ", env->sp[M68K_USP],
+                 env->current_sp == M68K_ISP ? "->" : "  ", env->sp[M68K_ISP]);
+    qemu_fprintf(f, "VBR = 0x%08x\n", env->vbr);
+    qemu_fprintf(f, "SFC = %x DFC %x\n", env->sfc, env->dfc);
+    qemu_fprintf(f, "SSW %08x TCR %08x URP %08x SRP %08x\n",
+                 env->mmu.ssw, env->mmu.tcr, env->mmu.urp, env->mmu.srp);
+    qemu_fprintf(f, "DTTR0/1: %08x/%08x ITTR0/1: %08x/%08x\n",
+                 env->mmu.ttr[M68K_DTTR0], env->mmu.ttr[M68K_DTTR1],
+                 env->mmu.ttr[M68K_ITTR0], env->mmu.ttr[M68K_ITTR1]);
+    qemu_fprintf(f, "MMUSR %08x, fault at %08x\n",
+                 env->mmu.mmusr, env->mmu.ar);
 #endif
 }
 
diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h
index 792bbc97c7..f20e796865 100644
--- a/target/microblaze/cpu.h
+++ b/target/microblaze/cpu.h
@@ -328,8 +328,7 @@ static inline MicroBlazeCPU *mb_env_get_cpu(CPUMBState *env)
 
 void mb_cpu_do_interrupt(CPUState *cs);
 bool mb_cpu_exec_interrupt(CPUState *cs, int int_req);
-void mb_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                       int flags);
+void mb_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr mb_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int mb_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int mb_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c
index bc753793ec..9848e31d7f 100644
--- a/target/microblaze/helper.c
+++ b/target/microblaze/helper.c
@@ -42,7 +42,7 @@ int mb_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size, int rw,
                             int mmu_idx)
 {
     cs->exception_index = 0xaa;
-    cpu_dump_state(cs, stderr, fprintf, 0);
+    cpu_dump_state(cs, stderr, 0);
     return 1;
 }
 
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index 78ca265b04..bc2712ddbd 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -28,6 +28,7 @@
 #include "exec/cpu_ldst.h"
 #include "exec/helper-gen.h"
 #include "exec/translator.h"
+#include "qemu/qemu-print.h"
 
 #include "trace-tcg.h"
 #include "exec/log.h"
@@ -1785,36 +1786,36 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
     assert(!dc->abort_at_next_insn);
 }
 
-void mb_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                       int flags)
+void mb_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
     CPUMBState *env = &cpu->env;
     int i;
 
-    if (!env || !f)
+    if (!env) {
         return;
+    }
 
-    cpu_fprintf(f, "IN: PC=%" PRIx64 " %s\n",
-                env->sregs[SR_PC], lookup_symbol(env->sregs[SR_PC]));
-    cpu_fprintf(f, "rmsr=%" PRIx64 " resr=%" PRIx64 " rear=%" PRIx64 " "
-                   "debug=%x imm=%x iflags=%x fsr=%" PRIx64 "\n",
-             env->sregs[SR_MSR], env->sregs[SR_ESR], env->sregs[SR_EAR],
-             env->debug, env->imm, env->iflags, env->sregs[SR_FSR]);
-    cpu_fprintf(f, "btaken=%d btarget=%" PRIx64 " mode=%s(saved=%s) "
-                   "eip=%d ie=%d\n",
-             env->btaken, env->btarget,
-             (env->sregs[SR_MSR] & MSR_UM) ? "user" : "kernel",
-             (env->sregs[SR_MSR] & MSR_UMS) ? "user" : "kernel",
-             (bool)(env->sregs[SR_MSR] & MSR_EIP),
-             (bool)(env->sregs[SR_MSR] & MSR_IE));
+    qemu_fprintf(f, "IN: PC=%" PRIx64 " %s\n",
+                 env->sregs[SR_PC], lookup_symbol(env->sregs[SR_PC]));
+    qemu_fprintf(f, "rmsr=%" PRIx64 " resr=%" PRIx64 " rear=%" PRIx64 " "
+                 "debug=%x imm=%x iflags=%x fsr=%" PRIx64 "\n",
+                 env->sregs[SR_MSR], env->sregs[SR_ESR], env->sregs[SR_EAR],
+                 env->debug, env->imm, env->iflags, env->sregs[SR_FSR]);
+    qemu_fprintf(f, "btaken=%d btarget=%" PRIx64 " mode=%s(saved=%s) "
+                 "eip=%d ie=%d\n",
+                 env->btaken, env->btarget,
+                 (env->sregs[SR_MSR] & MSR_UM) ? "user" : "kernel",
+                 (env->sregs[SR_MSR] & MSR_UMS) ? "user" : "kernel",
+                 (bool)(env->sregs[SR_MSR] & MSR_EIP),
+                 (bool)(env->sregs[SR_MSR] & MSR_IE));
 
     for (i = 0; i < 32; i++) {
-        cpu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
+        qemu_fprintf(f, "r%2.2d=%8.8x ", i, env->regs[i]);
         if ((i + 1) % 4 == 0)
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         }
-    cpu_fprintf(f, "\n\n");
+    qemu_fprintf(f, "\n\n");
 }
 
 void mb_tcg_init(void)
diff --git a/target/mips/internal.h b/target/mips/internal.h
index 8f6fc919d5..286e3888ab 100644
--- a/target/mips/internal.h
+++ b/target/mips/internal.h
@@ -76,8 +76,7 @@ enum CPUMIPSMSADataFormat {
 
 void mips_cpu_do_interrupt(CPUState *cpu);
 bool mips_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void mips_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
+void mips_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr mips_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int mips_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int mips_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/mips/translate.c b/target/mips/translate.c
index d886a0c9b2..7849d53977 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -29728,8 +29728,7 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
     translator_loop(&mips_tr_ops, &ctx.base, cs, tb);
 }
 
-static void fpu_dump_state(CPUMIPSState *env, FILE *f, fprintf_function fpu_fprintf,
-                           int flags)
+static void fpu_dump_state(CPUMIPSState *env, FILE *f, int flags)
 {
     int i;
     int is_fpu64 = !!(env->hflags & MIPS_HFLAG_F64);
@@ -29737,68 +29736,69 @@ static void fpu_dump_state(CPUMIPSState *env, FILE *f, fprintf_function fpu_fpri
 #define printfpr(fp)                                                    \
     do {                                                                \
         if (is_fpu64)                                                   \
-            fpu_fprintf(f, "w:%08x d:%016" PRIx64                       \
-                        " fd:%13g fs:%13g psu: %13g\n",                 \
-                        (fp)->w[FP_ENDIAN_IDX], (fp)->d,                \
-                        (double)(fp)->fd,                               \
-                        (double)(fp)->fs[FP_ENDIAN_IDX],                \
-                        (double)(fp)->fs[!FP_ENDIAN_IDX]);              \
+            qemu_fprintf(f, "w:%08x d:%016" PRIx64                      \
+                         " fd:%13g fs:%13g psu: %13g\n",                \
+                         (fp)->w[FP_ENDIAN_IDX], (fp)->d,               \
+                         (double)(fp)->fd,                              \
+                         (double)(fp)->fs[FP_ENDIAN_IDX],               \
+                         (double)(fp)->fs[!FP_ENDIAN_IDX]);             \
         else {                                                          \
             fpr_t tmp;                                                  \
             tmp.w[FP_ENDIAN_IDX] = (fp)->w[FP_ENDIAN_IDX];              \
             tmp.w[!FP_ENDIAN_IDX] = ((fp) + 1)->w[FP_ENDIAN_IDX];       \
-            fpu_fprintf(f, "w:%08x d:%016" PRIx64                       \
-                        " fd:%13g fs:%13g psu:%13g\n",                  \
-                        tmp.w[FP_ENDIAN_IDX], tmp.d,                    \
-                        (double)tmp.fd,                                 \
-                        (double)tmp.fs[FP_ENDIAN_IDX],                  \
-                        (double)tmp.fs[!FP_ENDIAN_IDX]);                \
+            qemu_fprintf(f, "w:%08x d:%016" PRIx64                      \
+                         " fd:%13g fs:%13g psu:%13g\n",                 \
+                         tmp.w[FP_ENDIAN_IDX], tmp.d,                   \
+                         (double)tmp.fd,                                \
+                         (double)tmp.fs[FP_ENDIAN_IDX],                 \
+                         (double)tmp.fs[!FP_ENDIAN_IDX]);               \
         }                                                               \
     } while(0)
 
 
-    fpu_fprintf(f, "CP1 FCR0 0x%08x  FCR31 0x%08x  SR.FR %d  fp_status 0x%02x\n",
-                env->active_fpu.fcr0, env->active_fpu.fcr31, is_fpu64,
-                get_float_exception_flags(&env->active_fpu.fp_status));
+    qemu_fprintf(f,
+                 "CP1 FCR0 0x%08x  FCR31 0x%08x  SR.FR %d  fp_status 0x%02x\n",
+                 env->active_fpu.fcr0, env->active_fpu.fcr31, is_fpu64,
+                 get_float_exception_flags(&env->active_fpu.fp_status));
     for (i = 0; i < 32; (is_fpu64) ? i++ : (i += 2)) {
-        fpu_fprintf(f, "%3s: ", fregnames[i]);
+        qemu_fprintf(f, "%3s: ", fregnames[i]);
         printfpr(&env->active_fpu.fpr[i]);
     }
 
 #undef printfpr
 }
 
-void mips_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                         int flags)
+void mips_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     MIPSCPU *cpu = MIPS_CPU(cs);
     CPUMIPSState *env = &cpu->env;
     int i;
 
-    cpu_fprintf(f, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx
-                " LO=0x" TARGET_FMT_lx " ds %04x "
-                TARGET_FMT_lx " " TARGET_FMT_ld "\n",
-                env->active_tc.PC, env->active_tc.HI[0], env->active_tc.LO[0],
-                env->hflags, env->btarget, env->bcond);
+    qemu_fprintf(f, "pc=0x" TARGET_FMT_lx " HI=0x" TARGET_FMT_lx
+                 " LO=0x" TARGET_FMT_lx " ds %04x "
+                 TARGET_FMT_lx " " TARGET_FMT_ld "\n",
+                 env->active_tc.PC, env->active_tc.HI[0], env->active_tc.LO[0],
+                 env->hflags, env->btarget, env->bcond);
     for (i = 0; i < 32; i++) {
         if ((i & 3) == 0)
-            cpu_fprintf(f, "GPR%02d:", i);
-        cpu_fprintf(f, " %s " TARGET_FMT_lx, regnames[i], env->active_tc.gpr[i]);
+            qemu_fprintf(f, "GPR%02d:", i);
+        qemu_fprintf(f, " %s " TARGET_FMT_lx,
+                     regnames[i], env->active_tc.gpr[i]);
         if ((i & 3) == 3)
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
     }
 
-    cpu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",
-                env->CP0_Status, env->CP0_Cause, env->CP0_EPC);
-    cpu_fprintf(f, "    Config0 0x%08x Config1 0x%08x LLAddr 0x%016"
-                PRIx64 "\n",
-                env->CP0_Config0, env->CP0_Config1, env->CP0_LLAddr);
-    cpu_fprintf(f, "    Config2 0x%08x Config3 0x%08x\n",
-                env->CP0_Config2, env->CP0_Config3);
-    cpu_fprintf(f, "    Config4 0x%08x Config5 0x%08x\n",
-                env->CP0_Config4, env->CP0_Config5);
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",
+                 env->CP0_Status, env->CP0_Cause, env->CP0_EPC);
+    qemu_fprintf(f, "    Config0 0x%08x Config1 0x%08x LLAddr 0x%016"
+                 PRIx64 "\n",
+                 env->CP0_Config0, env->CP0_Config1, env->CP0_LLAddr);
+    qemu_fprintf(f, "    Config2 0x%08x Config3 0x%08x\n",
+                 env->CP0_Config2, env->CP0_Config3);
+    qemu_fprintf(f, "    Config4 0x%08x Config5 0x%08x\n",
+                 env->CP0_Config4, env->CP0_Config5);
     if ((flags & CPU_DUMP_FPU) && (env->hflags & MIPS_HFLAG_FPU)) {
-        fpu_dump_state(env, f, cpu_fprintf, flags);
+        fpu_dump_state(env, f, flags);
     }
 }
 
diff --git a/target/moxie/cpu.h b/target/moxie/cpu.h
index 080df4ee6f..f3b6d83ae7 100644
--- a/target/moxie/cpu.h
+++ b/target/moxie/cpu.h
@@ -112,8 +112,7 @@ static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env)
 #define ENV_OFFSET offsetof(MoxieCPU, env)
 
 void moxie_cpu_do_interrupt(CPUState *cs);
-void moxie_cpu_dump_state(CPUState *cpu, FILE *f,
-                          fprintf_function cpu_fprintf, int flags);
+void moxie_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr moxie_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 void moxie_translate_init(void);
 int cpu_moxie_signal_handler(int host_signum, void *pinfo,
diff --git a/target/moxie/helper.c b/target/moxie/helper.c
index f3d8ee7d6b..287a45232c 100644
--- a/target/moxie/helper.c
+++ b/target/moxie/helper.c
@@ -101,7 +101,7 @@ int moxie_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size,
 
     cs->exception_index = 0xaa;
     cpu->env.debug1 = address;
-    cpu_dump_state(cs, stderr, fprintf, 0);
+    cpu_dump_state(cs, stderr, 0);
     return 1;
 }
 
diff --git a/target/moxie/translate.c b/target/moxie/translate.c
index 68ca223e22..dd055c4ca5 100644
--- a/target/moxie/translate.c
+++ b/target/moxie/translate.c
@@ -28,6 +28,7 @@
 #include "disas/disas.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
+#include "qemu/qemu-print.h"
 
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
@@ -69,24 +70,23 @@ static int extract_branch_offset(int opcode)
   return (((signed short)((opcode & ((1 << 10) - 1)) << 6)) >> 6) << 1;
 }
 
-void moxie_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                          int flags)
+void moxie_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     MoxieCPU *cpu = MOXIE_CPU(cs);
     CPUMoxieState *env = &cpu->env;
     int i;
-    cpu_fprintf(f, "pc=0x%08x\n", env->pc);
-    cpu_fprintf(f, "$fp=0x%08x $sp=0x%08x $r0=0x%08x $r1=0x%08x\n",
-                env->gregs[0], env->gregs[1], env->gregs[2], env->gregs[3]);
+    qemu_fprintf(f, "pc=0x%08x\n", env->pc);
+    qemu_fprintf(f, "$fp=0x%08x $sp=0x%08x $r0=0x%08x $r1=0x%08x\n",
+                 env->gregs[0], env->gregs[1], env->gregs[2], env->gregs[3]);
     for (i = 4; i < 16; i += 4) {
-        cpu_fprintf(f, "$r%d=0x%08x $r%d=0x%08x $r%d=0x%08x $r%d=0x%08x\n",
-                    i-2, env->gregs[i], i-1, env->gregs[i + 1],
-                    i, env->gregs[i + 2], i+1, env->gregs[i + 3]);
+        qemu_fprintf(f, "$r%d=0x%08x $r%d=0x%08x $r%d=0x%08x $r%d=0x%08x\n",
+                     i - 2, env->gregs[i], i - 1, env->gregs[i + 1],
+                     i, env->gregs[i + 2], i + 1, env->gregs[i + 3]);
     }
     for (i = 4; i < 16; i += 4) {
-        cpu_fprintf(f, "sr%d=0x%08x sr%d=0x%08x sr%d=0x%08x sr%d=0x%08x\n",
-                    i-2, env->sregs[i], i-1, env->sregs[i + 1],
-                    i, env->sregs[i + 2], i+1, env->sregs[i + 3]);
+        qemu_fprintf(f, "sr%d=0x%08x sr%d=0x%08x sr%d=0x%08x sr%d=0x%08x\n",
+                     i - 2, env->sregs[i], i - 1, env->sregs[i + 1],
+                     i, env->sregs[i + 2], i + 1, env->sregs[i + 3]);
     }
 }
 
diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h
index 6fa993bb0d..4e8eb7d2ca 100644
--- a/target/nios2/cpu.h
+++ b/target/nios2/cpu.h
@@ -213,8 +213,7 @@ void nios2_tcg_init(void);
 void nios2_cpu_do_interrupt(CPUState *cs);
 int cpu_nios2_signal_handler(int host_signum, void *pinfo, void *puc);
 void dump_mmu(CPUNios2State *env);
-void nios2_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                          int flags);
+void nios2_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr nios2_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
                                    MMUAccessType access_type,
diff --git a/target/nios2/helper.c b/target/nios2/helper.c
index a8b8ec662a..a633fa03ee 100644
--- a/target/nios2/helper.c
+++ b/target/nios2/helper.c
@@ -42,7 +42,7 @@ int nios2_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int size,
     cs->exception_index = 0xaa;
     /* Page 0x1000 is kuser helper */
     if (address < 0x1000 || address >= 0x2000) {
-        cpu_dump_state(cs, stderr, fprintf, 0);
+        cpu_dump_state(cs, stderr, 0);
     }
     return 1;
 }
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index 7fa03ed05a..f0bbf78a32 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -31,6 +31,7 @@
 #include "exec/log.h"
 #include "exec/cpu_ldst.h"
 #include "exec/translator.h"
+#include "qemu/qemu-print.h"
 
 /* is_jmp field values */
 #define DISAS_JUMP    DISAS_TARGET_0 /* only pc was modified dynamically */
@@ -914,33 +915,32 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb)
 #endif
 }
 
-void nios2_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                          int flags)
+void nios2_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     Nios2CPU *cpu = NIOS2_CPU(cs);
     CPUNios2State *env = &cpu->env;
     int i;
 
-    if (!env || !f) {
+    if (!env) {
         return;
     }
 
-    cpu_fprintf(f, "IN: PC=%x %s\n",
-                env->regs[R_PC], lookup_symbol(env->regs[R_PC]));
+    qemu_fprintf(f, "IN: PC=%x %s\n",
+                 env->regs[R_PC], lookup_symbol(env->regs[R_PC]));
 
     for (i = 0; i < NUM_CORE_REGS; i++) {
-        cpu_fprintf(f, "%9s=%8.8x ", regnames[i], env->regs[i]);
+        qemu_fprintf(f, "%9s=%8.8x ", regnames[i], env->regs[i]);
         if ((i + 1) % 4 == 0) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         }
     }
 #if !defined(CONFIG_USER_ONLY)
-    cpu_fprintf(f, " mmu write: VPN=%05X PID %02X TLBACC %08X\n",
-                env->mmu.pteaddr_wr & CR_PTEADDR_VPN_MASK,
-                (env->mmu.tlbmisc_wr & CR_TLBMISC_PID_MASK) >> 4,
-                env->mmu.tlbacc_wr);
+    qemu_fprintf(f, " mmu write: VPN=%05X PID %02X TLBACC %08X\n",
+                 env->mmu.pteaddr_wr & CR_PTEADDR_VPN_MASK,
+                 (env->mmu.tlbmisc_wr & CR_TLBMISC_PID_MASK) >> 4,
+                 env->mmu.tlbacc_wr);
 #endif
-    cpu_fprintf(f, "\n\n");
+    qemu_fprintf(f, "\n\n");
 }
 
 void nios2_tcg_init(void)
diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h
index 9d2d49631e..a50861955a 100644
--- a/target/openrisc/cpu.h
+++ b/target/openrisc/cpu.h
@@ -339,8 +339,7 @@ static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)
 void cpu_openrisc_list(void);
 void openrisc_cpu_do_interrupt(CPUState *cpu);
 bool openrisc_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void openrisc_cpu_dump_state(CPUState *cpu, FILE *f,
-                             fprintf_function cpu_fprintf, int flags);
+void openrisc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr openrisc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int openrisc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int openrisc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
index 89680f882d..a88502fdc1 100644
--- a/target/openrisc/translate.c
+++ b/target/openrisc/translate.c
@@ -26,6 +26,7 @@
 #include "qemu-common.h"
 #include "qemu/log.h"
 #include "qemu/bitops.h"
+#include "qemu/qemu-print.h"
 #include "exec/cpu_ldst.h"
 #include "exec/translator.h"
 
@@ -1415,18 +1416,16 @@ void gen_intermediate_code(CPUState *cs, struct TranslationBlock *tb)
     translator_loop(&openrisc_tr_ops, &ctx.base, cs, tb);
 }
 
-void openrisc_cpu_dump_state(CPUState *cs, FILE *f,
-                             fprintf_function cpu_fprintf,
-                             int flags)
+void openrisc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     OpenRISCCPU *cpu = OPENRISC_CPU(cs);
     CPUOpenRISCState *env = &cpu->env;
     int i;
 
-    cpu_fprintf(f, "PC=%08x\n", env->pc);
+    qemu_fprintf(f, "PC=%08x\n", env->pc);
     for (i = 0; i < 32; ++i) {
-        cpu_fprintf(f, "R%02d=%08x%c", i, cpu_get_gpr(env, i),
-                    (i % 4) == 3 ? '\n' : ' ');
+        qemu_fprintf(f, "R%02d=%08x%c", i, cpu_get_gpr(env, i),
+                     (i % 4) == 3 ? '\n' : ' ');
     }
 }
 
diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index 27a36b9605..d5259f7dd3 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1268,8 +1268,7 @@ struct PPCVirtualHypervisorClass {
 
 void ppc_cpu_do_interrupt(CPUState *cpu);
 bool ppc_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void ppc_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                        int flags);
+void ppc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 void ppc_cpu_dump_statistics(CPUState *cpu, int flags);
 hwaddr ppc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int ppc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index f99f27a134..93d77a2626 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -7414,8 +7414,7 @@ GEN_HANDLER2_E(trechkpt, "trechkpt", 0x1F, 0x0E, 0x1F, 0x03FFF800, \
 
 /*****************************************************************************/
 /* Misc PowerPC helpers */
-void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                        int flags)
+void ppc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
 #define RGPL  4
 #define RFPL  4
@@ -7424,37 +7423,37 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
     CPUPPCState *env = &cpu->env;
     int i;
 
-    cpu_fprintf(f, "NIP " TARGET_FMT_lx "   LR " TARGET_FMT_lx " CTR "
-                TARGET_FMT_lx " XER " TARGET_FMT_lx " CPU#%d\n",
-                env->nip, env->lr, env->ctr, cpu_read_xer(env),
-                cs->cpu_index);
-    cpu_fprintf(f, "MSR " TARGET_FMT_lx " HID0 " TARGET_FMT_lx "  HF "
-                TARGET_FMT_lx " iidx %d didx %d\n",
-                env->msr, env->spr[SPR_HID0],
-                env->hflags, env->immu_idx, env->dmmu_idx);
+    qemu_fprintf(f, "NIP " TARGET_FMT_lx "   LR " TARGET_FMT_lx " CTR "
+                 TARGET_FMT_lx " XER " TARGET_FMT_lx " CPU#%d\n",
+                 env->nip, env->lr, env->ctr, cpu_read_xer(env),
+                 cs->cpu_index);
+    qemu_fprintf(f, "MSR " TARGET_FMT_lx " HID0 " TARGET_FMT_lx "  HF "
+                 TARGET_FMT_lx " iidx %d didx %d\n",
+                 env->msr, env->spr[SPR_HID0],
+                 env->hflags, env->immu_idx, env->dmmu_idx);
 #if !defined(NO_TIMER_DUMP)
-    cpu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64
+    qemu_fprintf(f, "TB %08" PRIu32 " %08" PRIu64
 #if !defined(CONFIG_USER_ONLY)
-                " DECR " TARGET_FMT_lu
+                 " DECR " TARGET_FMT_lu
 #endif
-                "\n",
-                cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env)
+                 "\n",
+                 cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env)
 #if !defined(CONFIG_USER_ONLY)
-                , cpu_ppc_load_decr(env)
+                 , cpu_ppc_load_decr(env)
 #endif
-                );
+        );
 #endif
     for (i = 0; i < 32; i++) {
         if ((i & (RGPL - 1)) == 0)
-            cpu_fprintf(f, "GPR%02d", i);
-        cpu_fprintf(f, " %016" PRIx64, ppc_dump_gpr(env, i));
+            qemu_fprintf(f, "GPR%02d", i);
+        qemu_fprintf(f, " %016" PRIx64, ppc_dump_gpr(env, i));
         if ((i & (RGPL - 1)) == (RGPL - 1))
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
     }
-    cpu_fprintf(f, "CR ");
+    qemu_fprintf(f, "CR ");
     for (i = 0; i < 8; i++)
-        cpu_fprintf(f, "%01x", env->crf[i]);
-    cpu_fprintf(f, "  [");
+        qemu_fprintf(f, "%01x", env->crf[i]);
+    qemu_fprintf(f, "  [");
     for (i = 0; i < 8; i++) {
         char a = '-';
         if (env->crf[i] & 0x08)
@@ -7463,74 +7462,74 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
             a = 'G';
         else if (env->crf[i] & 0x02)
             a = 'E';
-        cpu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' ');
+        qemu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' ');
     }
-    cpu_fprintf(f, " ]             RES " TARGET_FMT_lx "\n",
-                env->reserve_addr);
+    qemu_fprintf(f, " ]             RES " TARGET_FMT_lx "\n",
+                 env->reserve_addr);
 
     if (flags & CPU_DUMP_FPU) {
         for (i = 0; i < 32; i++) {
             if ((i & (RFPL - 1)) == 0) {
-                cpu_fprintf(f, "FPR%02d", i);
+                qemu_fprintf(f, "FPR%02d", i);
             }
-            cpu_fprintf(f, " %016" PRIx64, *cpu_fpr_ptr(env, i));
+            qemu_fprintf(f, " %016" PRIx64, *cpu_fpr_ptr(env, i));
             if ((i & (RFPL - 1)) == (RFPL - 1)) {
-                cpu_fprintf(f, "\n");
+                qemu_fprintf(f, "\n");
             }
         }
-        cpu_fprintf(f, "FPSCR " TARGET_FMT_lx "\n", env->fpscr);
+        qemu_fprintf(f, "FPSCR " TARGET_FMT_lx "\n", env->fpscr);
     }
 
 #if !defined(CONFIG_USER_ONLY)
-    cpu_fprintf(f, " SRR0 " TARGET_FMT_lx "  SRR1 " TARGET_FMT_lx
-                   "    PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n",
-                env->spr[SPR_SRR0], env->spr[SPR_SRR1],
-                env->spr[SPR_PVR], env->spr[SPR_VRSAVE]);
+    qemu_fprintf(f, " SRR0 " TARGET_FMT_lx "  SRR1 " TARGET_FMT_lx
+                 "    PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n",
+                 env->spr[SPR_SRR0], env->spr[SPR_SRR1],
+                 env->spr[SPR_PVR], env->spr[SPR_VRSAVE]);
 
-    cpu_fprintf(f, "SPRG0 " TARGET_FMT_lx " SPRG1 " TARGET_FMT_lx
-                   "  SPRG2 " TARGET_FMT_lx "  SPRG3 " TARGET_FMT_lx "\n",
-                env->spr[SPR_SPRG0], env->spr[SPR_SPRG1],
-                env->spr[SPR_SPRG2], env->spr[SPR_SPRG3]);
+    qemu_fprintf(f, "SPRG0 " TARGET_FMT_lx " SPRG1 " TARGET_FMT_lx
+                 "  SPRG2 " TARGET_FMT_lx "  SPRG3 " TARGET_FMT_lx "\n",
+                 env->spr[SPR_SPRG0], env->spr[SPR_SPRG1],
+                 env->spr[SPR_SPRG2], env->spr[SPR_SPRG3]);
 
-    cpu_fprintf(f, "SPRG4 " TARGET_FMT_lx " SPRG5 " TARGET_FMT_lx
-                   "  SPRG6 " TARGET_FMT_lx "  SPRG7 " TARGET_FMT_lx "\n",
-                env->spr[SPR_SPRG4], env->spr[SPR_SPRG5],
-                env->spr[SPR_SPRG6], env->spr[SPR_SPRG7]);
+    qemu_fprintf(f, "SPRG4 " TARGET_FMT_lx " SPRG5 " TARGET_FMT_lx
+                 "  SPRG6 " TARGET_FMT_lx "  SPRG7 " TARGET_FMT_lx "\n",
+                 env->spr[SPR_SPRG4], env->spr[SPR_SPRG5],
+                 env->spr[SPR_SPRG6], env->spr[SPR_SPRG7]);
 
 #if defined(TARGET_PPC64)
     if (env->excp_model == POWERPC_EXCP_POWER7 ||
         env->excp_model == POWERPC_EXCP_POWER8 ||
         env->excp_model == POWERPC_EXCP_POWER9)  {
-        cpu_fprintf(f, "HSRR0 " TARGET_FMT_lx " HSRR1 " TARGET_FMT_lx "\n",
-                    env->spr[SPR_HSRR0], env->spr[SPR_HSRR1]);
+        qemu_fprintf(f, "HSRR0 " TARGET_FMT_lx " HSRR1 " TARGET_FMT_lx "\n",
+                     env->spr[SPR_HSRR0], env->spr[SPR_HSRR1]);
     }
 #endif
     if (env->excp_model == POWERPC_EXCP_BOOKE) {
-        cpu_fprintf(f, "CSRR0 " TARGET_FMT_lx " CSRR1 " TARGET_FMT_lx
-                       " MCSRR0 " TARGET_FMT_lx " MCSRR1 " TARGET_FMT_lx "\n",
-                    env->spr[SPR_BOOKE_CSRR0], env->spr[SPR_BOOKE_CSRR1],
-                    env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]);
+        qemu_fprintf(f, "CSRR0 " TARGET_FMT_lx " CSRR1 " TARGET_FMT_lx
+                     " MCSRR0 " TARGET_FMT_lx " MCSRR1 " TARGET_FMT_lx "\n",
+                     env->spr[SPR_BOOKE_CSRR0], env->spr[SPR_BOOKE_CSRR1],
+                     env->spr[SPR_BOOKE_MCSRR0], env->spr[SPR_BOOKE_MCSRR1]);
 
-        cpu_fprintf(f, "  TCR " TARGET_FMT_lx "   TSR " TARGET_FMT_lx
-                       "    ESR " TARGET_FMT_lx "   DEAR " TARGET_FMT_lx "\n",
-                    env->spr[SPR_BOOKE_TCR], env->spr[SPR_BOOKE_TSR],
-                    env->spr[SPR_BOOKE_ESR], env->spr[SPR_BOOKE_DEAR]);
+        qemu_fprintf(f, "  TCR " TARGET_FMT_lx "   TSR " TARGET_FMT_lx
+                     "    ESR " TARGET_FMT_lx "   DEAR " TARGET_FMT_lx "\n",
+                     env->spr[SPR_BOOKE_TCR], env->spr[SPR_BOOKE_TSR],
+                     env->spr[SPR_BOOKE_ESR], env->spr[SPR_BOOKE_DEAR]);
 
-        cpu_fprintf(f, "  PIR " TARGET_FMT_lx " DECAR " TARGET_FMT_lx
-                       "   IVPR " TARGET_FMT_lx "   EPCR " TARGET_FMT_lx "\n",
-                    env->spr[SPR_BOOKE_PIR], env->spr[SPR_BOOKE_DECAR],
-                    env->spr[SPR_BOOKE_IVPR], env->spr[SPR_BOOKE_EPCR]);
+        qemu_fprintf(f, "  PIR " TARGET_FMT_lx " DECAR " TARGET_FMT_lx
+                     "   IVPR " TARGET_FMT_lx "   EPCR " TARGET_FMT_lx "\n",
+                     env->spr[SPR_BOOKE_PIR], env->spr[SPR_BOOKE_DECAR],
+                     env->spr[SPR_BOOKE_IVPR], env->spr[SPR_BOOKE_EPCR]);
 
-        cpu_fprintf(f, " MCSR " TARGET_FMT_lx " SPRG8 " TARGET_FMT_lx
-                       "    EPR " TARGET_FMT_lx "\n",
-                    env->spr[SPR_BOOKE_MCSR], env->spr[SPR_BOOKE_SPRG8],
-                    env->spr[SPR_BOOKE_EPR]);
+        qemu_fprintf(f, " MCSR " TARGET_FMT_lx " SPRG8 " TARGET_FMT_lx
+                     "    EPR " TARGET_FMT_lx "\n",
+                     env->spr[SPR_BOOKE_MCSR], env->spr[SPR_BOOKE_SPRG8],
+                     env->spr[SPR_BOOKE_EPR]);
 
         /* FSL-specific */
-        cpu_fprintf(f, " MCAR " TARGET_FMT_lx "  PID1 " TARGET_FMT_lx
-                       "   PID2 " TARGET_FMT_lx "    SVR " TARGET_FMT_lx "\n",
-                    env->spr[SPR_Exxx_MCAR], env->spr[SPR_BOOKE_PID1],
-                    env->spr[SPR_BOOKE_PID2], env->spr[SPR_E500_SVR]);
+        qemu_fprintf(f, " MCAR " TARGET_FMT_lx "  PID1 " TARGET_FMT_lx
+                     "   PID2 " TARGET_FMT_lx "    SVR " TARGET_FMT_lx "\n",
+                     env->spr[SPR_Exxx_MCAR], env->spr[SPR_BOOKE_PID1],
+                     env->spr[SPR_BOOKE_PID2], env->spr[SPR_E500_SVR]);
 
         /*
          * IVORs are left out as they are large and do not change often --
@@ -7540,12 +7539,12 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
 
 #if defined(TARGET_PPC64)
     if (env->flags & POWERPC_FLAG_CFAR) {
-        cpu_fprintf(f, " CFAR " TARGET_FMT_lx"\n", env->cfar);
+        qemu_fprintf(f, " CFAR " TARGET_FMT_lx"\n", env->cfar);
     }
 #endif
 
     if (env->spr_cb[SPR_LPCR].name)
-        cpu_fprintf(f, " LPCR " TARGET_FMT_lx "\n", env->spr[SPR_LPCR]);
+        qemu_fprintf(f, " LPCR " TARGET_FMT_lx "\n", env->spr[SPR_LPCR]);
 
     switch (env->mmu_model) {
     case POWERPC_MMU_32B:
@@ -7560,29 +7559,29 @@ void ppc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
     case POWERPC_MMU_3_00:
 #endif
         if (env->spr_cb[SPR_SDR1].name) { /* SDR1 Exists */
-            cpu_fprintf(f, " SDR1 " TARGET_FMT_lx " ", env->spr[SPR_SDR1]);
+            qemu_fprintf(f, " SDR1 " TARGET_FMT_lx " ", env->spr[SPR_SDR1]);
         }
         if (env->spr_cb[SPR_PTCR].name) { /* PTCR Exists */
-            cpu_fprintf(f, " PTCR " TARGET_FMT_lx " ", env->spr[SPR_PTCR]);
+            qemu_fprintf(f, " PTCR " TARGET_FMT_lx " ", env->spr[SPR_PTCR]);
         }
-        cpu_fprintf(f, "  DAR " TARGET_FMT_lx "  DSISR " TARGET_FMT_lx "\n",
-                    env->spr[SPR_DAR], env->spr[SPR_DSISR]);
+        qemu_fprintf(f, "  DAR " TARGET_FMT_lx "  DSISR " TARGET_FMT_lx "\n",
+                     env->spr[SPR_DAR], env->spr[SPR_DSISR]);
         break;
     case POWERPC_MMU_BOOKE206:
-        cpu_fprintf(f, " MAS0 " TARGET_FMT_lx "  MAS1 " TARGET_FMT_lx
-                       "   MAS2 " TARGET_FMT_lx "   MAS3 " TARGET_FMT_lx "\n",
-                    env->spr[SPR_BOOKE_MAS0], env->spr[SPR_BOOKE_MAS1],
-                    env->spr[SPR_BOOKE_MAS2], env->spr[SPR_BOOKE_MAS3]);
+        qemu_fprintf(f, " MAS0 " TARGET_FMT_lx "  MAS1 " TARGET_FMT_lx
+                     "   MAS2 " TARGET_FMT_lx "   MAS3 " TARGET_FMT_lx "\n",
+                     env->spr[SPR_BOOKE_MAS0], env->spr[SPR_BOOKE_MAS1],
+                     env->spr[SPR_BOOKE_MAS2], env->spr[SPR_BOOKE_MAS3]);
 
-        cpu_fprintf(f, " MAS4 " TARGET_FMT_lx "  MAS6 " TARGET_FMT_lx
-                       "   MAS7 " TARGET_FMT_lx "    PID " TARGET_FMT_lx "\n",
-                    env->spr[SPR_BOOKE_MAS4], env->spr[SPR_BOOKE_MAS6],
-                    env->spr[SPR_BOOKE_MAS7], env->spr[SPR_BOOKE_PID]);
+        qemu_fprintf(f, " MAS4 " TARGET_FMT_lx "  MAS6 " TARGET_FMT_lx
+                     "   MAS7 " TARGET_FMT_lx "    PID " TARGET_FMT_lx "\n",
+                     env->spr[SPR_BOOKE_MAS4], env->spr[SPR_BOOKE_MAS6],
+                     env->spr[SPR_BOOKE_MAS7], env->spr[SPR_BOOKE_PID]);
 
-        cpu_fprintf(f, "MMUCFG " TARGET_FMT_lx " TLB0CFG " TARGET_FMT_lx
-                       " TLB1CFG " TARGET_FMT_lx "\n",
-                    env->spr[SPR_MMUCFG], env->spr[SPR_BOOKE_TLB0CFG],
-                    env->spr[SPR_BOOKE_TLB1CFG]);
+        qemu_fprintf(f, "MMUCFG " TARGET_FMT_lx " TLB0CFG " TARGET_FMT_lx
+                     " TLB1CFG " TARGET_FMT_lx "\n",
+                     env->spr[SPR_MMUCFG], env->spr[SPR_BOOKE_TLB0CFG],
+                     env->spr[SPR_BOOKE_TLB1CFG]);
         break;
     default:
         break;
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 104e676ab0..1bcf4eaeb8 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -194,40 +194,39 @@ static ObjectClass *riscv_cpu_class_by_name(const char *cpu_model)
     return oc;
 }
 
-static void riscv_cpu_dump_state(CPUState *cs, FILE *f,
-    fprintf_function cpu_fprintf, int flags)
+static void riscv_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     RISCVCPU *cpu = RISCV_CPU(cs);
     CPURISCVState *env = &cpu->env;
     int i;
 
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "pc      ", env->pc);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "pc      ", env->pc);
 #ifndef CONFIG_USER_ONLY
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mhartid ", env->mhartid);
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mstatus ", env->mstatus);
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mip     ",
-        (target_ulong)atomic_read(&env->mip));
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mie     ", env->mie);
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mideleg ", env->mideleg);
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "medeleg ", env->medeleg);
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mtvec   ", env->mtvec);
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mepc    ", env->mepc);
-    cpu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mcause  ", env->mcause);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mhartid ", env->mhartid);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mstatus ", env->mstatus);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mip     ",
+                 (target_ulong)atomic_read(&env->mip));
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mie     ", env->mie);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mideleg ", env->mideleg);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "medeleg ", env->medeleg);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mtvec   ", env->mtvec);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mepc    ", env->mepc);
+    qemu_fprintf(f, " %s " TARGET_FMT_lx "\n", "mcause  ", env->mcause);
 #endif
 
     for (i = 0; i < 32; i++) {
-        cpu_fprintf(f, " %s " TARGET_FMT_lx,
-            riscv_int_regnames[i], env->gpr[i]);
+        qemu_fprintf(f, " %s " TARGET_FMT_lx,
+                     riscv_int_regnames[i], env->gpr[i]);
         if ((i & 3) == 3) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         }
     }
     if (flags & CPU_DUMP_FPU) {
         for (i = 0; i < 32; i++) {
-            cpu_fprintf(f, " %s %016" PRIx64,
-                riscv_fpr_regnames[i], env->fpr[i]);
+            qemu_fprintf(f, " %s %016" PRIx64,
+                         riscv_fpr_regnames[i], env->fpr[i]);
             if ((i & 3) == 3) {
-                cpu_fprintf(f, "\n");
+                qemu_fprintf(f, "\n");
             }
         }
     }
diff --git a/target/s390x/helper.c b/target/s390x/helper.c
index 8e9573221c..f957a2c830 100644
--- a/target/s390x/helper.c
+++ b/target/s390x/helper.c
@@ -23,6 +23,7 @@
 #include "internal.h"
 #include "exec/gdbstub.h"
 #include "qemu/timer.h"
+#include "qemu/qemu-print.h"
 #include "hw/s390x/ioinst.h"
 #include "sysemu/hw_accel.h"
 #ifndef CONFIG_USER_ONLY
@@ -313,65 +314,64 @@ int s390_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len)
 }
 #endif /* CONFIG_USER_ONLY */
 
-void s390_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                         int flags)
+void s390_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     S390CPU *cpu = S390_CPU(cs);
     CPUS390XState *env = &cpu->env;
     int i;
 
     if (env->cc_op > 3) {
-        cpu_fprintf(f, "PSW=mask %016" PRIx64 " addr %016" PRIx64 " cc %15s\n",
-                    env->psw.mask, env->psw.addr, cc_name(env->cc_op));
+        qemu_fprintf(f, "PSW=mask %016" PRIx64 " addr %016" PRIx64 " cc %15s\n",
+                     env->psw.mask, env->psw.addr, cc_name(env->cc_op));
     } else {
-        cpu_fprintf(f, "PSW=mask %016" PRIx64 " addr %016" PRIx64 " cc %02x\n",
-                    env->psw.mask, env->psw.addr, env->cc_op);
+        qemu_fprintf(f, "PSW=mask %016" PRIx64 " addr %016" PRIx64 " cc %02x\n",
+                     env->psw.mask, env->psw.addr, env->cc_op);
     }
 
     for (i = 0; i < 16; i++) {
-        cpu_fprintf(f, "R%02d=%016" PRIx64, i, env->regs[i]);
+        qemu_fprintf(f, "R%02d=%016" PRIx64, i, env->regs[i]);
         if ((i % 4) == 3) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         } else {
-            cpu_fprintf(f, " ");
+            qemu_fprintf(f, " ");
         }
     }
 
     if (flags & CPU_DUMP_FPU) {
         if (s390_has_feat(S390_FEAT_VECTOR)) {
             for (i = 0; i < 32; i++) {
-                cpu_fprintf(f, "V%02d=%016" PRIx64 "%016" PRIx64 "%c",
-                            i, env->vregs[i][0].ll, env->vregs[i][1].ll,
-                            i % 2 ? '\n' : ' ');
+                qemu_fprintf(f, "V%02d=%016" PRIx64 "%016" PRIx64 "%c",
+                             i, env->vregs[i][0].ll, env->vregs[i][1].ll,
+                             i % 2 ? '\n' : ' ');
             }
         } else {
             for (i = 0; i < 16; i++) {
-                cpu_fprintf(f, "F%02d=%016" PRIx64 "%c",
-                            i, get_freg(env, i)->ll,
-                            (i % 4) == 3 ? '\n' : ' ');
+                qemu_fprintf(f, "F%02d=%016" PRIx64 "%c",
+                             i, get_freg(env, i)->ll,
+                             (i % 4) == 3 ? '\n' : ' ');
             }
         }
     }
 
 #ifndef CONFIG_USER_ONLY
     for (i = 0; i < 16; i++) {
-        cpu_fprintf(f, "C%02d=%016" PRIx64, i, env->cregs[i]);
+        qemu_fprintf(f, "C%02d=%016" PRIx64, i, env->cregs[i]);
         if ((i % 4) == 3) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         } else {
-            cpu_fprintf(f, " ");
+            qemu_fprintf(f, " ");
         }
     }
 #endif
 
 #ifdef DEBUG_INLINE_BRANCHES
     for (i = 0; i < CC_OP_MAX; i++) {
-        cpu_fprintf(f, "  %15s = %10ld\t%10ld\n", cc_name(i),
-                    inline_branch_miss[i], inline_branch_hit[i]);
+        qemu_fprintf(f, "  %15s = %10ld\t%10ld\n", cc_name(i),
+                     inline_branch_miss[i], inline_branch_hit[i]);
     }
 #endif
 
-    cpu_fprintf(f, "\n");
+    qemu_fprintf(f, "\n");
 }
 
 const char *cc_name(enum cc_op cc_op)
diff --git a/target/s390x/internal.h b/target/s390x/internal.h
index 3b4855c175..26575f2130 100644
--- a/target/s390x/internal.h
+++ b/target/s390x/internal.h
@@ -292,8 +292,7 @@ void s390_cpu_gdb_init(CPUState *cs);
 
 
 /* helper.c */
-void s390_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
-                         int flags);
+void s390_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr s390_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 hwaddr s390_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr);
 uint64_t get_psw_mask(CPUS390XState *env);
diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h
index 3e43f0a1a5..84b08ff640 100644
--- a/target/sh4/cpu.h
+++ b/target/sh4/cpu.h
@@ -232,8 +232,7 @@ static inline SuperHCPU *sh_env_get_cpu(CPUSH4State *env)
 
 void superh_cpu_do_interrupt(CPUState *cpu);
 bool superh_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void superh_cpu_dump_state(CPUState *cpu, FILE *f,
-                           fprintf_function cpu_fprintf, int flags);
+void superh_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr superh_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int superh_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int superh_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index ab254b0e8d..cffc6919d0 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -30,6 +30,7 @@
 #include "exec/translator.h"
 #include "trace-tcg.h"
 #include "exec/log.h"
+#include "qemu/qemu-print.h"
 
 
 typedef struct DisasContext {
@@ -156,32 +157,32 @@ void sh4_translate_init(void)
                                               fregnames[i]);
 }
 
-void superh_cpu_dump_state(CPUState *cs, FILE *f,
-                           fprintf_function cpu_fprintf, int flags)
+void superh_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     SuperHCPU *cpu = SUPERH_CPU(cs);
     CPUSH4State *env = &cpu->env;
     int i;
-    cpu_fprintf(f, "pc=0x%08x sr=0x%08x pr=0x%08x fpscr=0x%08x\n",
-                env->pc, cpu_read_sr(env), env->pr, env->fpscr);
-    cpu_fprintf(f, "spc=0x%08x ssr=0x%08x gbr=0x%08x vbr=0x%08x\n",
-		env->spc, env->ssr, env->gbr, env->vbr);
-    cpu_fprintf(f, "sgr=0x%08x dbr=0x%08x delayed_pc=0x%08x fpul=0x%08x\n",
-		env->sgr, env->dbr, env->delayed_pc, env->fpul);
+
+    qemu_fprintf(f, "pc=0x%08x sr=0x%08x pr=0x%08x fpscr=0x%08x\n",
+                 env->pc, cpu_read_sr(env), env->pr, env->fpscr);
+    qemu_fprintf(f, "spc=0x%08x ssr=0x%08x gbr=0x%08x vbr=0x%08x\n",
+                 env->spc, env->ssr, env->gbr, env->vbr);
+    qemu_fprintf(f, "sgr=0x%08x dbr=0x%08x delayed_pc=0x%08x fpul=0x%08x\n",
+                 env->sgr, env->dbr, env->delayed_pc, env->fpul);
     for (i = 0; i < 24; i += 4) {
-	cpu_fprintf(f, "r%d=0x%08x r%d=0x%08x r%d=0x%08x r%d=0x%08x\n",
+        qemu_printf("r%d=0x%08x r%d=0x%08x r%d=0x%08x r%d=0x%08x\n",
 		    i, env->gregs[i], i + 1, env->gregs[i + 1],
 		    i + 2, env->gregs[i + 2], i + 3, env->gregs[i + 3]);
     }
     if (env->flags & DELAY_SLOT) {
-	cpu_fprintf(f, "in delay slot (delayed_pc=0x%08x)\n",
+        qemu_printf("in delay slot (delayed_pc=0x%08x)\n",
 		    env->delayed_pc);
     } else if (env->flags & DELAY_SLOT_CONDITIONAL) {
-	cpu_fprintf(f, "in conditional delay slot (delayed_pc=0x%08x)\n",
+        qemu_printf("in conditional delay slot (delayed_pc=0x%08x)\n",
 		    env->delayed_pc);
     } else if (env->flags & DELAY_SLOT_RTE) {
-        cpu_fprintf(f, "in rte delay slot (delayed_pc=0x%08x)\n",
-                    env->delayed_pc);
+        qemu_fprintf(f, "in rte delay slot (delayed_pc=0x%08x)\n",
+                     env->delayed_pc);
     }
 }
 
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index fd88a31806..4654c2a6a0 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -596,12 +596,11 @@ void sparc_cpu_list(void)
                 "fpu_version mmu_version nwindows\n");
 }
 
-static void cpu_print_cc(FILE *f, fprintf_function cpu_fprintf,
-                         uint32_t cc)
+static void cpu_print_cc(FILE *f, uint32_t cc)
 {
-    cpu_fprintf(f, "%c%c%c%c", cc & PSR_NEG ? 'N' : '-',
-                cc & PSR_ZERO ? 'Z' : '-', cc & PSR_OVF ? 'V' : '-',
-                cc & PSR_CARRY ? 'C' : '-');
+    qemu_fprintf(f, "%c%c%c%c", cc & PSR_NEG ? 'N' : '-',
+                 cc & PSR_ZERO ? 'Z' : '-', cc & PSR_OVF ? 'V' : '-',
+                 cc & PSR_CARRY ? 'C' : '-');
 }
 
 #ifdef TARGET_SPARC64
@@ -610,35 +609,34 @@ static void cpu_print_cc(FILE *f, fprintf_function cpu_fprintf,
 #define REGS_PER_LINE 8
 #endif
 
-void sparc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
-                          int flags)
+void sparc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     SPARCCPU *cpu = SPARC_CPU(cs);
     CPUSPARCState *env = &cpu->env;
     int i, x;
 
-    cpu_fprintf(f, "pc: " TARGET_FMT_lx "  npc: " TARGET_FMT_lx "\n", env->pc,
-                env->npc);
+    qemu_fprintf(f, "pc: " TARGET_FMT_lx "  npc: " TARGET_FMT_lx "\n", env->pc,
+                 env->npc);
 
     for (i = 0; i < 8; i++) {
         if (i % REGS_PER_LINE == 0) {
-            cpu_fprintf(f, "%%g%d-%d:", i, i + REGS_PER_LINE - 1);
+            qemu_fprintf(f, "%%g%d-%d:", i, i + REGS_PER_LINE - 1);
         }
-        cpu_fprintf(f, " " TARGET_FMT_lx, env->gregs[i]);
+        qemu_fprintf(f, " " TARGET_FMT_lx, env->gregs[i]);
         if (i % REGS_PER_LINE == REGS_PER_LINE - 1) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         }
     }
     for (x = 0; x < 3; x++) {
         for (i = 0; i < 8; i++) {
             if (i % REGS_PER_LINE == 0) {
-                cpu_fprintf(f, "%%%c%d-%d: ",
-                            x == 0 ? 'o' : (x == 1 ? 'l' : 'i'),
-                            i, i + REGS_PER_LINE - 1);
+                qemu_fprintf(f, "%%%c%d-%d: ",
+                             x == 0 ? 'o' : (x == 1 ? 'l' : 'i'),
+                             i, i + REGS_PER_LINE - 1);
             }
-            cpu_fprintf(f, TARGET_FMT_lx " ", env->regwptr[i + x * 8]);
+            qemu_fprintf(f, TARGET_FMT_lx " ", env->regwptr[i + x * 8]);
             if (i % REGS_PER_LINE == REGS_PER_LINE - 1) {
-                cpu_fprintf(f, "\n");
+                qemu_fprintf(f, "\n");
             }
         }
     }
@@ -646,42 +644,42 @@ void sparc_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
     if (flags & CPU_DUMP_FPU) {
         for (i = 0; i < TARGET_DPREGS; i++) {
             if ((i & 3) == 0) {
-                cpu_fprintf(f, "%%f%02d: ", i * 2);
+                qemu_fprintf(f, "%%f%02d: ", i * 2);
             }
-            cpu_fprintf(f, " %016" PRIx64, env->fpr[i].ll);
+            qemu_fprintf(f, " %016" PRIx64, env->fpr[i].ll);
             if ((i & 3) == 3) {
-                cpu_fprintf(f, "\n");
+                qemu_fprintf(f, "\n");
             }
         }
     }
 
 #ifdef TARGET_SPARC64
-    cpu_fprintf(f, "pstate: %08x ccr: %02x (icc: ", env->pstate,
-                (unsigned)cpu_get_ccr(env));
-    cpu_print_cc(f, cpu_fprintf, cpu_get_ccr(env) << PSR_CARRY_SHIFT);
-    cpu_fprintf(f, " xcc: ");
-    cpu_print_cc(f, cpu_fprintf, cpu_get_ccr(env) << (PSR_CARRY_SHIFT - 4));
-    cpu_fprintf(f, ") asi: %02x tl: %d pil: %x gl: %d\n", env->asi, env->tl,
-                env->psrpil, env->gl);
-    cpu_fprintf(f, "tbr: " TARGET_FMT_lx " hpstate: " TARGET_FMT_lx " htba: "
-                TARGET_FMT_lx "\n", env->tbr, env->hpstate, env->htba);
-    cpu_fprintf(f, "cansave: %d canrestore: %d otherwin: %d wstate: %d "
-                "cleanwin: %d cwp: %d\n",
-                env->cansave, env->canrestore, env->otherwin, env->wstate,
-                env->cleanwin, env->nwindows - 1 - env->cwp);
-    cpu_fprintf(f, "fsr: " TARGET_FMT_lx " y: " TARGET_FMT_lx " fprs: "
-                TARGET_FMT_lx "\n", env->fsr, env->y, env->fprs);
+    qemu_fprintf(f, "pstate: %08x ccr: %02x (icc: ", env->pstate,
+                 (unsigned)cpu_get_ccr(env));
+    cpu_print_cc(f, cpu_get_ccr(env) << PSR_CARRY_SHIFT);
+    qemu_fprintf(f, " xcc: ");
+    cpu_print_cc(f, cpu_get_ccr(env) << (PSR_CARRY_SHIFT - 4));
+    qemu_fprintf(f, ") asi: %02x tl: %d pil: %x gl: %d\n", env->asi, env->tl,
+                 env->psrpil, env->gl);
+    qemu_fprintf(f, "tbr: " TARGET_FMT_lx " hpstate: " TARGET_FMT_lx " htba: "
+                 TARGET_FMT_lx "\n", env->tbr, env->hpstate, env->htba);
+    qemu_fprintf(f, "cansave: %d canrestore: %d otherwin: %d wstate: %d "
+                 "cleanwin: %d cwp: %d\n",
+                 env->cansave, env->canrestore, env->otherwin, env->wstate,
+                 env->cleanwin, env->nwindows - 1 - env->cwp);
+    qemu_fprintf(f, "fsr: " TARGET_FMT_lx " y: " TARGET_FMT_lx " fprs: "
+                 TARGET_FMT_lx "\n", env->fsr, env->y, env->fprs);
 
 #else
-    cpu_fprintf(f, "psr: %08x (icc: ", cpu_get_psr(env));
-    cpu_print_cc(f, cpu_fprintf, cpu_get_psr(env));
-    cpu_fprintf(f, " SPE: %c%c%c) wim: %08x\n", env->psrs ? 'S' : '-',
-                env->psrps ? 'P' : '-', env->psret ? 'E' : '-',
-                env->wim);
-    cpu_fprintf(f, "fsr: " TARGET_FMT_lx " y: " TARGET_FMT_lx "\n",
-                env->fsr, env->y);
+    qemu_fprintf(f, "psr: %08x (icc: ", cpu_get_psr(env));
+    cpu_print_cc(f, cpu_get_psr(env));
+    qemu_fprintf(f, " SPE: %c%c%c) wim: %08x\n", env->psrs ? 'S' : '-',
+                 env->psrps ? 'P' : '-', env->psret ? 'E' : '-',
+                 env->wim);
+    qemu_fprintf(f, "fsr: " TARGET_FMT_lx " y: " TARGET_FMT_lx "\n",
+                 env->fsr, env->y);
 #endif
-    cpu_fprintf(f, "\n");
+    qemu_fprintf(f, "\n");
 }
 
 static void sparc_cpu_set_pc(CPUState *cs, vaddr value)
diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h
index b298bd9c29..85b9665ccc 100644
--- a/target/sparc/cpu.h
+++ b/target/sparc/cpu.h
@@ -564,8 +564,7 @@ extern const struct VMStateDescription vmstate_sparc_cpu;
 #endif
 
 void sparc_cpu_do_interrupt(CPUState *cpu);
-void sparc_cpu_dump_state(CPUState *cpu, FILE *f,
-                          fprintf_function cpu_fprintf, int flags);
+void sparc_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr sparc_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 int sparc_cpu_gdb_read_register(CPUState *cpu, uint8_t *buf, int reg);
 int sparc_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
index bfe9be59b5..b9d37105fa 100644
--- a/target/tilegx/cpu.c
+++ b/target/tilegx/cpu.c
@@ -24,9 +24,9 @@
 #include "qemu-common.h"
 #include "hw/qdev-properties.h"
 #include "linux-user/syscall_defs.h"
+#include "qemu/qemu-print.h"
 
-static void tilegx_cpu_dump_state(CPUState *cs, FILE *f,
-                                  fprintf_function cpu_fprintf, int flags)
+static void tilegx_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     static const char * const reg_names[TILEGX_R_COUNT] = {
          "r0",  "r1",  "r2",  "r3",  "r4",  "r5",  "r6",  "r7",
@@ -43,12 +43,12 @@ static void tilegx_cpu_dump_state(CPUState *cs, FILE *f,
     int i;
 
     for (i = 0; i < TILEGX_R_COUNT; i++) {
-        cpu_fprintf(f, "%-4s" TARGET_FMT_lx "%s",
-                    reg_names[i], env->regs[i],
-                    (i % 4) == 3 ? "\n" : " ");
+        qemu_fprintf(f, "%-4s" TARGET_FMT_lx "%s",
+                     reg_names[i], env->regs[i],
+                     (i % 4) == 3 ? "\n" : " ");
     }
-    cpu_fprintf(f, "PC  " TARGET_FMT_lx " CEX " TARGET_FMT_lx "\n\n",
-                env->pc, env->spregs[TILEGX_SPR_CMPEXCH]);
+    qemu_fprintf(f, "PC  " TARGET_FMT_lx " CEX " TARGET_FMT_lx "\n\n",
+                 env->pc, env->spregs[TILEGX_SPR_CMPEXCH]);
 }
 
 static ObjectClass *tilegx_cpu_class_by_name(const char *cpu_model)
diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
index 43d577ce8e..64d1a9c75e 100644
--- a/target/tricore/cpu.h
+++ b/target/tricore/cpu.h
@@ -224,8 +224,7 @@ static inline TriCoreCPU *tricore_env_get_cpu(CPUTriCoreState *env)
 #define ENV_OFFSET offsetof(TriCoreCPU, env)
 
 hwaddr tricore_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
-void tricore_cpu_dump_state(CPUState *cpu, FILE *f,
-                            fprintf_function cpu_fprintf, int flags);
+void tricore_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 
 
 #define MASK_PCXI_PCPN 0xff000000
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
index b12c391be5..352f52bb4a 100644
--- a/target/tricore/translate.c
+++ b/target/tricore/translate.c
@@ -24,6 +24,7 @@
 #include "exec/exec-all.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
+#include "qemu/qemu-print.h"
 
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
@@ -88,8 +89,7 @@ enum {
     MODE_UU = 3,
 };
 
-void tricore_cpu_dump_state(CPUState *cs, FILE *f,
-                            fprintf_function cpu_fprintf, int flags)
+void tricore_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     TriCoreCPU *cpu = TRICORE_CPU(cs);
     CPUTriCoreState *env = &cpu->env;
@@ -98,26 +98,26 @@ void tricore_cpu_dump_state(CPUState *cs, FILE *f,
 
     psw = psw_read(env);
 
-    cpu_fprintf(f, "PC: " TARGET_FMT_lx, env->PC);
-    cpu_fprintf(f, " PSW: " TARGET_FMT_lx, psw);
-    cpu_fprintf(f, " ICR: " TARGET_FMT_lx, env->ICR);
-    cpu_fprintf(f, "\nPCXI: " TARGET_FMT_lx, env->PCXI);
-    cpu_fprintf(f, " FCX: " TARGET_FMT_lx, env->FCX);
-    cpu_fprintf(f, " LCX: " TARGET_FMT_lx, env->LCX);
+    qemu_fprintf(f, "PC: " TARGET_FMT_lx, env->PC);
+    qemu_fprintf(f, " PSW: " TARGET_FMT_lx, psw);
+    qemu_fprintf(f, " ICR: " TARGET_FMT_lx, env->ICR);
+    qemu_fprintf(f, "\nPCXI: " TARGET_FMT_lx, env->PCXI);
+    qemu_fprintf(f, " FCX: " TARGET_FMT_lx, env->FCX);
+    qemu_fprintf(f, " LCX: " TARGET_FMT_lx, env->LCX);
 
     for (i = 0; i < 16; ++i) {
         if ((i & 3) == 0) {
-            cpu_fprintf(f, "\nGPR A%02d:", i);
+            qemu_fprintf(f, "\nGPR A%02d:", i);
         }
-        cpu_fprintf(f, " " TARGET_FMT_lx, env->gpr_a[i]);
+        qemu_fprintf(f, " " TARGET_FMT_lx, env->gpr_a[i]);
     }
     for (i = 0; i < 16; ++i) {
         if ((i & 3) == 0) {
-            cpu_fprintf(f, "\nGPR D%02d:", i);
+            qemu_fprintf(f, "\nGPR D%02d:", i);
         }
-        cpu_fprintf(f, " " TARGET_FMT_lx, env->gpr_d[i]);
+        qemu_fprintf(f, " " TARGET_FMT_lx, env->gpr_d[i]);
     }
-    cpu_fprintf(f, "\n");
+    qemu_fprintf(f, "\n");
 }
 
 /*
diff --git a/target/unicore32/cpu.h b/target/unicore32/cpu.h
index 735d3ae9dc..24abe5e5c0 100644
--- a/target/unicore32/cpu.h
+++ b/target/unicore32/cpu.h
@@ -97,8 +97,7 @@ static inline UniCore32CPU *uc32_env_get_cpu(CPUUniCore32State *env)
 
 void uc32_cpu_do_interrupt(CPUState *cpu);
 bool uc32_cpu_exec_interrupt(CPUState *cpu, int int_req);
-void uc32_cpu_dump_state(CPUState *cpu, FILE *f,
-                         fprintf_function cpu_fprintf, int flags);
+void uc32_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr uc32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 
 #define ASR_M                   (0x1f)
diff --git a/target/unicore32/translate.c b/target/unicore32/translate.c
index 002569ff3b..dfe41c9069 100644
--- a/target/unicore32/translate.c
+++ b/target/unicore32/translate.c
@@ -17,6 +17,7 @@
 #include "qemu/log.h"
 #include "exec/cpu_ldst.h"
 #include "exec/translator.h"
+#include "qemu/qemu-print.h"
 
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
@@ -2043,8 +2044,7 @@ static const char *cpu_mode_names[16] = {
 
 #undef UCF64_DUMP_STATE
 #ifdef UCF64_DUMP_STATE
-static void cpu_dump_state_ucf64(CPUUniCore32State *env, FILE *f,
-        fprintf_function cpu_fprintf, int flags)
+static void cpu_dump_state_ucf64(CPUUniCore32State *env, int flags)
 {
     int i;
     union {
@@ -2064,20 +2064,19 @@ static void cpu_dump_state_ucf64(CPUUniCore32State *env, FILE *f,
         s0.i = d.l.lower;
         s1.i = d.l.upper;
         d0.f64 = d.d;
-        cpu_fprintf(f, "s%02d=%08x(%8g) s%02d=%08x(%8g)",
-                    i * 2, (int)s0.i, s0.s,
-                    i * 2 + 1, (int)s1.i, s1.s);
-        cpu_fprintf(f, " d%02d=%" PRIx64 "(%8g)\n",
-                    i, (uint64_t)d0.f64, d0.d);
+        qemu_fprintf(f, "s%02d=%08x(%8g) s%02d=%08x(%8g)",
+                     i * 2, (int)s0.i, s0.s,
+                     i * 2 + 1, (int)s1.i, s1.s);
+        qemu_fprintf(f, " d%02d=%" PRIx64 "(%8g)\n",
+                     i, (uint64_t)d0.f64, d0.d);
     }
-    cpu_fprintf(f, "FPSCR: %08x\n", (int)env->ucf64.xregs[UC32_UCF64_FPSCR]);
+    qemu_fprintf(f, "FPSCR: %08x\n", (int)env->ucf64.xregs[UC32_UCF64_FPSCR]);
 }
 #else
 #define cpu_dump_state_ucf64(env, file, pr, flags)      do { } while (0)
 #endif
 
-void uc32_cpu_dump_state(CPUState *cs, FILE *f,
-                         fprintf_function cpu_fprintf, int flags)
+void uc32_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     UniCore32CPU *cpu = UNICORE32_CPU(cs);
     CPUUniCore32State *env = &cpu->env;
@@ -2085,21 +2084,21 @@ void uc32_cpu_dump_state(CPUState *cs, FILE *f,
     uint32_t psr;
 
     for (i = 0; i < 32; i++) {
-        cpu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
+        qemu_fprintf(f, "R%02d=%08x", i, env->regs[i]);
         if ((i % 4) == 3) {
-            cpu_fprintf(f, "\n");
+            qemu_fprintf(f, "\n");
         } else {
-            cpu_fprintf(f, " ");
+            qemu_fprintf(f, " ");
         }
     }
     psr = cpu_asr_read(env);
-    cpu_fprintf(f, "PSR=%08x %c%c%c%c %s\n",
-                psr,
-                psr & (1 << 31) ? 'N' : '-',
-                psr & (1 << 30) ? 'Z' : '-',
-                psr & (1 << 29) ? 'C' : '-',
-                psr & (1 << 28) ? 'V' : '-',
-                cpu_mode_names[psr & 0xf]);
+    qemu_fprintf(f, "PSR=%08x %c%c%c%c %s\n",
+                 psr,
+                 psr & (1 << 31) ? 'N' : '-',
+                 psr & (1 << 30) ? 'Z' : '-',
+                 psr & (1 << 29) ? 'C' : '-',
+                 psr & (1 << 28) ? 'V' : '-',
+                 cpu_mode_names[psr & 0xf]);
 
     if (flags & CPU_DUMP_FPU) {
         cpu_dump_state_ucf64(env, f, cpu_fprintf, flags);
diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h
index 86f6d6d72c..5d23e1345b 100644
--- a/target/xtensa/cpu.h
+++ b/target/xtensa/cpu.h
@@ -560,8 +560,7 @@ void xtensa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr,
                                       unsigned size, MMUAccessType access_type,
                                       int mmu_idx, MemTxAttrs attrs,
                                       MemTxResult response, uintptr_t retaddr);
-void xtensa_cpu_dump_state(CPUState *cpu, FILE *f,
-                           fprintf_function cpu_fprintf, int flags);
+void xtensa_cpu_dump_state(CPUState *cpu, FILE *f, int flags);
 hwaddr xtensa_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
 void xtensa_count_regs(const XtensaConfig *config,
                        unsigned *n_regs, unsigned *n_core_regs);
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 65561d2c49..43a5e94daa 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -35,6 +35,7 @@
 #include "disas/disas.h"
 #include "tcg-op.h"
 #include "qemu/log.h"
+#include "qemu/qemu-print.h"
 #include "sysemu/sysemu.h"
 #include "exec/cpu_ldst.h"
 #include "exec/semihost.h"
@@ -1640,60 +1641,61 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)
     translator_loop(&xtensa_translator_ops, &dc.base, cpu, tb);
 }
 
-void xtensa_cpu_dump_state(CPUState *cs, FILE *f,
-                           fprintf_function cpu_fprintf, int flags)
+void xtensa_cpu_dump_state(CPUState *cs, FILE *f, int flags)
 {
     XtensaCPU *cpu = XTENSA_CPU(cs);
     CPUXtensaState *env = &cpu->env;
     int i, j;
 
-    cpu_fprintf(f, "PC=%08x\n\n", env->pc);
+    qemu_fprintf(f, "PC=%08x\n\n", env->pc);
 
     for (i = j = 0; i < 256; ++i) {
         if (xtensa_option_bits_enabled(env->config, sregnames[i].opt_bits)) {
-            cpu_fprintf(f, "%12s=%08x%c", sregnames[i].name, env->sregs[i],
-                    (j++ % 4) == 3 ? '\n' : ' ');
+            qemu_fprintf(f, "%12s=%08x%c",
+                         sregnames[i].name, env->sregs[i],
+                         (j++ % 4) == 3 ? '\n' : ' ');
         }
     }
 
-    cpu_fprintf(f, (j % 4) == 0 ? "\n" : "\n\n");
+    qemu_fprintf(f, (j % 4) == 0 ? "\n" : "\n\n");
 
     for (i = j = 0; i < 256; ++i) {
         if (xtensa_option_bits_enabled(env->config, uregnames[i].opt_bits)) {
-            cpu_fprintf(f, "%s=%08x%c", uregnames[i].name, env->uregs[i],
-                    (j++ % 4) == 3 ? '\n' : ' ');
+            qemu_fprintf(f, "%s=%08x%c",
+                         uregnames[i].name, env->uregs[i],
+                         (j++ % 4) == 3 ? '\n' : ' ');
         }
     }
 
-    cpu_fprintf(f, (j % 4) == 0 ? "\n" : "\n\n");
+    qemu_fprintf(f, (j % 4) == 0 ? "\n" : "\n\n");
 
     for (i = 0; i < 16; ++i) {
-        cpu_fprintf(f, " A%02d=%08x%c", i, env->regs[i],
-                (i % 4) == 3 ? '\n' : ' ');
+        qemu_fprintf(f, " A%02d=%08x%c",
+                     i, env->regs[i], (i % 4) == 3 ? '\n' : ' ');
     }
 
     xtensa_sync_phys_from_window(env);
-    cpu_fprintf(f, "\n");
+    qemu_fprintf(f, "\n");
 
     for (i = 0; i < env->config->nareg; ++i) {
-        cpu_fprintf(f, "AR%02d=%08x ", i, env->phys_regs[i]);
+        qemu_fprintf(f, "AR%02d=%08x ", i, env->phys_regs[i]);
         if (i % 4 == 3) {
             bool ws = (env->sregs[WINDOW_START] & (1 << (i / 4))) != 0;
             bool cw = env->sregs[WINDOW_BASE] == i / 4;
 
-            cpu_fprintf(f, "%c%c\n", ws ? '<' : ' ', cw ? '=' : ' ');
+            qemu_fprintf(f, "%c%c\n", ws ? '<' : ' ', cw ? '=' : ' ');
         }
     }
 
     if ((flags & CPU_DUMP_FPU) &&
         xtensa_option_enabled(env->config, XTENSA_OPTION_FP_COPROCESSOR)) {
-        cpu_fprintf(f, "\n");
+        qemu_fprintf(f, "\n");
 
         for (i = 0; i < 16; ++i) {
-            cpu_fprintf(f, "F%02d=%08x (%+10.8e)%c", i,
-                    float32_val(env->fregs[i].f32[FP_F32_LOW]),
-                    *(float *)(env->fregs[i].f32 + FP_F32_LOW),
-                    (i % 2) == 1 ? '\n' : ' ');
+            qemu_fprintf(f, "F%02d=%08x (%+10.8e)%c", i,
+                         float32_val(env->fregs[i].f32[FP_F32_LOW]),
+                         *(float *)(env->fregs[i].f32 + FP_F32_LOW),
+                         (i % 2) == 1 ? '\n' : ' ');
         }
     }
 }
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 15/17] monitor: Clean up how monitor_disas() funnels output to monitor
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (13 preceding siblings ...)
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 14/17] qom/cpu: Simplify how CPUClass:cpu_dump_state() prints Markus Armbruster
@ 2019-04-17 19:18 ` Markus Armbruster
  2019-04-17 19:35   ` Eric Blake
  2019-04-17 19:18   ` Markus Armbruster
                   ` (12 subsequent siblings)
  27 siblings, 1 reply; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

INIT_DISASSEMBLE_INFO() takes an fprintf()-like callback and a FILE *
to pass to it.  monitor_disas() passes monitor_fprintf() and the
current monitor cast to FILE *.  monitor_fprintf() casts it right
back, and is otherwise identical to monitor_printf().  The
type-pinning is ugly.

Pass qemu_fprintf() and NULL instead.

monitor_fprintf() is now unused; delete it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 disas.c                   |  3 ++-
 include/monitor/monitor.h |  1 -
 monitor.c                 | 11 -----------
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/disas.c b/disas.c
index d9aa713a40..d15cceb863 100644
--- a/disas.c
+++ b/disas.c
@@ -3,6 +3,7 @@
 #include "qemu-common.h"
 #include "disas/bfd.h"
 #include "elf.h"
+#include "qemu/qemu-print.h"
 
 #include "cpu.h"
 #include "disas/disas.h"
@@ -609,7 +610,7 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
     int count, i;
     CPUDebug s;
 
-    INIT_DISASSEMBLE_INFO(s.info, (FILE *)mon, monitor_fprintf);
+    INIT_DISASSEMBLE_INFO(s.info, NULL, qemu_fprintf);
 
     s.cpu = cpu;
     s.info.read_memory_func
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 316a168c41..86656297f1 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -31,7 +31,6 @@ int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
 int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
     GCC_FMT_ATTR(2, 0);
 int monitor_printf(Monitor *mon, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
-int monitor_fprintf(FILE *stream, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
 void monitor_flush(Monitor *mon);
 int monitor_set_cpu(int cpu_index);
 int monitor_get_cpu_index(void);
diff --git a/monitor.c b/monitor.c
index ad6cec54a1..9b5f10b475 100644
--- a/monitor.c
+++ b/monitor.c
@@ -480,17 +480,6 @@ int monitor_printf(Monitor *mon, const char *fmt, ...)
     return ret;
 }
 
-int monitor_fprintf(FILE *stream, const char *fmt, ...)
-{
-    int ret;
-
-    va_list ap;
-    va_start(ap, fmt);
-    ret = monitor_vprintf((Monitor *)stream, fmt, ap);
-    va_end(ap);
-    return ret;
-}
-
 static void qmp_send_response(Monitor *mon, const QDict *rsp)
 {
     const QObject *data = QOBJECT(rsp);
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 16/17] disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
@ 2019-04-17 19:18   ` Markus Armbruster
  0 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, Paolo Bonzini

Commit dc99065b5f9 (v0.1.0) added dis-asm.h from binutils.

Commit 43d4145a986 (v0.1.5) inlined bfd.h into dis-asm.h to remove the
dependency on binutils.

Commit 76cad71136b (v1.4.0) moved dis-asm.h to include/disas/bfd.h.
The new name is confusing when you try to match against (pre GPLv3+)
binutils.  Rename it back.  Keep it in the same directory, of course.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 disas.c                            | 2 +-
 disas/alpha.c                      | 2 +-
 disas/arm-a64.cc                   | 2 +-
 disas/arm.c                        | 2 +-
 disas/cris.c                       | 2 +-
 disas/hppa.c                       | 2 +-
 disas/i386.c                       | 2 +-
 disas/lm32.c                       | 2 +-
 disas/m68k.c                       | 2 +-
 disas/microblaze.c                 | 2 +-
 disas/mips.c                       | 2 +-
 disas/moxie.c                      | 2 +-
 disas/nanomips.cpp                 | 2 +-
 disas/nios2.c                      | 2 +-
 disas/ppc.c                        | 2 +-
 disas/riscv.c                      | 2 +-
 disas/s390.c                       | 2 +-
 disas/sh4.c                        | 2 +-
 disas/sparc.c                      | 2 +-
 disas/tci.c                        | 2 +-
 disas/xtensa.c                     | 2 +-
 include/disas/{bfd.h => dis-asm.h} | 0
 include/qom/cpu.h                  | 2 +-
 target/openrisc/disas.c            | 2 +-
 target/ppc/translate_init.inc.c    | 2 +-
 25 files changed, 24 insertions(+), 24 deletions(-)
 rename include/disas/{bfd.h => dis-asm.h} (100%)

diff --git a/disas.c b/disas.c
index d15cceb863..41ad0102e2 100644
--- a/disas.c
+++ b/disas.c
@@ -1,7 +1,7 @@
 /* General "disassemble this chunk" code.  Used for debugging. */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "elf.h"
 #include "qemu/qemu-print.h"
 
diff --git a/disas/alpha.c b/disas/alpha.c
index a0c9ecd49d..3db90fa665 100644
--- a/disas/alpha.c
+++ b/disas/alpha.c
@@ -20,7 +20,7 @@ along with this file; see the file COPYING.  If not, see
 <http://www.gnu.org/licenses/>. */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* MAX is redefined below, so remove any previous definition. */
 #undef MAX
diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
index 9280950ce3..9fa779e175 100644
--- a/disas/arm-a64.cc
+++ b/disas/arm-a64.cc
@@ -19,7 +19,7 @@
 
 extern "C" {
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 }
 
 #include "vixl/a64/disasm-a64.h"
diff --git a/disas/arm.c b/disas/arm.c
index 17ea120b44..7d940f2396 100644
--- a/disas/arm.c
+++ b/disas/arm.c
@@ -23,7 +23,7 @@
    for things we don't care about.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 #define ARM_EXT_V1	 0
 #define ARM_EXT_V2	 0
diff --git a/disas/cris.c b/disas/cris.c
index 2dd56deea4..bf9eafc415 100644
--- a/disas/cris.c
+++ b/disas/cris.c
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "target/cris/opcode-cris.h"
 
 #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
diff --git a/disas/hppa.c b/disas/hppa.c
index a2d371fdb1..2dbd1fc445 100644
--- a/disas/hppa.c
+++ b/disas/hppa.c
@@ -19,7 +19,7 @@
    along with this program; if not, see <http://www.gnu.org/licenses/>. */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* HP PA-RISC SOM object file format:  definitions internal to BFD.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
diff --git a/disas/i386.c b/disas/i386.c
index fc03b9f06a..4c1f0f877b 100644
--- a/disas/i386.c
+++ b/disas/i386.c
@@ -32,7 +32,7 @@
    the Intel manual for details.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "qemu/cutils.h"
 
 /* include/opcode/i386.h r1.78 */
diff --git a/disas/lm32.c b/disas/lm32.c
index fcc2cde23d..c0ef8160fe 100644
--- a/disas/lm32.c
+++ b/disas/lm32.c
@@ -19,7 +19,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 typedef enum {
     LM32_OP_SRUI = 0, LM32_OP_NORI, LM32_OP_MULI, LM32_OP_SH, LM32_OP_LB,
diff --git a/disas/m68k.c b/disas/m68k.c
index e544c7137f..863409c67c 100644
--- a/disas/m68k.c
+++ b/disas/m68k.c
@@ -4,7 +4,7 @@
 #include "qemu/osdep.h"
 #include <math.h>
 
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* **** floatformat.h from sourceware.org CVS 2005-08-14.  */
 /* IEEE floating point support declarations, for GDB, the GNU Debugger.
diff --git a/disas/microblaze.c b/disas/microblaze.c
index c23605043a..0b89b9c4fa 100644
--- a/disas/microblaze.c
+++ b/disas/microblaze.c
@@ -577,7 +577,7 @@ static const char pvr_register_prefix[] = "rpvr";
 
 #endif /* MICROBLAZE_OPC */
 
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 #define get_field_rd(instr) get_field(instr, RD_MASK, RD_LOW)
 #define get_field_r1(instr) get_field(instr, RA_MASK, RA_LOW)
diff --git a/disas/mips.c b/disas/mips.c
index 97f661a37e..dfefe5e589 100644
--- a/disas/mips.c
+++ b/disas/mips.c
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* mips.h.  Mips opcode list for GDB, the GNU debugger.
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
diff --git a/disas/moxie.c b/disas/moxie.c
index 70b49ed74b..e94ab4c33d 100644
--- a/disas/moxie.c
+++ b/disas/moxie.c
@@ -18,7 +18,7 @@
 #define STATIC_TABLE
 #define DEFINE_TABLE
 
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 static void *stream;
 
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index c8495b1a19..90e63b8367 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -29,7 +29,7 @@
 
 extern "C" {
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 }
 
 #include <cstring>
diff --git a/disas/nios2.c b/disas/nios2.c
index de11f04cc4..c3e82140c7 100644
--- a/disas/nios2.c
+++ b/disas/nios2.c
@@ -36,7 +36,7 @@
 
 /*#include "bfd.h"*/
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 
 /****************************************************************************
diff --git a/disas/ppc.c b/disas/ppc.c
index da1140ba2b..a545437de9 100644
--- a/disas/ppc.c
+++ b/disas/ppc.c
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
 along with this file; see the file COPYING.  If not,
 see <http://www.gnu.org/licenses/>.  */
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #define BFD_DEFAULT_TARGET_SIZE 64
 
 /* ppc.h -- Header file for PowerPC opcode table
diff --git a/disas/riscv.c b/disas/riscv.c
index 27546dd790..59a9b0437a 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -18,7 +18,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 
 /* types */
diff --git a/disas/s390.c b/disas/s390.c
index 6393860239..b1f4e2a0c1 100644
--- a/disas/s390.c
+++ b/disas/s390.c
@@ -22,7 +22,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* include/opcode/s390.h revision 1.9 */
 /* s390.h -- Header file for S390 opcode table
diff --git a/disas/sh4.c b/disas/sh4.c
index 6b66176bed..55ef865a36 100644
--- a/disas/sh4.c
+++ b/disas/sh4.c
@@ -16,7 +16,7 @@
    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 #define DEFINE_TABLE
 
diff --git a/disas/sparc.c b/disas/sparc.c
index f120f4e86d..5689533ce1 100644
--- a/disas/sparc.c
+++ b/disas/sparc.c
@@ -27,7 +27,7 @@
    see <http://www.gnu.org/licenses/>.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* The SPARC opcode table (and other related data) is defined in
    the opcodes library in sparc-opc.c.  If you change anything here, make
diff --git a/disas/tci.c b/disas/tci.c
index 1cdf5eeafc..f1d6c6b469 100644
--- a/disas/tci.c
+++ b/disas/tci.c
@@ -19,7 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "tcg/tcg.h"
 
 /* Disassemble TCI bytecode. */
diff --git a/disas/xtensa.c b/disas/xtensa.c
index 5e3870b9ad..d7dda8c2d6 100644
--- a/disas/xtensa.c
+++ b/disas/xtensa.c
@@ -26,7 +26,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "hw/xtensa/xtensa-isa.h"
 
 int print_insn_xtensa(bfd_vma memaddr, struct disassemble_info *info)
diff --git a/include/disas/bfd.h b/include/disas/dis-asm.h
similarity index 100%
rename from include/disas/bfd.h
rename to include/disas/dis-asm.h
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 9972e07786..e9bec3a5bc 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -21,7 +21,7 @@
 #define QEMU_CPU_H
 
 #include "hw/qdev-core.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "exec/hwaddr.h"
 #include "exec/memattrs.h"
 #include "qapi/qapi-types-run-state.h"
diff --git a/target/openrisc/disas.c b/target/openrisc/disas.c
index bc63093ee9..5923b2429e 100644
--- a/target/openrisc/disas.c
+++ b/target/openrisc/disas.c
@@ -19,7 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "qemu/bitops.h"
 #include "cpu.h"
 
diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
index 996356dd99..20a64f3b77 100644
--- a/target/ppc/translate_init.inc.c
+++ b/target/ppc/translate_init.inc.c
@@ -18,7 +18,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "exec/gdbstub.h"
 #include "kvm_ppc.h"
 #include "sysemu/arch_init.h"
-- 
2.17.2

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

* [Qemu-devel] [PATCH v2 16/17] disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
@ 2019-04-17 19:18   ` Markus Armbruster
  0 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, dgilbert

Commit dc99065b5f9 (v0.1.0) added dis-asm.h from binutils.

Commit 43d4145a986 (v0.1.5) inlined bfd.h into dis-asm.h to remove the
dependency on binutils.

Commit 76cad71136b (v1.4.0) moved dis-asm.h to include/disas/bfd.h.
The new name is confusing when you try to match against (pre GPLv3+)
binutils.  Rename it back.  Keep it in the same directory, of course.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 disas.c                            | 2 +-
 disas/alpha.c                      | 2 +-
 disas/arm-a64.cc                   | 2 +-
 disas/arm.c                        | 2 +-
 disas/cris.c                       | 2 +-
 disas/hppa.c                       | 2 +-
 disas/i386.c                       | 2 +-
 disas/lm32.c                       | 2 +-
 disas/m68k.c                       | 2 +-
 disas/microblaze.c                 | 2 +-
 disas/mips.c                       | 2 +-
 disas/moxie.c                      | 2 +-
 disas/nanomips.cpp                 | 2 +-
 disas/nios2.c                      | 2 +-
 disas/ppc.c                        | 2 +-
 disas/riscv.c                      | 2 +-
 disas/s390.c                       | 2 +-
 disas/sh4.c                        | 2 +-
 disas/sparc.c                      | 2 +-
 disas/tci.c                        | 2 +-
 disas/xtensa.c                     | 2 +-
 include/disas/{bfd.h => dis-asm.h} | 0
 include/qom/cpu.h                  | 2 +-
 target/openrisc/disas.c            | 2 +-
 target/ppc/translate_init.inc.c    | 2 +-
 25 files changed, 24 insertions(+), 24 deletions(-)
 rename include/disas/{bfd.h => dis-asm.h} (100%)

diff --git a/disas.c b/disas.c
index d15cceb863..41ad0102e2 100644
--- a/disas.c
+++ b/disas.c
@@ -1,7 +1,7 @@
 /* General "disassemble this chunk" code.  Used for debugging. */
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "elf.h"
 #include "qemu/qemu-print.h"
 
diff --git a/disas/alpha.c b/disas/alpha.c
index a0c9ecd49d..3db90fa665 100644
--- a/disas/alpha.c
+++ b/disas/alpha.c
@@ -20,7 +20,7 @@ along with this file; see the file COPYING.  If not, see
 <http://www.gnu.org/licenses/>. */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* MAX is redefined below, so remove any previous definition. */
 #undef MAX
diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
index 9280950ce3..9fa779e175 100644
--- a/disas/arm-a64.cc
+++ b/disas/arm-a64.cc
@@ -19,7 +19,7 @@
 
 extern "C" {
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 }
 
 #include "vixl/a64/disasm-a64.h"
diff --git a/disas/arm.c b/disas/arm.c
index 17ea120b44..7d940f2396 100644
--- a/disas/arm.c
+++ b/disas/arm.c
@@ -23,7 +23,7 @@
    for things we don't care about.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 #define ARM_EXT_V1	 0
 #define ARM_EXT_V2	 0
diff --git a/disas/cris.c b/disas/cris.c
index 2dd56deea4..bf9eafc415 100644
--- a/disas/cris.c
+++ b/disas/cris.c
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "target/cris/opcode-cris.h"
 
 #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
diff --git a/disas/hppa.c b/disas/hppa.c
index a2d371fdb1..2dbd1fc445 100644
--- a/disas/hppa.c
+++ b/disas/hppa.c
@@ -19,7 +19,7 @@
    along with this program; if not, see <http://www.gnu.org/licenses/>. */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* HP PA-RISC SOM object file format:  definitions internal to BFD.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
diff --git a/disas/i386.c b/disas/i386.c
index fc03b9f06a..4c1f0f877b 100644
--- a/disas/i386.c
+++ b/disas/i386.c
@@ -32,7 +32,7 @@
    the Intel manual for details.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "qemu/cutils.h"
 
 /* include/opcode/i386.h r1.78 */
diff --git a/disas/lm32.c b/disas/lm32.c
index fcc2cde23d..c0ef8160fe 100644
--- a/disas/lm32.c
+++ b/disas/lm32.c
@@ -19,7 +19,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 typedef enum {
     LM32_OP_SRUI = 0, LM32_OP_NORI, LM32_OP_MULI, LM32_OP_SH, LM32_OP_LB,
diff --git a/disas/m68k.c b/disas/m68k.c
index e544c7137f..863409c67c 100644
--- a/disas/m68k.c
+++ b/disas/m68k.c
@@ -4,7 +4,7 @@
 #include "qemu/osdep.h"
 #include <math.h>
 
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* **** floatformat.h from sourceware.org CVS 2005-08-14.  */
 /* IEEE floating point support declarations, for GDB, the GNU Debugger.
diff --git a/disas/microblaze.c b/disas/microblaze.c
index c23605043a..0b89b9c4fa 100644
--- a/disas/microblaze.c
+++ b/disas/microblaze.c
@@ -577,7 +577,7 @@ static const char pvr_register_prefix[] = "rpvr";
 
 #endif /* MICROBLAZE_OPC */
 
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 #define get_field_rd(instr) get_field(instr, RD_MASK, RD_LOW)
 #define get_field_r1(instr) get_field(instr, RA_MASK, RA_LOW)
diff --git a/disas/mips.c b/disas/mips.c
index 97f661a37e..dfefe5e589 100644
--- a/disas/mips.c
+++ b/disas/mips.c
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
 along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* mips.h.  Mips opcode list for GDB, the GNU debugger.
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
diff --git a/disas/moxie.c b/disas/moxie.c
index 70b49ed74b..e94ab4c33d 100644
--- a/disas/moxie.c
+++ b/disas/moxie.c
@@ -18,7 +18,7 @@
 #define STATIC_TABLE
 #define DEFINE_TABLE
 
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 static void *stream;
 
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index c8495b1a19..90e63b8367 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -29,7 +29,7 @@
 
 extern "C" {
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 }
 
 #include <cstring>
diff --git a/disas/nios2.c b/disas/nios2.c
index de11f04cc4..c3e82140c7 100644
--- a/disas/nios2.c
+++ b/disas/nios2.c
@@ -36,7 +36,7 @@
 
 /*#include "bfd.h"*/
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 
 /****************************************************************************
diff --git a/disas/ppc.c b/disas/ppc.c
index da1140ba2b..a545437de9 100644
--- a/disas/ppc.c
+++ b/disas/ppc.c
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
 along with this file; see the file COPYING.  If not,
 see <http://www.gnu.org/licenses/>.  */
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #define BFD_DEFAULT_TARGET_SIZE 64
 
 /* ppc.h -- Header file for PowerPC opcode table
diff --git a/disas/riscv.c b/disas/riscv.c
index 27546dd790..59a9b0437a 100644
--- a/disas/riscv.c
+++ b/disas/riscv.c
@@ -18,7 +18,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 
 /* types */
diff --git a/disas/s390.c b/disas/s390.c
index 6393860239..b1f4e2a0c1 100644
--- a/disas/s390.c
+++ b/disas/s390.c
@@ -22,7 +22,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* include/opcode/s390.h revision 1.9 */
 /* s390.h -- Header file for S390 opcode table
diff --git a/disas/sh4.c b/disas/sh4.c
index 6b66176bed..55ef865a36 100644
--- a/disas/sh4.c
+++ b/disas/sh4.c
@@ -16,7 +16,7 @@
    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 #define DEFINE_TABLE
 
diff --git a/disas/sparc.c b/disas/sparc.c
index f120f4e86d..5689533ce1 100644
--- a/disas/sparc.c
+++ b/disas/sparc.c
@@ -27,7 +27,7 @@
    see <http://www.gnu.org/licenses/>.  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 
 /* The SPARC opcode table (and other related data) is defined in
    the opcodes library in sparc-opc.c.  If you change anything here, make
diff --git a/disas/tci.c b/disas/tci.c
index 1cdf5eeafc..f1d6c6b469 100644
--- a/disas/tci.c
+++ b/disas/tci.c
@@ -19,7 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "tcg/tcg.h"
 
 /* Disassemble TCI bytecode. */
diff --git a/disas/xtensa.c b/disas/xtensa.c
index 5e3870b9ad..d7dda8c2d6 100644
--- a/disas/xtensa.c
+++ b/disas/xtensa.c
@@ -26,7 +26,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "hw/xtensa/xtensa-isa.h"
 
 int print_insn_xtensa(bfd_vma memaddr, struct disassemble_info *info)
diff --git a/include/disas/bfd.h b/include/disas/dis-asm.h
similarity index 100%
rename from include/disas/bfd.h
rename to include/disas/dis-asm.h
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 9972e07786..e9bec3a5bc 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -21,7 +21,7 @@
 #define QEMU_CPU_H
 
 #include "hw/qdev-core.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "exec/hwaddr.h"
 #include "exec/memattrs.h"
 #include "qapi/qapi-types-run-state.h"
diff --git a/target/openrisc/disas.c b/target/openrisc/disas.c
index bc63093ee9..5923b2429e 100644
--- a/target/openrisc/disas.c
+++ b/target/openrisc/disas.c
@@ -19,7 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "qemu/bitops.h"
 #include "cpu.h"
 
diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
index 996356dd99..20a64f3b77 100644
--- a/target/ppc/translate_init.inc.c
+++ b/target/ppc/translate_init.inc.c
@@ -18,7 +18,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "disas/bfd.h"
+#include "disas/dis-asm.h"
 #include "exec/gdbstub.h"
 #include "kvm_ppc.h"
 #include "sysemu/arch_init.h"
-- 
2.17.2



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

* [Qemu-devel] [PATCH v2 17/17] include: Move fprintf_function to disas/
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (15 preceding siblings ...)
  2019-04-17 19:18   ` Markus Armbruster
@ 2019-04-17 19:18 ` Markus Armbruster
  2019-04-17 19:42 ` [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function no-reply
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-17 19:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

The previous commits have eliminated fprintf_function outside
disassemblers, simplifying code and cleaning up the ugly type-punning
fprintf_function seems to attract.  Move fprintf_function to
include/disas/dis-asm.h to reduce the temptation to abuse it.

I considered renaming it to fprintf_ftype (reverting that part of
commit 6e2d864edf5, v0.14.0) to get us closer to binutils, but I
figure the fork is too distant to make this worthwhile.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 include/disas/dis-asm.h   |  5 +++--
 include/qemu/fprintf-fn.h | 14 --------------
 2 files changed, 3 insertions(+), 16 deletions(-)
 delete mode 100644 include/qemu/fprintf-fn.h

diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h
index 41b61c85f9..9240ec32c2 100644
--- a/include/disas/dis-asm.h
+++ b/include/disas/dis-asm.h
@@ -9,8 +9,6 @@
 #ifndef DISAS_BFD_H
 #define DISAS_BFD_H
 
-#include "qemu/fprintf-fn.h"
-
 typedef void *PTR;
 typedef uint64_t bfd_vma;
 typedef int64_t bfd_signed_vma;
@@ -243,6 +241,9 @@ typedef struct symbol_cache_entry
     } udata;
 } asymbol;
 
+typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
+    GCC_FMT_ATTR(2, 3);
+
 enum dis_insn_type {
   dis_noninsn,			/* Not a valid instruction */
   dis_nonbranch,		/* Not a branch instruction */
diff --git a/include/qemu/fprintf-fn.h b/include/qemu/fprintf-fn.h
deleted file mode 100644
index 9068a960b3..0000000000
--- a/include/qemu/fprintf-fn.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Typedef for fprintf-alike function pointers.
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- */
-
-#ifndef QEMU_FPRINTF_FN_H
-#define QEMU_FPRINTF_FN_H
-
-typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
-    GCC_FMT_ATTR(2, 3);
-
-#endif
-- 
2.17.2

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

* Re: [Qemu-devel] [PATCH v2 15/17] monitor: Clean up how monitor_disas() funnels output to monitor
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 15/17] monitor: Clean up how monitor_disas() funnels output to monitor Markus Armbruster
@ 2019-04-17 19:35   ` Eric Blake
  2019-04-18  6:20     ` Markus Armbruster
  0 siblings, 1 reply; 35+ messages in thread
From: Eric Blake @ 2019-04-17 19:35 UTC (permalink / raw)
  To: Markus Armbruster, qemu-devel; +Cc: dgilbert

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]

On 4/17/19 2:18 PM, Markus Armbruster wrote:
> INIT_DISASSEMBLE_INFO() takes an fprintf()-like callback and a FILE *
> to pass to it.  monitor_disas() passes monitor_fprintf() and the
> current monitor cast to FILE *.  monitor_fprintf() casts it right
> back, and is otherwise identical to monitor_printf().  The
> type-pinning is ugly.

For consistency with other patches in the series, s/pinning/punning/

> 
> Pass qemu_fprintf() and NULL instead.
> 
> monitor_fprintf() is now unused; delete it.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (16 preceding siblings ...)
  2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 17/17] include: Move fprintf_function to disas/ Markus Armbruster
@ 2019-04-17 19:42 ` no-reply
  2019-04-17 19:47 ` no-reply
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 19:42 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
d406c1d4cd include: Move fprintf_function to disas/
16ce7b0844 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
f8e6976645 monitor: Clean up how monitor_disas() funnels output to monitor
f79afa9517 qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
e1bbc178e1 qemu-print: New qemu_fprintf(), qemu_vfprintf()
7d392f9f86 qom/cpu: Simplify how CPUClass::dump_statistics() prints
090bb102c7 target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
56219b4319 target: Clean up how the dump_mmu() print
4e158b35c2 target: Simplify how the TARGET_cpu_list() print
567d521da5 memory: Clean up how mtree_info() prints
48a4f4d6da block/qapi: Clean up how we print to monitor or stdout
f680529453 qsp: Simplify how qsp_report() prints
8112185742 tcg: Simplify how dump_drift_info() prints
852634721a tcg: Simplify how dump_exec_info() prints
c85405d1e6 tcg: Simplify how dump_opcount_info() prints
21ecaf197a trace: Simplify how st_print_trace_file_status() prints
092f2c47ed include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit 092f2c47eda6 (include: Include fprintf-fn.h only where needed)
2/17 Checking commit 21ecaf197ac6 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit c85405d1e6e5 (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit 852634721a33 (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit 8112185742a2 (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit f6805294530b (qsp: Simplify how qsp_report() prints)
7/17 Checking commit 48a4f4d6da8d (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit 567d521da590 (memory: Clean up how mtree_info() prints)
9/17 Checking commit 4e158b35c234 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit 56219b431925 (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit 090bb102c765 (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit 7d392f9f86d6 (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit e1bbc178e114 (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit f79afa951759 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit f8e6976645da (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit 16ce7b0844dd (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit d406c1d4cd3e (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (17 preceding siblings ...)
  2019-04-17 19:42 ` [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function no-reply
@ 2019-04-17 19:47 ` no-reply
  2019-04-17 19:52 ` no-reply
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 19:47 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
8b142fc767 include: Move fprintf_function to disas/
d69f01b1b3 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
473a1c8779 monitor: Clean up how monitor_disas() funnels output to monitor
363a8f9258 qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
a2be3c05f9 qemu-print: New qemu_fprintf(), qemu_vfprintf()
1f6386c655 qom/cpu: Simplify how CPUClass::dump_statistics() prints
fc33835b61 target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
bea3b777db target: Clean up how the dump_mmu() print
0cf22bb8f4 target: Simplify how the TARGET_cpu_list() print
edae5f9c36 memory: Clean up how mtree_info() prints
409b0a9ef6 block/qapi: Clean up how we print to monitor or stdout
a2db2c108d qsp: Simplify how qsp_report() prints
eeef382c8b tcg: Simplify how dump_drift_info() prints
26f0941f15 tcg: Simplify how dump_exec_info() prints
1befd4787a tcg: Simplify how dump_opcount_info() prints
ca597f2d8e trace: Simplify how st_print_trace_file_status() prints
1c6d436697 include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit 1c6d43669789 (include: Include fprintf-fn.h only where needed)
2/17 Checking commit ca597f2d8e95 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit 1befd4787a61 (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit 26f0941f15dc (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit eeef382c8bdb (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit a2db2c108d25 (qsp: Simplify how qsp_report() prints)
7/17 Checking commit 409b0a9ef641 (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit edae5f9c360a (memory: Clean up how mtree_info() prints)
9/17 Checking commit 0cf22bb8f42e (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit bea3b777dbfa (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit fc33835b6178 (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit 1f6386c655a5 (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit a2be3c05f9fc (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit 363a8f9258a4 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit 473a1c877930 (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit d69f01b1b315 (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit 8b142fc76760 (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (18 preceding siblings ...)
  2019-04-17 19:47 ` no-reply
@ 2019-04-17 19:52 ` no-reply
  2019-04-17 19:55 ` no-reply
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 19:52 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
d04838b7b7 include: Move fprintf_function to disas/
319ed76db2 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
feff1f1103 monitor: Clean up how monitor_disas() funnels output to monitor
c9c4a984c5 qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
f7def015ea qemu-print: New qemu_fprintf(), qemu_vfprintf()
286643ea44 qom/cpu: Simplify how CPUClass::dump_statistics() prints
3d846546c8 target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
f2b3c9abee target: Clean up how the dump_mmu() print
1394894623 target: Simplify how the TARGET_cpu_list() print
1c6016aa83 memory: Clean up how mtree_info() prints
8f6c6a9fe3 block/qapi: Clean up how we print to monitor or stdout
782d9eb94e qsp: Simplify how qsp_report() prints
e6de5c5911 tcg: Simplify how dump_drift_info() prints
9e1aa6472d tcg: Simplify how dump_exec_info() prints
21dba78baa tcg: Simplify how dump_opcount_info() prints
c6d722b62c trace: Simplify how st_print_trace_file_status() prints
ded6f95b0e include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit ded6f95b0e1b (include: Include fprintf-fn.h only where needed)
2/17 Checking commit c6d722b62cc2 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit 21dba78baad3 (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit 9e1aa6472d45 (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit e6de5c591115 (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit 782d9eb94e8a (qsp: Simplify how qsp_report() prints)
7/17 Checking commit 8f6c6a9fe333 (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit 1c6016aa83ad (memory: Clean up how mtree_info() prints)
9/17 Checking commit 139489462353 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit f2b3c9abeec5 (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit 3d846546c8e2 (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit 286643ea442b (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit f7def015ea17 (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit c9c4a984c53d (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit feff1f11032c (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit 319ed76db21e (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit d04838b7b77a (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (19 preceding siblings ...)
  2019-04-17 19:52 ` no-reply
@ 2019-04-17 19:55 ` no-reply
  2019-04-17 20:01 ` no-reply
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 19:55 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
66669b6bcf include: Move fprintf_function to disas/
5f3c81a6c0 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
b1ae46c343 monitor: Clean up how monitor_disas() funnels output to monitor
a00c28ab5f qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
0f55321ae1 qemu-print: New qemu_fprintf(), qemu_vfprintf()
f2dbd0673c qom/cpu: Simplify how CPUClass::dump_statistics() prints
5b67d37795 target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
dc40ad0d34 target: Clean up how the dump_mmu() print
8df164790b target: Simplify how the TARGET_cpu_list() print
17406d3cf6 memory: Clean up how mtree_info() prints
53875f811b block/qapi: Clean up how we print to monitor or stdout
d2f6642515 qsp: Simplify how qsp_report() prints
e380a5d2ef tcg: Simplify how dump_drift_info() prints
aa6873e448 tcg: Simplify how dump_exec_info() prints
f8a56f8a9e tcg: Simplify how dump_opcount_info() prints
5beb1ec556 trace: Simplify how st_print_trace_file_status() prints
5f69e0108f include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit 5f69e0108f3a (include: Include fprintf-fn.h only where needed)
2/17 Checking commit 5beb1ec556b3 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit f8a56f8a9e7a (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit aa6873e4485d (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit e380a5d2ef1f (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit d2f6642515d9 (qsp: Simplify how qsp_report() prints)
7/17 Checking commit 53875f811b38 (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit 17406d3cf6af (memory: Clean up how mtree_info() prints)
9/17 Checking commit 8df164790bf4 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit dc40ad0d3487 (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit 5b67d377956e (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit f2dbd0673ce7 (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit 0f55321ae1d6 (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit a00c28ab5fe0 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit b1ae46c3432c (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit 5f3c81a6c07d (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit 66669b6bcf6b (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (20 preceding siblings ...)
  2019-04-17 19:55 ` no-reply
@ 2019-04-17 20:01 ` no-reply
  2019-04-17 20:06 ` no-reply
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 20:01 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
587c26c24e include: Move fprintf_function to disas/
416f563f47 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
0a17831a3d monitor: Clean up how monitor_disas() funnels output to monitor
7552bb783c qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
f8829004b6 qemu-print: New qemu_fprintf(), qemu_vfprintf()
6e17d7886f qom/cpu: Simplify how CPUClass::dump_statistics() prints
b9e7cc19f9 target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
d0235ec2aa target: Clean up how the dump_mmu() print
5ac5266b18 target: Simplify how the TARGET_cpu_list() print
537efe83e7 memory: Clean up how mtree_info() prints
d8c0a5610f block/qapi: Clean up how we print to monitor or stdout
1f2593e991 qsp: Simplify how qsp_report() prints
8ddded1f2c tcg: Simplify how dump_drift_info() prints
50a002becd tcg: Simplify how dump_exec_info() prints
eb737a179a tcg: Simplify how dump_opcount_info() prints
298229bbdd trace: Simplify how st_print_trace_file_status() prints
8a2715b3db include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit 8a2715b3db01 (include: Include fprintf-fn.h only where needed)
2/17 Checking commit 298229bbddd0 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit eb737a179ad4 (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit 50a002becdd9 (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit 8ddded1f2ce1 (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit 1f2593e99199 (qsp: Simplify how qsp_report() prints)
7/17 Checking commit d8c0a5610f9d (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit 537efe83e7af (memory: Clean up how mtree_info() prints)
9/17 Checking commit 5ac5266b18f3 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit d0235ec2aa72 (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit b9e7cc19f90d (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit 6e17d7886f80 (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit f8829004b621 (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit 7552bb783c08 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit 0a17831a3dbe (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit 416f563f47e7 (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit 587c26c24e65 (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (21 preceding siblings ...)
  2019-04-17 20:01 ` no-reply
@ 2019-04-17 20:06 ` no-reply
  2019-04-17 20:10 ` no-reply
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 20:06 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
4efc614089 include: Move fprintf_function to disas/
609b068e91 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
b60826bdec monitor: Clean up how monitor_disas() funnels output to monitor
7e0a83951c qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
0310913eaf qemu-print: New qemu_fprintf(), qemu_vfprintf()
de8e759927 qom/cpu: Simplify how CPUClass::dump_statistics() prints
21575fb486 target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
5e14da45f9 target: Clean up how the dump_mmu() print
d38f591f4a target: Simplify how the TARGET_cpu_list() print
f6d226a80d memory: Clean up how mtree_info() prints
dea28d5474 block/qapi: Clean up how we print to monitor or stdout
18cc598399 qsp: Simplify how qsp_report() prints
a2acbfe35b tcg: Simplify how dump_drift_info() prints
746793c924 tcg: Simplify how dump_exec_info() prints
48e5796804 tcg: Simplify how dump_opcount_info() prints
2788f8a6c8 trace: Simplify how st_print_trace_file_status() prints
b667f124bf include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit b667f124bfd4 (include: Include fprintf-fn.h only where needed)
2/17 Checking commit 2788f8a6c887 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit 48e579680473 (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit 746793c92494 (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit a2acbfe35b3f (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit 18cc59839940 (qsp: Simplify how qsp_report() prints)
7/17 Checking commit dea28d5474ce (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit f6d226a80d57 (memory: Clean up how mtree_info() prints)
9/17 Checking commit d38f591f4af4 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit 5e14da45f92c (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit 21575fb486ef (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit de8e75992712 (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit 0310913eaf37 (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit 7e0a83951c37 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit b60826bdec60 (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit 609b068e9185 (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit 4efc61408903 (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (22 preceding siblings ...)
  2019-04-17 20:06 ` no-reply
@ 2019-04-17 20:10 ` no-reply
  2019-04-17 20:13 ` no-reply
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 20:10 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
c8c93e61d1 include: Move fprintf_function to disas/
f5674f82b2 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
08e5c5c637 monitor: Clean up how monitor_disas() funnels output to monitor
5758566368 qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
263852f63a qemu-print: New qemu_fprintf(), qemu_vfprintf()
005251581b qom/cpu: Simplify how CPUClass::dump_statistics() prints
207d3db725 target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
d9cc902329 target: Clean up how the dump_mmu() print
827021bdb4 target: Simplify how the TARGET_cpu_list() print
f5dfd1ae06 memory: Clean up how mtree_info() prints
ea4b4273ed block/qapi: Clean up how we print to monitor or stdout
cf6447c2ca qsp: Simplify how qsp_report() prints
66120f6a1e tcg: Simplify how dump_drift_info() prints
872e71e6a3 tcg: Simplify how dump_exec_info() prints
49dadefa20 tcg: Simplify how dump_opcount_info() prints
ce1a847509 trace: Simplify how st_print_trace_file_status() prints
20ac898544 include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit 20ac898544d2 (include: Include fprintf-fn.h only where needed)
2/17 Checking commit ce1a8475095a (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit 49dadefa2093 (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit 872e71e6a30d (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit 66120f6a1e65 (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit cf6447c2ca7d (qsp: Simplify how qsp_report() prints)
7/17 Checking commit ea4b4273ed42 (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit f5dfd1ae06f7 (memory: Clean up how mtree_info() prints)
9/17 Checking commit 827021bdb479 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit d9cc9023295d (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit 207d3db72502 (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit 005251581b3b (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit 263852f63aa4 (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit 5758566368d1 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit 08e5c5c637d7 (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit f5674f82b2d3 (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit c8c93e61d132 (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (23 preceding siblings ...)
  2019-04-17 20:10 ` no-reply
@ 2019-04-17 20:13 ` no-reply
  2019-04-17 20:17 ` no-reply
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 20:13 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
dfb284c449 include: Move fprintf_function to disas/
dbc3e8039f disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
71f572cab2 monitor: Clean up how monitor_disas() funnels output to monitor
67cdf8cf8b qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
6a1d72f66f qemu-print: New qemu_fprintf(), qemu_vfprintf()
b6e8226b5c qom/cpu: Simplify how CPUClass::dump_statistics() prints
fea77047bb target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
f850e6e38b target: Clean up how the dump_mmu() print
f36f9982d5 target: Simplify how the TARGET_cpu_list() print
97472bedb7 memory: Clean up how mtree_info() prints
09a19b6e63 block/qapi: Clean up how we print to monitor or stdout
68ff1d89f6 qsp: Simplify how qsp_report() prints
6777d9cdfd tcg: Simplify how dump_drift_info() prints
dc643ac146 tcg: Simplify how dump_exec_info() prints
9801855090 tcg: Simplify how dump_opcount_info() prints
7530ac3e60 trace: Simplify how st_print_trace_file_status() prints
8d5be4b138 include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit 8d5be4b13878 (include: Include fprintf-fn.h only where needed)
2/17 Checking commit 7530ac3e60b5 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit 980185509054 (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit dc643ac146c5 (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit 6777d9cdfd98 (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit 68ff1d89f658 (qsp: Simplify how qsp_report() prints)
7/17 Checking commit 09a19b6e63c7 (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit 97472bedb71b (memory: Clean up how mtree_info() prints)
9/17 Checking commit f36f9982d564 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit f850e6e38bf3 (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit fea77047bbff (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit b6e8226b5c46 (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit 6a1d72f66f1b (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit 67cdf8cf8b1f (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit 71f572cab24d (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit dbc3e8039f78 (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit dfb284c44975 (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (24 preceding siblings ...)
  2019-04-17 20:13 ` no-reply
@ 2019-04-17 20:17 ` no-reply
  2019-04-17 20:22 ` no-reply
  2019-04-17 20:27 ` no-reply
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 20:17 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
dbad74bf63 include: Move fprintf_function to disas/
8056ad6cd3 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
90edbaf518 monitor: Clean up how monitor_disas() funnels output to monitor
9dacaf5ef7 qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
5e6905625e qemu-print: New qemu_fprintf(), qemu_vfprintf()
149609b2ad qom/cpu: Simplify how CPUClass::dump_statistics() prints
64fad59c2e target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
d0d676884c target: Clean up how the dump_mmu() print
e62415eb3c target: Simplify how the TARGET_cpu_list() print
6b93fa5e80 memory: Clean up how mtree_info() prints
e55e74cdf1 block/qapi: Clean up how we print to monitor or stdout
922dc9a331 qsp: Simplify how qsp_report() prints
a319820a6d tcg: Simplify how dump_drift_info() prints
7e213bdc95 tcg: Simplify how dump_exec_info() prints
a8dbca91a2 tcg: Simplify how dump_opcount_info() prints
8f9d9b1b12 trace: Simplify how st_print_trace_file_status() prints
7bf430b203 include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit 7bf430b2033a (include: Include fprintf-fn.h only where needed)
2/17 Checking commit 8f9d9b1b1263 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit a8dbca91a2fb (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit 7e213bdc9596 (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit a319820a6d62 (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit 922dc9a33160 (qsp: Simplify how qsp_report() prints)
7/17 Checking commit e55e74cdf1f9 (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit 6b93fa5e8004 (memory: Clean up how mtree_info() prints)
9/17 Checking commit e62415eb3c51 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit d0d676884c52 (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit 64fad59c2e43 (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit 149609b2ad9b (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit 5e6905625eeb (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit 9dacaf5ef718 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit 90edbaf518e3 (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit 8056ad6cd3d8 (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit dbad74bf63f2 (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (25 preceding siblings ...)
  2019-04-17 20:17 ` no-reply
@ 2019-04-17 20:22 ` no-reply
  2019-04-17 20:27 ` no-reply
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 20:22 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
90107e0ecd include: Move fprintf_function to disas/
08c75e94b5 disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
b35d73a420 monitor: Clean up how monitor_disas() funnels output to monitor
4f0c3493f6 qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
68f63bc7a9 qemu-print: New qemu_fprintf(), qemu_vfprintf()
d41d47ee91 qom/cpu: Simplify how CPUClass::dump_statistics() prints
df73a8c8e6 target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
edc6b2832c target: Clean up how the dump_mmu() print
482f38cd69 target: Simplify how the TARGET_cpu_list() print
18b22c842c memory: Clean up how mtree_info() prints
2dfb27eebe block/qapi: Clean up how we print to monitor or stdout
10b6b38b8a qsp: Simplify how qsp_report() prints
3a161a6792 tcg: Simplify how dump_drift_info() prints
e340f7a5c0 tcg: Simplify how dump_exec_info() prints
bdd8aea085 tcg: Simplify how dump_opcount_info() prints
0cb2f55550 trace: Simplify how st_print_trace_file_status() prints
dcae6b30f1 include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit dcae6b30f156 (include: Include fprintf-fn.h only where needed)
2/17 Checking commit 0cb2f5555029 (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit bdd8aea085c0 (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit e340f7a5c047 (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit 3a161a679275 (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit 10b6b38b8ae9 (qsp: Simplify how qsp_report() prints)
7/17 Checking commit 2dfb27eebe4e (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit 18b22c842ccb (memory: Clean up how mtree_info() prints)
9/17 Checking commit 482f38cd6965 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit edc6b2832c82 (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit df73a8c8e645 (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit d41d47ee915e (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit 68f63bc7a914 (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit 4f0c3493f69b (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit b35d73a42067 (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit 08c75e94b574 (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit 90107e0ecdfa (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
  2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
                   ` (26 preceding siblings ...)
  2019-04-17 20:22 ` no-reply
@ 2019-04-17 20:27 ` no-reply
  27 siblings, 0 replies; 35+ messages in thread
From: no-reply @ 2019-04-17 20:27 UTC (permalink / raw)
  To: armbru; +Cc: fam, qemu-devel, dgilbert

Patchew URL: https://patchew.org/QEMU/20190417191805.28198-1-armbru@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190417191805.28198-1-armbru@redhat.com
Subject: [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 t [tag update]            patchew/20190417191805.28198-1-armbru@redhat.com -> patchew/20190417191805.28198-1-armbru@redhat.com
Switched to a new branch 'test'
db19e834f8 include: Move fprintf_function to disas/
4413299b4d disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
4daa71b4be monitor: Clean up how monitor_disas() funnels output to monitor
8db320f550 qom/cpu: Simplify how CPUClass:cpu_dump_state() prints
b71147d0c2 qemu-print: New qemu_fprintf(), qemu_vfprintf()
27a5a25b67 qom/cpu: Simplify how CPUClass::dump_statistics() prints
a83cbb831d target/i386: Simplify how x86_cpu_dump_local_apic_state() prints
245613cc1b target: Clean up how the dump_mmu() print
10998140d5 target: Simplify how the TARGET_cpu_list() print
2e76bc9d7c memory: Clean up how mtree_info() prints
fef413a9bc block/qapi: Clean up how we print to monitor or stdout
72de8879b2 qsp: Simplify how qsp_report() prints
89b234381a tcg: Simplify how dump_drift_info() prints
511085a3f7 tcg: Simplify how dump_exec_info() prints
8a89bb3a52 tcg: Simplify how dump_opcount_info() prints
d8a29469b3 trace: Simplify how st_print_trace_file_status() prints
d1ffc558ad include: Include fprintf-fn.h only where needed

=== OUTPUT BEGIN ===
1/17 Checking commit d1ffc558ada9 (include: Include fprintf-fn.h only where needed)
2/17 Checking commit d8a29469b38b (trace: Simplify how st_print_trace_file_status() prints)
3/17 Checking commit 8a89bb3a523a (tcg: Simplify how dump_opcount_info() prints)
4/17 Checking commit 511085a3f704 (tcg: Simplify how dump_exec_info() prints)
5/17 Checking commit 89b234381aef (tcg: Simplify how dump_drift_info() prints)
6/17 Checking commit 72de8879b2a5 (qsp: Simplify how qsp_report() prints)
7/17 Checking commit fef413a9bc34 (block/qapi: Clean up how we print to monitor or stdout)
8/17 Checking commit 2e76bc9d7c92 (memory: Clean up how mtree_info() prints)
9/17 Checking commit 10998140d529 (target: Simplify how the TARGET_cpu_list() print)
10/17 Checking commit 245613cc1b1e (target: Clean up how the dump_mmu() print)
WARNING: line over 80 characters
#950: FILE: target/xtensa/mmu_helper.c:784:
+                    qemu_printf("\tVaddr       Paddr       ASID  Attr RWX Cache\n"

total: 0 errors, 1 warnings, 848 lines checked

Patch 10/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
11/17 Checking commit a83cbb831dfb (target/i386: Simplify how x86_cpu_dump_local_apic_state() prints)
12/17 Checking commit 27a5a25b6773 (qom/cpu: Simplify how CPUClass::dump_statistics() prints)
13/17 Checking commit b71147d0c208 (qemu-print: New qemu_fprintf(), qemu_vfprintf())
14/17 Checking commit 8db320f55011 (qom/cpu: Simplify how CPUClass:cpu_dump_state() prints)
ERROR: line over 90 characters
#1051: FILE: target/i386/helper.c:419:
+        qemu_fprintf(f, "RAX=%016" PRIx64 " RBX=%016" PRIx64 " RCX=%016" PRIx64 " RDX=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1052: FILE: target/i386/helper.c:420:
+                     "RSI=%016" PRIx64 " RDI=%016" PRIx64 " RBP=%016" PRIx64 " RSP=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1053: FILE: target/i386/helper.c:421:
+                     "R8 =%016" PRIx64 " R9 =%016" PRIx64 " R10=%016" PRIx64 " R11=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1054: FILE: target/i386/helper.c:422:
+                     "R12=%016" PRIx64 " R13=%016" PRIx64 " R14=%016" PRIx64 " R15=%016" PRIx64 "\n"

ERROR: line over 90 characters
#1055: FILE: target/i386/helper.c:423:
+                     "RIP=%016" PRIx64 " RFL=%08x [%c%c%c%c%c%c%c] CPL=%d II=%d A20=%d SMM=%d HLT=%d\n",

WARNING: line over 80 characters
#1163: FILE: target/i386/helper.c:494:
+        qemu_fprintf(f, "CR0=%08x CR2=%016" PRIx64 " CR3=%016" PRIx64 " CR4=%08x\n",

WARNING: line over 80 characters
#1751: FILE: target/mips/translate.c:29791:
+    qemu_fprintf(f, "CP0 Status  0x%08x Cause   0x%08x EPC    0x" TARGET_FMT_lx "\n",

total: 5 errors, 2 warnings, 2551 lines checked

Patch 14/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

15/17 Checking commit 4daa71b4bee9 (monitor: Clean up how monitor_disas() funnels output to monitor)
16/17 Checking commit 4413299b4d9a (disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#296: 
rename from include/disas/bfd.h

total: 0 errors, 1 warnings, 192 lines checked

Patch 16/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/17 Checking commit db19e834f826 (include: Move fprintf_function to disas/)
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#45: 
deleted file mode 100644

total: 0 errors, 1 warnings, 17 lines checked

Patch 17/17 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190417191805.28198-1-armbru@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [Qemu-devel] [PATCH v2 15/17] monitor: Clean up how monitor_disas() funnels output to monitor
  2019-04-17 19:35   ` Eric Blake
@ 2019-04-18  6:20     ` Markus Armbruster
  0 siblings, 0 replies; 35+ messages in thread
From: Markus Armbruster @ 2019-04-18  6:20 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, dgilbert

Eric Blake <eblake@redhat.com> writes:

> On 4/17/19 2:18 PM, Markus Armbruster wrote:
>> INIT_DISASSEMBLE_INFO() takes an fprintf()-like callback and a FILE *
>> to pass to it.  monitor_disas() passes monitor_fprintf() and the
>> current monitor cast to FILE *.  monitor_fprintf() casts it right
>> back, and is otherwise identical to monitor_printf().  The
>> type-pinning is ugly.
>
> For consistency with other patches in the series, s/pinning/punning/

Typo, will fix.  Thanks!

>> 
>> Pass qemu_fprintf() and NULL instead.
>> 
>> monitor_fprintf() is now unused; delete it.
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>> ---

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

* Re: [Qemu-devel] [PATCH v2 09/17] target: Simplify how the TARGET_cpu_list() print
  2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 09/17] target: Simplify how the TARGET_cpu_list() print Markus Armbruster
@ 2019-04-18 11:28   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 35+ messages in thread
From: Dr. David Alan Gilbert @ 2019-04-18 11:28 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

* Markus Armbruster (armbru@redhat.com) wrote:
> The various TARGET_cpu_list() take an fprintf()-like callback and a
> FILE * to pass to it.  Their callers (vl.c's main() via list_cpus(),
> bsd-user/main.c's main(), linux-user/main.c's main()) all pass
> fprintf() and stdout.  Thus, the flexibility provided by the (rather
> tiresome) indirection isn't actually used.
> 
> Drop the callback, and call qemu_printf() instead.
> 
> Calling printf() would also work, but would make the code unsuitable
> for monitor context without making it simpler.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  bsd-user/main.c                  |  2 +-
>  cpus.c                           |  4 +--
>  include/exec/cpu-common.h        | 13 ---------
>  include/sysemu/cpus.h            |  3 +-
>  linux-user/main.c                |  2 +-
>  target/alpha/cpu.c               | 15 ++++------
>  target/alpha/cpu.h               |  2 +-
>  target/arm/cpu.c                 |  1 -
>  target/arm/cpu.h                 |  2 +-
>  target/arm/helper.c              | 15 ++++------
>  target/cris/cpu.c                | 14 ++++-----
>  target/cris/cpu.h                |  2 +-
>  target/hppa/cpu.c                | 14 ++++-----
>  target/hppa/cpu.h                |  2 +-
>  target/i386/cpu.c                | 29 ++++++++-----------
>  target/i386/cpu.h                |  2 +-
>  target/lm32/cpu.c                | 14 ++++-----
>  target/lm32/cpu.h                |  2 +-
>  target/m68k/cpu.h                |  2 +-
>  target/m68k/helper.c             | 14 +++------
>  target/mips/cpu.h                |  2 +-
>  target/mips/translate.c          |  1 +
>  target/mips/translate_init.inc.c |  5 ++--
>  target/openrisc/cpu.c            | 15 ++++------
>  target/openrisc/cpu.h            |  2 +-
>  target/ppc/cpu.h                 |  2 +-
>  target/ppc/translate_init.inc.c  | 26 +++++++----------
>  target/riscv/cpu.c               | 17 +++--------
>  target/riscv/cpu.h               |  2 +-
>  target/s390x/cpu.h               |  2 +-
>  target/s390x/cpu_models.c        | 21 ++++++--------
>  target/sh4/cpu.c                 | 17 +++--------
>  target/sh4/cpu.h                 |  2 +-
>  target/sparc/cpu.c               | 49 +++++++++++++++-----------------
>  target/sparc/cpu.h               |  2 +-
>  target/tricore/cpu.h             |  2 +-
>  target/tricore/helper.c          | 15 ++++------
>  target/xtensa/cpu.h              |  2 +-
>  target/xtensa/helper.c           |  7 +++--
>  vl.c                             |  2 +-
>  40 files changed, 129 insertions(+), 218 deletions(-)
> 
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 8fd8ae4127..7657c6851d 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -819,7 +819,7 @@ int main(int argc, char **argv)
>              if (is_help_option(cpu_model)) {
>  /* XXX: implement xxx_cpu_list for targets that still miss it */
>  #if defined(cpu_list)
> -                    cpu_list(stdout, &fprintf);
> +                    cpu_list();
>  #endif
>                  exit(1);
>              }
> diff --git a/cpus.c b/cpus.c
> index 684aa9679a..b4eecf70f0 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -2181,11 +2181,11 @@ int vm_stop_force_state(RunState state)
>      }
>  }
>  
> -void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg)
> +void list_cpus(const char *optarg)
>  {
>      /* XXX: implement xxx_cpu_list for targets that still miss it */
>  #if defined(cpu_list)
> -    cpu_list(f, cpu_fprintf);
> +    cpu_list();
>  #endif
>  }
>  
> diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
> index cef8b88a2a..848a4b94ab 100644
> --- a/include/exec/cpu-common.h
> +++ b/include/exec/cpu-common.h
> @@ -9,19 +9,6 @@
>  
>  #include "qemu/bswap.h"
>  #include "qemu/queue.h"
> -#include "qemu/fprintf-fn.h"
> -
> -/**
> - * CPUListState:
> - * @cpu_fprintf: Print function.
> - * @file: File to print to using @cpu_fprint.
> - *
> - * State commonly used for iterating over CPU models.
> - */
> -typedef struct CPUListState {
> -    fprintf_function cpu_fprintf;
> -    FILE *file;
> -} CPUListState;
>  
>  /* The CPU list lock nests outside page_(un)lock or mmap_(un)lock */
>  void qemu_init_cpu_list(void);
> diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
> index ef13a120cc..32c05f27e7 100644
> --- a/include/sysemu/cpus.h
> +++ b/include/sysemu/cpus.h
> @@ -1,7 +1,6 @@
>  #ifndef QEMU_CPUS_H
>  #define QEMU_CPUS_H
>  
> -#include "qemu/fprintf-fn.h"
>  #include "qemu/timer.h"
>  
>  /* cpus.c */
> @@ -39,7 +38,7 @@ extern int smp_cores;
>  extern int smp_threads;
>  #endif
>  
> -void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg);
> +void list_cpus(const char *optarg);
>  
>  void qemu_tcg_configure(QemuOpts *opts, Error **errp);
>  
> diff --git a/linux-user/main.c b/linux-user/main.c
> index f9efe9ff6e..17387166ab 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -317,7 +317,7 @@ static void handle_arg_cpu(const char *arg)
>      if (cpu_model == NULL || is_help_option(cpu_model)) {
>          /* XXX: implement xxx_cpu_list for targets that still miss it */
>  #if defined(cpu_list)
> -        cpu_list(stdout, &fprintf);
> +        cpu_list();
>  #endif
>          exit(EXIT_FAILURE);
>      }
> diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
> index 1fd95d6c0f..ad3588a44a 100644
> --- a/target/alpha/cpu.c
> +++ b/target/alpha/cpu.c
> @@ -21,6 +21,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/qemu-print.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
>  #include "exec/exec-all.h"
> @@ -74,23 +75,17 @@ static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
>  static void alpha_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
> -    CPUListState *s = user_data;
>  
> -    (*s->cpu_fprintf)(s->file, "  %s\n",
> -                      object_class_get_name(oc));
> +    qemu_printf("  %s\n", object_class_get_name(oc));
>  }
>  
> -void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void alpha_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list_sorted(TYPE_ALPHA_CPU, false);
> -    (*cpu_fprintf)(f, "Available CPUs:\n");
> -    g_slist_foreach(list, alpha_cpu_list_entry, &s);
> +    qemu_printf("Available CPUs:\n");
> +    g_slist_foreach(list, alpha_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/alpha/cpu.h b/target/alpha/cpu.h
> index 7b50be785d..732764f23c 100644
> --- a/target/alpha/cpu.h
> +++ b/target/alpha/cpu.h
> @@ -470,7 +470,7 @@ void alpha_translate_init(void);
>  #define ALPHA_CPU_TYPE_NAME(model) model ALPHA_CPU_TYPE_SUFFIX
>  #define CPU_RESOLVING_TYPE TYPE_ALPHA_CPU
>  
> -void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void alpha_cpu_list(void);
>  /* you can call this signal handler from your SIGBUS and SIGSEGV
>     signal handlers to inform the virtual CPU of exceptions. non zero
>     is returned if the signal was handled by the virtual CPU.  */
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 4155782197..bb9fdc6304 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -20,7 +20,6 @@
>  
>  #include "qemu/osdep.h"
>  #include "target/arm/idau.h"
> -#include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "qapi/visitor.h"
>  #include "cpu.h"
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index d4d2836923..85c3bd642a 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -1936,7 +1936,7 @@ static inline bool access_secure_reg(CPUARMState *env)
>                         (arm_is_secure(_env) && !arm_el_is_aa64((_env), 3)), \
>                         (_val))
>  
> -void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void arm_cpu_list(void);
>  uint32_t arm_phys_excp_target_el(CPUState *cs, uint32_t excp_idx,
>                                   uint32_t cur_el, bool secure);
>  
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index a36f4b3d69..57ef75b3fc 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -10,6 +10,7 @@
>  #include "sysemu/sysemu.h"
>  #include "qemu/bitops.h"
>  #include "qemu/crc32c.h"
> +#include "qemu/qemu-print.h"
>  #include "exec/exec-all.h"
>  #include "exec/cpu_ldst.h"
>  #include "arm_ldst.h"
> @@ -6724,29 +6725,23 @@ static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b)
>  static void arm_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
> -    CPUListState *s = user_data;
>      const char *typename;
>      char *name;
>  
>      typename = object_class_get_name(oc);
>      name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_ARM_CPU));
> -    (*s->cpu_fprintf)(s->file, "  %s\n",
> -                      name);
> +    qemu_printf("  %s\n", name);
>      g_free(name);
>  }
>  
> -void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void arm_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list(TYPE_ARM_CPU, false);
>      list = g_slist_sort(list, arm_cpu_list_compare);
> -    (*cpu_fprintf)(f, "Available CPUs:\n");
> -    g_slist_foreach(list, arm_cpu_list_entry, &s);
> +    qemu_printf("Available CPUs:\n");
> +    g_slist_foreach(list, arm_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/cris/cpu.c b/target/cris/cpu.c
> index a23aba2688..75729bfdd5 100644
> --- a/target/cris/cpu.c
> +++ b/target/cris/cpu.c
> @@ -23,6 +23,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/qemu-print.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
>  #include "mmu.h"
> @@ -103,27 +104,22 @@ static gint cris_cpu_list_compare(gconstpointer a, gconstpointer b)
>  static void cris_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
> -    CPUListState *s = user_data;
>      const char *typename = object_class_get_name(oc);
>      char *name;
>  
>      name = g_strndup(typename, strlen(typename) - strlen(CRIS_CPU_TYPE_SUFFIX));
> -    (*s->cpu_fprintf)(s->file, "  %s\n", name);
> +    qemu_printf("  %s\n", name);
>      g_free(name);
>  }
>  
> -void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void cris_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list(TYPE_CRIS_CPU, false);
>      list = g_slist_sort(list, cris_cpu_list_compare);
> -    (*cpu_fprintf)(f, "Available CPUs:\n");
> -    g_slist_foreach(list, cris_cpu_list_entry, &s);
> +    qemu_printf("Available CPUs:\n");
> +    g_slist_foreach(list, cris_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/cris/cpu.h b/target/cris/cpu.h
> index 8bb1dbc989..3d11922fb2 100644
> --- a/target/cris/cpu.h
> +++ b/target/cris/cpu.h
> @@ -308,6 +308,6 @@ static inline void cpu_get_tb_cpu_state(CPUCRISState *env, target_ulong *pc,
>  }
>  
>  #define cpu_list cris_cpu_list
> -void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void cris_cpu_list(void);
>  
>  #endif
> diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
> index 00bf444620..e64f48581e 100644
> --- a/target/hppa/cpu.c
> +++ b/target/hppa/cpu.c
> @@ -20,6 +20,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/qemu-print.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
>  #include "exec/exec-all.h"
> @@ -113,22 +114,17 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
>  static void hppa_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
> -    CPUListState *s = user_data;
>  
> -    (*s->cpu_fprintf)(s->file, "  %s\n", object_class_get_name(oc));
> +    qemu_printf("  %s\n", object_class_get_name(oc));
>  }
>  
> -void hppa_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void hppa_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list_sorted(TYPE_HPPA_CPU, false);
> -    (*cpu_fprintf)(f, "Available CPUs:\n");
> -    g_slist_foreach(list, hppa_cpu_list_entry, &s);
> +    qemu_printf("Available CPUs:\n");
> +    g_slist_foreach(list, hppa_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h
> index c062c7969c..db8c9b812c 100644
> --- a/target/hppa/cpu.h
> +++ b/target/hppa/cpu.h
> @@ -272,7 +272,7 @@ void hppa_translate_init(void);
>  
>  #define CPU_RESOLVING_TYPE TYPE_HPPA_CPU
>  
> -void hppa_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void hppa_cpu_list(void);
>  
>  static inline target_ulong hppa_form_gva_psw(target_ureg psw, uint64_t spc,
>                                               target_ureg off)
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index d6bb57d210..e1687f7547 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -21,6 +21,7 @@
>  #include "qemu/units.h"
>  #include "qemu/cutils.h"
>  #include "qemu/bitops.h"
> +#include "qemu/qemu-print.h"
>  
>  #include "cpu.h"
>  #include "exec/exec-all.h"
> @@ -3671,7 +3672,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
>  
>  /* Print all cpuid feature names in featureset
>   */
> -static void listflags(FILE *f, fprintf_function print, GList *features)
> +static void listflags(GList *features)
>  {
>      size_t len = 0;
>      GList *tmp;
> @@ -3679,13 +3680,13 @@ static void listflags(FILE *f, fprintf_function print, GList *features)
>      for (tmp = features; tmp; tmp = tmp->next) {
>          const char *name = tmp->data;
>          if ((len + strlen(name) + 1) >= 75) {
> -            print(f, "\n");
> +            qemu_printf("\n");
>              len = 0;
>          }
> -        print(f, "%s%s", len == 0 ? "  " : " ", name);
> +        qemu_printf("%s%s", len == 0 ? "  " : " ", name);
>          len += strlen(name) + 1;
>      }
> -    print(f, "\n");
> +    qemu_printf("\n");
>  }
>  
>  /* Sort alphabetically by type name, respecting X86CPUClass::ordering. */
> @@ -3721,32 +3722,26 @@ static void x86_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
>      X86CPUClass *cc = X86_CPU_CLASS(oc);
> -    CPUListState *s = user_data;
>      char *name = x86_cpu_class_get_model_name(cc);
>      const char *desc = cc->model_description;
>      if (!desc && cc->cpu_def) {
>          desc = cc->cpu_def->model_id;
>      }
>  
> -    (*s->cpu_fprintf)(s->file, "x86 %-20s  %-48s\n",
> -                      name, desc);
> +    qemu_printf("x86 %-20s  %-48s\n", name, desc);
>      g_free(name);
>  }
>  
>  /* list available CPU models and flags */
> -void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void x86_cpu_list(void)
>  {
>      int i, j;
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>      GList *names = NULL;
>  
> -    (*cpu_fprintf)(f, "Available CPUs:\n");
> +    qemu_printf("Available CPUs:\n");
>      list = get_sorted_cpu_model_list();
> -    g_slist_foreach(list, x86_cpu_list_entry, &s);
> +    g_slist_foreach(list, x86_cpu_list_entry, NULL);
>      g_slist_free(list);
>  
>      names = NULL;
> @@ -3761,9 +3756,9 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf)
>  
>      names = g_list_sort(names, (GCompareFunc)strcmp);
>  
> -    (*cpu_fprintf)(f, "\nRecognized CPUID flags:\n");
> -    listflags(f, cpu_fprintf, names);
> -    (*cpu_fprintf)(f, "\n");
> +    qemu_printf("\nRecognized CPUID flags:\n");
> +    listflags(names);
> +    qemu_printf("\n");
>      g_list_free(names);
>  }
>  
> diff --git a/target/i386/cpu.h b/target/i386/cpu.h
> index 83fb522554..b39327dcb7 100644
> --- a/target/i386/cpu.h
> +++ b/target/i386/cpu.h
> @@ -1532,7 +1532,7 @@ int x86_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg);
>  void x86_cpu_exec_enter(CPUState *cpu);
>  void x86_cpu_exec_exit(CPUState *cpu);
>  
> -void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void x86_cpu_list(void);
>  int cpu_x86_support_mca_broadcast(CPUX86State *env);
>  
>  int cpu_get_pic_interrupt(CPUX86State *s);
> diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
> index b7499cb627..282da19994 100644
> --- a/target/lm32/cpu.c
> +++ b/target/lm32/cpu.c
> @@ -20,6 +20,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/qemu-print.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
>  
> @@ -34,27 +35,22 @@ static void lm32_cpu_set_pc(CPUState *cs, vaddr value)
>  static void lm32_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
> -    CPUListState *s = user_data;
>      const char *typename = object_class_get_name(oc);
>      char *name;
>  
>      name = g_strndup(typename, strlen(typename) - strlen(LM32_CPU_TYPE_SUFFIX));
> -    (*s->cpu_fprintf)(s->file, "  %s\n", name);
> +    qemu_printf("  %s\n", name);
>      g_free(name);
>  }
>  
>  
> -void lm32_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void lm32_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list_sorted(TYPE_LM32_CPU, false);
> -    (*cpu_fprintf)(f, "Available CPUs:\n");
> -    g_slist_foreach(list, lm32_cpu_list_entry, &s);
> +    qemu_printf("Available CPUs:\n");
> +    g_slist_foreach(list, lm32_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/lm32/cpu.h b/target/lm32/cpu.h
> index 66157eefe9..b8d539ead8 100644
> --- a/target/lm32/cpu.h
> +++ b/target/lm32/cpu.h
> @@ -243,7 +243,7 @@ static inline lm32_wp_t lm32_wp_type(uint32_t dc, int idx)
>     is returned if the signal was handled by the virtual CPU.  */
>  int cpu_lm32_signal_handler(int host_signum, void *pinfo,
>                            void *puc);
> -void lm32_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void lm32_cpu_list(void);
>  void lm32_translate_init(void);
>  void cpu_lm32_set_phys_msb_ignore(CPULM32State *env, int value);
>  void QEMU_NORETURN raise_exception(CPULM32State *env, int index);
> diff --git a/target/m68k/cpu.h b/target/m68k/cpu.h
> index f154565117..9c1f0a2458 100644
> --- a/target/m68k/cpu.h
> +++ b/target/m68k/cpu.h
> @@ -499,7 +499,7 @@ static inline int m68k_feature(CPUM68KState *env, int feature)
>      return (env->features & (1u << feature)) != 0;
>  }
>  
> -void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void m68k_cpu_list(void);
>  
>  void register_m68k_insns (CPUM68KState *env);
>  
> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
> index 3e26d337bf..bb64cf15c0 100644
> --- a/target/m68k/helper.c
> +++ b/target/m68k/helper.c
> @@ -22,9 +22,9 @@
>  #include "cpu.h"
>  #include "exec/exec-all.h"
>  #include "exec/gdbstub.h"
> -
>  #include "exec/helper-proto.h"
>  #include "fpu/softfloat.h"
> +#include "qemu/qemu-print.h"
>  
>  #define SIGNBIT (1u << 31)
>  
> @@ -49,28 +49,22 @@ static gint m68k_cpu_list_compare(gconstpointer a, gconstpointer b)
>  static void m68k_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *c = data;
> -    CPUListState *s = user_data;
>      const char *typename;
>      char *name;
>  
>      typename = object_class_get_name(c);
>      name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_M68K_CPU));
> -    (*s->cpu_fprintf)(s->file, "%s\n",
> -                      name);
> +    qemu_printf("%s\n", name);
>      g_free(name);
>  }
>  
> -void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void m68k_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list(TYPE_M68K_CPU, false);
>      list = g_slist_sort(list, m68k_cpu_list_compare);
> -    g_slist_foreach(list, m68k_cpu_list_entry, &s);
> +    g_slist_foreach(list, m68k_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/mips/cpu.h b/target/mips/cpu.h
> index a10eeb0de3..1f41cf66d5 100644
> --- a/target/mips/cpu.h
> +++ b/target/mips/cpu.h
> @@ -1065,7 +1065,7 @@ static inline MIPSCPU *mips_env_get_cpu(CPUMIPSState *env)
>  
>  #define ENV_OFFSET offsetof(MIPSCPU, env)
>  
> -void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf);
> +void mips_cpu_list(void);
>  
>  #define cpu_signal_handler cpu_mips_signal_handler
>  #define cpu_list mips_cpu_list
> diff --git a/target/mips/translate.c b/target/mips/translate.c
> index 364bd6dc4f..d886a0c9b2 100644
> --- a/target/mips/translate.c
> +++ b/target/mips/translate.c
> @@ -38,6 +38,7 @@
>  #include "trace-tcg.h"
>  #include "exec/translator.h"
>  #include "exec/log.h"
> +#include "qemu/qemu-print.h"
>  
>  #define MIPS_DEBUG_DISAS 0
>  
> diff --git a/target/mips/translate_init.inc.c b/target/mips/translate_init.inc.c
> index bf559aff08..1c2d017d36 100644
> --- a/target/mips/translate_init.inc.c
> +++ b/target/mips/translate_init.inc.c
> @@ -835,13 +835,12 @@ const mips_def_t mips_defs[] =
>  };
>  const int mips_defs_number = ARRAY_SIZE(mips_defs);
>  
> -void mips_cpu_list (FILE *f, fprintf_function cpu_fprintf)
> +void mips_cpu_list(void)
>  {
>      int i;
>  
>      for (i = 0; i < ARRAY_SIZE(mips_defs); i++) {
> -        (*cpu_fprintf)(f, "MIPS '%s'\n",
> -                       mips_defs[i].name);
> +        qemu_printf("MIPS '%s'\n", mips_defs[i].name);
>      }
>  }
>  
> diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
> index 541b2a66c7..d125236977 100644
> --- a/target/openrisc/cpu.c
> +++ b/target/openrisc/cpu.c
> @@ -19,6 +19,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/qemu-print.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
>  
> @@ -180,30 +181,24 @@ static gint openrisc_cpu_list_compare(gconstpointer a, gconstpointer b)
>  static void openrisc_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
> -    CPUListState *s = user_data;
>      const char *typename;
>      char *name;
>  
>      typename = object_class_get_name(oc);
>      name = g_strndup(typename,
>                       strlen(typename) - strlen("-" TYPE_OPENRISC_CPU));
> -    (*s->cpu_fprintf)(s->file, "  %s\n",
> -                      name);
> +    qemu_printf("  %s\n", name);
>      g_free(name);
>  }
>  
> -void cpu_openrisc_list(FILE *f, fprintf_function cpu_fprintf)
> +void cpu_openrisc_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list(TYPE_OPENRISC_CPU, false);
>      list = g_slist_sort(list, openrisc_cpu_list_compare);
> -    (*cpu_fprintf)(f, "Available CPUs:\n");
> -    g_slist_foreach(list, openrisc_cpu_list_entry, &s);
> +    qemu_printf("Available CPUs:\n");
> +    g_slist_foreach(list, openrisc_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/openrisc/cpu.h b/target/openrisc/cpu.h
> index f1b31bc24a..9d2d49631e 100644
> --- a/target/openrisc/cpu.h
> +++ b/target/openrisc/cpu.h
> @@ -336,7 +336,7 @@ static inline OpenRISCCPU *openrisc_env_get_cpu(CPUOpenRISCState *env)
>  
>  #define ENV_OFFSET offsetof(OpenRISCCPU, env)
>  
> -void cpu_openrisc_list(FILE *f, fprintf_function cpu_fprintf);
> +void cpu_openrisc_list(void);
>  void openrisc_cpu_do_interrupt(CPUState *cpu);
>  bool openrisc_cpu_exec_interrupt(CPUState *cpu, int int_req);
>  void openrisc_cpu_dump_state(CPUState *cpu, FILE *f,
> diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
> index 0707177584..382a323c61 100644
> --- a/target/ppc/cpu.h
> +++ b/target/ppc/cpu.h
> @@ -1308,7 +1308,7 @@ void ppc_store_ptcr(CPUPPCState *env, target_ulong value);
>  #endif /* !defined(CONFIG_USER_ONLY) */
>  void ppc_store_msr (CPUPPCState *env, target_ulong value);
>  
> -void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf);
> +void ppc_cpu_list(void);
>  
>  /* Time-base and decrementer management */
>  #ifndef NO_CPU_IO_DEFS
> diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
> index 0bd555eb19..996356dd99 100644
> --- a/target/ppc/translate_init.inc.c
> +++ b/target/ppc/translate_init.inc.c
> @@ -28,6 +28,7 @@
>  #include "mmu-hash32.h"
>  #include "mmu-hash64.h"
>  #include "qemu/error-report.h"
> +#include "qemu/qemu-print.h"
>  #include "qapi/error.h"
>  #include "qapi/qmp/qnull.h"
>  #include "qapi/visitor.h"
> @@ -10215,7 +10216,6 @@ static gint ppc_cpu_list_compare(gconstpointer a, gconstpointer b)
>  static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
> -    CPUListState *s = user_data;
>      PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
>      DeviceClass *family = DEVICE_CLASS(ppc_cpu_get_family_class(pcc));
>      const char *typename = object_class_get_name(oc);
> @@ -10228,8 +10228,7 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
>  
>      name = g_strndup(typename,
>                       strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
> -    (*s->cpu_fprintf)(s->file, "PowerPC %-16s PVR %08x\n",
> -                      name, pcc->pvr);
> +    qemu_printf("PowerPC %-16s PVR %08x\n", name, pcc->pvr);
>      for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
>          PowerPCCPUAlias *alias = &ppc_cpu_aliases[i];
>          ObjectClass *alias_oc = ppc_cpu_class_by_name(alias->model);
> @@ -10242,33 +10241,28 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
>           * avoid printing the wrong alias here and use "preferred" instead
>           */
>          if (strcmp(alias->alias, family->desc) == 0) {
> -            (*s->cpu_fprintf)(s->file,
> -                              "PowerPC %-16s (alias for preferred %s CPU)\n",
> -                              alias->alias, family->desc);
> +            qemu_printf("PowerPC %-16s (alias for preferred %s CPU)\n",
> +                        alias->alias, family->desc);
>          } else {
> -            (*s->cpu_fprintf)(s->file, "PowerPC %-16s (alias for %s)\n",
> -                              alias->alias, name);
> +            qemu_printf("PowerPC %-16s (alias for %s)\n",
> +                        alias->alias, name);
>          }
>      }
>      g_free(name);
>  }
>  
> -void ppc_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void ppc_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list(TYPE_POWERPC_CPU, false);
>      list = g_slist_sort(list, ppc_cpu_list_compare);
> -    g_slist_foreach(list, ppc_cpu_list_entry, &s);
> +    g_slist_foreach(list, ppc_cpu_list_entry, NULL);
>      g_slist_free(list);
>  
>  #ifdef CONFIG_KVM
> -    cpu_fprintf(f, "\n");
> -    cpu_fprintf(f, "PowerPC %-16s\n", "host");
> +    qemu_printf("\n");
> +    qemu_printf("PowerPC %-16s\n", "host");
>  #endif
>  }
>  
> diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
> index d61bce6d55..104e676ab0 100644
> --- a/target/riscv/cpu.c
> +++ b/target/riscv/cpu.c
> @@ -18,6 +18,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/qemu-print.h"
>  #include "qemu/log.h"
>  #include "cpu.h"
>  #include "exec/exec-all.h"
> @@ -383,11 +384,6 @@ char *riscv_isa_string(RISCVCPU *cpu)
>      return isa_str;
>  }
>  
> -typedef struct RISCVCPUListState {
> -    fprintf_function cpu_fprintf;
> -    FILE *file;
> -} RISCVCPUListState;
> -
>  static gint riscv_cpu_list_compare(gconstpointer a, gconstpointer b)
>  {
>      ObjectClass *class_a = (ObjectClass *)a;
> @@ -401,24 +397,19 @@ static gint riscv_cpu_list_compare(gconstpointer a, gconstpointer b)
>  
>  static void riscv_cpu_list_entry(gpointer data, gpointer user_data)
>  {
> -    RISCVCPUListState *s = user_data;
>      const char *typename = object_class_get_name(OBJECT_CLASS(data));
>      int len = strlen(typename) - strlen(RISCV_CPU_TYPE_SUFFIX);
>  
> -    (*s->cpu_fprintf)(s->file, "%.*s\n", len, typename);
> +    qemu_printf("%.*s\n", len, typename);
>  }
>  
> -void riscv_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void riscv_cpu_list(void)
>  {
> -    RISCVCPUListState s = {
> -        .cpu_fprintf = cpu_fprintf,
> -        .file = f,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list(TYPE_RISCV_CPU, false);
>      list = g_slist_sort(list, riscv_cpu_list_compare);
> -    g_slist_foreach(list, riscv_cpu_list_entry, &s);
> +    g_slist_foreach(list, riscv_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
> index 20bce8742e..7d9f48973f 100644
> --- a/target/riscv/cpu.h
> +++ b/target/riscv/cpu.h
> @@ -264,7 +264,7 @@ void  riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
>  int riscv_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size,
>                                int rw, int mmu_idx);
>  char *riscv_isa_string(RISCVCPU *cpu);
> -void riscv_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void riscv_cpu_list(void);
>  
>  #define cpu_signal_handler riscv_cpu_signal_handler
>  #define cpu_list riscv_cpu_list
> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
> index cb6d77053a..d8990c405a 100644
> --- a/target/s390x/cpu.h
> +++ b/target/s390x/cpu.h
> @@ -753,7 +753,7 @@ static inline uint8_t s390_cpu_get_state(S390CPU *cpu)
>  
>  
>  /* cpu_models.c */
> -void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void s390_cpu_list(void);
>  #define cpu_list s390_cpu_list
>  void s390_set_qemu_cpu_model(uint16_t type, uint8_t gen, uint8_t ec_ga,
>                               const S390FeatInit feat_init);
> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
> index eb125d4d0d..e5afa15512 100644
> --- a/target/s390x/cpu_models.c
> +++ b/target/s390x/cpu_models.c
> @@ -18,6 +18,7 @@
>  #include "qapi/error.h"
>  #include "qapi/visitor.h"
>  #include "qemu/error-report.h"
> +#include "qemu/qemu-print.h"
>  #include "qapi/qmp/qerror.h"
>  #include "qapi/qobject-input-visitor.h"
>  #include "qapi/qmp/qdict.h"
> @@ -308,7 +309,6 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, uint8_t gen, uint8_t ec_ga,
>  
>  static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_data)
>  {
> -    CPUListState *s = user_data;
>      const S390CPUClass *scc = S390_CPU_CLASS((ObjectClass *)data);
>      char *name = g_strdup(object_class_get_name((ObjectClass *)data));
>      const char *details = "";
> @@ -321,8 +321,7 @@ static void s390_print_cpu_model_list_entry(gpointer data, gpointer user_data)
>  
>      /* strip off the -s390x-cpu */
>      g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
> -    (*s->cpu_fprintf)(s->file, "s390 %-15s %-35s %s\n", name, scc->desc,
> -                      details);
> +    qemu_printf("s390 %-15s %-35s %s\n", name, scc->desc, details);
>      g_free(name);
>  }
>  
> @@ -360,33 +359,29 @@ static gint s390_cpu_list_compare(gconstpointer a, gconstpointer b)
>      return cc_a->is_static ? -1 : 1;
>  }
>  
> -void s390_cpu_list(FILE *f, fprintf_function print)
> +void s390_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = print,
> -    };
>      S390FeatGroup group;
>      S390Feat feat;
>      GSList *list;
>  
>      list = object_class_get_list(TYPE_S390_CPU, false);
>      list = g_slist_sort(list, s390_cpu_list_compare);
> -    g_slist_foreach(list, s390_print_cpu_model_list_entry, &s);
> +    g_slist_foreach(list, s390_print_cpu_model_list_entry, NULL);
>      g_slist_free(list);
>  
> -    (*print)(f, "\nRecognized feature flags:\n");
> +    qemu_printf("\nRecognized feature flags:\n");
>      for (feat = 0; feat < S390_FEAT_MAX; feat++) {
>          const S390FeatDef *def = s390_feat_def(feat);
>  
> -        (*print)(f, "%-20s %-50s\n", def->name, def->desc);
> +        qemu_printf("%-20s %-50s\n", def->name, def->desc);
>      }
>  
> -    (*print)(f, "\nRecognized feature groups:\n");
> +    qemu_printf("\nRecognized feature groups:\n");
>      for (group = 0; group < S390_FEAT_GROUP_MAX; group++) {
>          const S390FeatGroupDef *def = s390_feat_group_def(group);
>  
> -        (*print)(f, "%-20s %-50s\n", def->name, def->desc);
> +        qemu_printf("%-20s %-50s\n", def->name, def->desc);
>      }
>  }
>  
> diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
> index b9f393b7c7..da2799082e 100644
> --- a/target/sh4/cpu.c
> +++ b/target/sh4/cpu.c
> @@ -21,6 +21,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
> +#include "qemu/qemu-print.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
>  #include "migration/vmstate.h"
> @@ -79,30 +80,20 @@ static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
>      info->print_insn = print_insn_sh;
>  }
>  
> -typedef struct SuperHCPUListState {
> -    fprintf_function cpu_fprintf;
> -    FILE *file;
> -} SuperHCPUListState;
> -
>  static void superh_cpu_list_entry(gpointer data, gpointer user_data)
>  {
> -    SuperHCPUListState *s = user_data;
>      const char *typename = object_class_get_name(OBJECT_CLASS(data));
>      int len = strlen(typename) - strlen(SUPERH_CPU_TYPE_SUFFIX);
>  
> -    (*s->cpu_fprintf)(s->file, "%.*s\n", len, typename);
> +    qemu_printf("%.*s\n", len, typename);
>  }
>  
> -void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void sh4_cpu_list(void)
>  {
> -    SuperHCPUListState s = {
> -        .cpu_fprintf = cpu_fprintf,
> -        .file = f,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list_sorted(TYPE_SUPERH_CPU, false);
> -    g_slist_foreach(list, superh_cpu_list_entry, &s);
> +    g_slist_foreach(list, superh_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h
> index 775b5743bf..3e43f0a1a5 100644
> --- a/target/sh4/cpu.h
> +++ b/target/sh4/cpu.h
> @@ -247,7 +247,7 @@ int cpu_sh4_signal_handler(int host_signum, void *pinfo,
>  int superh_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int rw,
>                                  int mmu_idx);
>  
> -void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void sh4_cpu_list(void);
>  #if !defined(CONFIG_USER_ONLY)
>  void cpu_sh4_invalidate_tlb(CPUSH4State *s);
>  uint32_t cpu_sh4_read_mmaped_itlb_addr(CPUSH4State *s,
> diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
> index 4a4445bdf5..fd88a31806 100644
> --- a/target/sparc/cpu.c
> +++ b/target/sparc/cpu.c
> @@ -20,7 +20,7 @@
>  #include "qemu/osdep.h"
>  #include "qapi/error.h"
>  #include "cpu.h"
> -#include "qemu/error-report.h"
> +#include "qemu/qemu-print.h"
>  #include "exec/exec-all.h"
>  #include "hw/qdev-properties.h"
>  #include "qapi/visitor.h"
> @@ -556,47 +556,44 @@ static const char * const feature_name[] = {
>      "gl",
>  };
>  
> -static void print_features(FILE *f, fprintf_function cpu_fprintf,
> -                           uint32_t features, const char *prefix)
> +static void print_features(uint32_t features, const char *prefix)
>  {
>      unsigned int i;
>  
>      for (i = 0; i < ARRAY_SIZE(feature_name); i++) {
>          if (feature_name[i] && (features & (1 << i))) {
>              if (prefix) {
> -                (*cpu_fprintf)(f, "%s", prefix);
> +                qemu_printf("%s", prefix);
>              }
> -            (*cpu_fprintf)(f, "%s ", feature_name[i]);
> +            qemu_printf("%s ", feature_name[i]);
>          }
>      }
>  }
>  
> -void sparc_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void sparc_cpu_list(void)
>  {
>      unsigned int i;
>  
>      for (i = 0; i < ARRAY_SIZE(sparc_defs); i++) {
> -        (*cpu_fprintf)(f, "Sparc %16s IU " TARGET_FMT_lx
> -                       " FPU %08x MMU %08x NWINS %d ",
> -                       sparc_defs[i].name,
> -                       sparc_defs[i].iu_version,
> -                       sparc_defs[i].fpu_version,
> -                       sparc_defs[i].mmu_version,
> -                       sparc_defs[i].nwindows);
> -        print_features(f, cpu_fprintf, CPU_DEFAULT_FEATURES &
> -                       ~sparc_defs[i].features, "-");
> -        print_features(f, cpu_fprintf, ~CPU_DEFAULT_FEATURES &
> -                       sparc_defs[i].features, "+");
> -        (*cpu_fprintf)(f, "\n");
> +        qemu_printf("Sparc %16s IU " TARGET_FMT_lx
> +                    " FPU %08x MMU %08x NWINS %d ",
> +                    sparc_defs[i].name,
> +                    sparc_defs[i].iu_version,
> +                    sparc_defs[i].fpu_version,
> +                    sparc_defs[i].mmu_version,
> +                    sparc_defs[i].nwindows);
> +        print_features(CPU_DEFAULT_FEATURES & ~sparc_defs[i].features, "-");
> +        print_features(~CPU_DEFAULT_FEATURES & sparc_defs[i].features, "+");
> +        qemu_printf("\n");
>      }
> -    (*cpu_fprintf)(f, "Default CPU feature flags (use '-' to remove): ");
> -    print_features(f, cpu_fprintf, CPU_DEFAULT_FEATURES, NULL);
> -    (*cpu_fprintf)(f, "\n");
> -    (*cpu_fprintf)(f, "Available CPU feature flags (use '+' to add): ");
> -    print_features(f, cpu_fprintf, ~CPU_DEFAULT_FEATURES, NULL);
> -    (*cpu_fprintf)(f, "\n");
> -    (*cpu_fprintf)(f, "Numerical features (use '=' to set): iu_version "
> -                   "fpu_version mmu_version nwindows\n");
> +    qemu_printf("Default CPU feature flags (use '-' to remove): ");
> +    print_features(CPU_DEFAULT_FEATURES, NULL);
> +    qemu_printf("\n");
> +    qemu_printf("Available CPU feature flags (use '+' to add): ");
> +    print_features(~CPU_DEFAULT_FEATURES, NULL);
> +    qemu_printf("\n");
> +    qemu_printf("Numerical features (use '=' to set): iu_version "
> +                "fpu_version mmu_version nwindows\n");
>  }
>  
>  static void cpu_print_cc(FILE *f, fprintf_function cpu_fprintf,
> diff --git a/target/sparc/cpu.h b/target/sparc/cpu.h
> index 4972ebcfd4..ab9fa3ddbf 100644
> --- a/target/sparc/cpu.h
> +++ b/target/sparc/cpu.h
> @@ -578,7 +578,7 @@ void cpu_raise_exception_ra(CPUSPARCState *, int, uintptr_t) QEMU_NORETURN;
>  #ifndef NO_CPU_IO_DEFS
>  /* cpu_init.c */
>  void cpu_sparc_set_id(CPUSPARCState *env, unsigned int cpu);
> -void sparc_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void sparc_cpu_list(void);
>  /* mmu_helper.c */
>  int sparc_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size, int rw,
>                                 int mmu_idx);
> diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
> index 00e69dc154..43d577ce8e 100644
> --- a/target/tricore/cpu.h
> +++ b/target/tricore/cpu.h
> @@ -375,7 +375,7 @@ void fpu_set_state(CPUTriCoreState *env);
>  
>  #define MMU_USER_IDX 2
>  
> -void tricore_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void tricore_cpu_list(void);
>  
>  #define cpu_signal_handler cpu_tricore_signal_handler
>  #define cpu_list tricore_cpu_list
> diff --git a/target/tricore/helper.c b/target/tricore/helper.c
> index 0769046993..78ee87c9ea 100644
> --- a/target/tricore/helper.c
> +++ b/target/tricore/helper.c
> @@ -20,6 +20,7 @@
>  #include "cpu.h"
>  #include "exec/exec-all.h"
>  #include "fpu/softfloat.h"
> +#include "qemu/qemu-print.h"
>  
>  enum {
>      TLBRET_DIRTY = -4,
> @@ -82,28 +83,22 @@ int cpu_tricore_handle_mmu_fault(CPUState *cs, target_ulong address,
>  static void tricore_cpu_list_entry(gpointer data, gpointer user_data)
>  {
>      ObjectClass *oc = data;
> -    CPUListState *s = user_data;
>      const char *typename;
>      char *name;
>  
>      typename = object_class_get_name(oc);
>      name = g_strndup(typename, strlen(typename) - strlen("-" TYPE_TRICORE_CPU));
> -    (*s->cpu_fprintf)(s->file, "  %s\n",
> -                      name);
> +    qemu_printf("  %s\n", name);
>      g_free(name);
>  }
>  
> -void tricore_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void tricore_cpu_list(void)
>  {
> -    CPUListState s = {
> -        .file = f,
> -        .cpu_fprintf = cpu_fprintf,
> -    };
>      GSList *list;
>  
>      list = object_class_get_list_sorted(TYPE_TRICORE_CPU, false);
> -    (*cpu_fprintf)(f, "Available CPUs:\n");
> -    g_slist_foreach(list, tricore_cpu_list_entry, &s);
> +    qemu_printf("Available CPUs:\n");
> +    g_slist_foreach(list, tricore_cpu_list_entry, NULL);
>      g_slist_free(list);
>  }
>  
> diff --git a/target/xtensa/cpu.h b/target/xtensa/cpu.h
> index 4d8152682f..4aaf1f7bb2 100644
> --- a/target/xtensa/cpu.h
> +++ b/target/xtensa/cpu.h
> @@ -600,7 +600,7 @@ void xtensa_irq_init(CPUXtensaState *env);
>  qemu_irq *xtensa_get_extints(CPUXtensaState *env);
>  qemu_irq xtensa_get_runstall(CPUXtensaState *env);
>  int cpu_xtensa_signal_handler(int host_signum, void *pinfo, void *puc);
> -void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf);
> +void xtensa_cpu_list(void);
>  void xtensa_sync_window_from_phys(CPUXtensaState *env);
>  void xtensa_sync_phys_from_window(CPUXtensaState *env);
>  void xtensa_rotate_window(CPUXtensaState *env, uint32_t delta);
> diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
> index f4867a9b56..5f37f378a3 100644
> --- a/target/xtensa/helper.c
> +++ b/target/xtensa/helper.c
> @@ -31,6 +31,7 @@
>  #include "exec/gdbstub.h"
>  #include "exec/helper-proto.h"
>  #include "qemu/error-report.h"
> +#include "qemu/qemu-print.h"
>  #include "qemu/host-utils.h"
>  
>  static struct XtensaConfigList *xtensa_cores;
> @@ -228,12 +229,12 @@ void xtensa_breakpoint_handler(CPUState *cs)
>      }
>  }
>  
> -void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf)
> +void xtensa_cpu_list(void)
>  {
>      XtensaConfigList *core = xtensa_cores;
> -    cpu_fprintf(f, "Available CPUs:\n");
> +    qemu_printf("Available CPUs:\n");
>      for (; core; core = core->next) {
> -        cpu_fprintf(f, "  %s\n", core->config->name);
> +        qemu_printf("  %s\n", core->config->name);
>      }
>  }
>  
> diff --git a/vl.c b/vl.c
> index 190c773176..ff5dfb6fbc 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4051,7 +4051,7 @@ int main(int argc, char **argv, char **envp)
>      }
>  
>      if (cpu_model && is_help_option(cpu_model)) {
> -        list_cpus(stdout, &fprintf, cpu_model);
> +        list_cpus(cpu_model);
>          exit(0);
>      }
>  
> -- 
> 2.17.2
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH v2 16/17] disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
@ 2019-04-18 11:29     ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 35+ messages in thread
From: Dr. David Alan Gilbert @ 2019-04-18 11:29 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel, Paolo Bonzini

* Markus Armbruster (armbru@redhat.com) wrote:
> Commit dc99065b5f9 (v0.1.0) added dis-asm.h from binutils.
> 
> Commit 43d4145a986 (v0.1.5) inlined bfd.h into dis-asm.h to remove the
> dependency on binutils.
> 
> Commit 76cad71136b (v1.4.0) moved dis-asm.h to include/disas/bfd.h.
> The new name is confusing when you try to match against (pre GPLv3+)
> binutils.  Rename it back.  Keep it in the same directory, of course.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  disas.c                            | 2 +-
>  disas/alpha.c                      | 2 +-
>  disas/arm-a64.cc                   | 2 +-
>  disas/arm.c                        | 2 +-
>  disas/cris.c                       | 2 +-
>  disas/hppa.c                       | 2 +-
>  disas/i386.c                       | 2 +-
>  disas/lm32.c                       | 2 +-
>  disas/m68k.c                       | 2 +-
>  disas/microblaze.c                 | 2 +-
>  disas/mips.c                       | 2 +-
>  disas/moxie.c                      | 2 +-
>  disas/nanomips.cpp                 | 2 +-
>  disas/nios2.c                      | 2 +-
>  disas/ppc.c                        | 2 +-
>  disas/riscv.c                      | 2 +-
>  disas/s390.c                       | 2 +-
>  disas/sh4.c                        | 2 +-
>  disas/sparc.c                      | 2 +-
>  disas/tci.c                        | 2 +-
>  disas/xtensa.c                     | 2 +-
>  include/disas/{bfd.h => dis-asm.h} | 0
>  include/qom/cpu.h                  | 2 +-
>  target/openrisc/disas.c            | 2 +-
>  target/ppc/translate_init.inc.c    | 2 +-
>  25 files changed, 24 insertions(+), 24 deletions(-)
>  rename include/disas/{bfd.h => dis-asm.h} (100%)
> 
> diff --git a/disas.c b/disas.c
> index d15cceb863..41ad0102e2 100644
> --- a/disas.c
> +++ b/disas.c
> @@ -1,7 +1,7 @@
>  /* General "disassemble this chunk" code.  Used for debugging. */
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "elf.h"
>  #include "qemu/qemu-print.h"
>  
> diff --git a/disas/alpha.c b/disas/alpha.c
> index a0c9ecd49d..3db90fa665 100644
> --- a/disas/alpha.c
> +++ b/disas/alpha.c
> @@ -20,7 +20,7 @@ along with this file; see the file COPYING.  If not, see
>  <http://www.gnu.org/licenses/>. */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* MAX is redefined below, so remove any previous definition. */
>  #undef MAX
> diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
> index 9280950ce3..9fa779e175 100644
> --- a/disas/arm-a64.cc
> +++ b/disas/arm-a64.cc
> @@ -19,7 +19,7 @@
>  
>  extern "C" {
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  }
>  
>  #include "vixl/a64/disasm-a64.h"
> diff --git a/disas/arm.c b/disas/arm.c
> index 17ea120b44..7d940f2396 100644
> --- a/disas/arm.c
> +++ b/disas/arm.c
> @@ -23,7 +23,7 @@
>     for things we don't care about.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  #define ARM_EXT_V1	 0
>  #define ARM_EXT_V2	 0
> diff --git a/disas/cris.c b/disas/cris.c
> index 2dd56deea4..bf9eafc415 100644
> --- a/disas/cris.c
> +++ b/disas/cris.c
> @@ -20,7 +20,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "target/cris/opcode-cris.h"
>  
>  #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
> diff --git a/disas/hppa.c b/disas/hppa.c
> index a2d371fdb1..2dbd1fc445 100644
> --- a/disas/hppa.c
> +++ b/disas/hppa.c
> @@ -19,7 +19,7 @@
>     along with this program; if not, see <http://www.gnu.org/licenses/>. */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* HP PA-RISC SOM object file format:  definitions internal to BFD.
>     Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
> diff --git a/disas/i386.c b/disas/i386.c
> index fc03b9f06a..4c1f0f877b 100644
> --- a/disas/i386.c
> +++ b/disas/i386.c
> @@ -32,7 +32,7 @@
>     the Intel manual for details.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "qemu/cutils.h"
>  
>  /* include/opcode/i386.h r1.78 */
> diff --git a/disas/lm32.c b/disas/lm32.c
> index fcc2cde23d..c0ef8160fe 100644
> --- a/disas/lm32.c
> +++ b/disas/lm32.c
> @@ -19,7 +19,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  typedef enum {
>      LM32_OP_SRUI = 0, LM32_OP_NORI, LM32_OP_MULI, LM32_OP_SH, LM32_OP_LB,
> diff --git a/disas/m68k.c b/disas/m68k.c
> index e544c7137f..863409c67c 100644
> --- a/disas/m68k.c
> +++ b/disas/m68k.c
> @@ -4,7 +4,7 @@
>  #include "qemu/osdep.h"
>  #include <math.h>
>  
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* **** floatformat.h from sourceware.org CVS 2005-08-14.  */
>  /* IEEE floating point support declarations, for GDB, the GNU Debugger.
> diff --git a/disas/microblaze.c b/disas/microblaze.c
> index c23605043a..0b89b9c4fa 100644
> --- a/disas/microblaze.c
> +++ b/disas/microblaze.c
> @@ -577,7 +577,7 @@ static const char pvr_register_prefix[] = "rpvr";
>  
>  #endif /* MICROBLAZE_OPC */
>  
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  #define get_field_rd(instr) get_field(instr, RD_MASK, RD_LOW)
>  #define get_field_r1(instr) get_field(instr, RA_MASK, RA_LOW)
> diff --git a/disas/mips.c b/disas/mips.c
> index 97f661a37e..dfefe5e589 100644
> --- a/disas/mips.c
> +++ b/disas/mips.c
> @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
>  along with this program; if not, see <http://www.gnu.org/licenses/>.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* mips.h.  Mips opcode list for GDB, the GNU debugger.
>     Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
> diff --git a/disas/moxie.c b/disas/moxie.c
> index 70b49ed74b..e94ab4c33d 100644
> --- a/disas/moxie.c
> +++ b/disas/moxie.c
> @@ -18,7 +18,7 @@
>  #define STATIC_TABLE
>  #define DEFINE_TABLE
>  
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  static void *stream;
>  
> diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
> index c8495b1a19..90e63b8367 100644
> --- a/disas/nanomips.cpp
> +++ b/disas/nanomips.cpp
> @@ -29,7 +29,7 @@
>  
>  extern "C" {
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  }
>  
>  #include <cstring>
> diff --git a/disas/nios2.c b/disas/nios2.c
> index de11f04cc4..c3e82140c7 100644
> --- a/disas/nios2.c
> +++ b/disas/nios2.c
> @@ -36,7 +36,7 @@
>  
>  /*#include "bfd.h"*/
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  
>  /****************************************************************************
> diff --git a/disas/ppc.c b/disas/ppc.c
> index da1140ba2b..a545437de9 100644
> --- a/disas/ppc.c
> +++ b/disas/ppc.c
> @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
>  along with this file; see the file COPYING.  If not,
>  see <http://www.gnu.org/licenses/>.  */
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #define BFD_DEFAULT_TARGET_SIZE 64
>  
>  /* ppc.h -- Header file for PowerPC opcode table
> diff --git a/disas/riscv.c b/disas/riscv.c
> index 27546dd790..59a9b0437a 100644
> --- a/disas/riscv.c
> +++ b/disas/riscv.c
> @@ -18,7 +18,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  
>  /* types */
> diff --git a/disas/s390.c b/disas/s390.c
> index 6393860239..b1f4e2a0c1 100644
> --- a/disas/s390.c
> +++ b/disas/s390.c
> @@ -22,7 +22,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* include/opcode/s390.h revision 1.9 */
>  /* s390.h -- Header file for S390 opcode table
> diff --git a/disas/sh4.c b/disas/sh4.c
> index 6b66176bed..55ef865a36 100644
> --- a/disas/sh4.c
> +++ b/disas/sh4.c
> @@ -16,7 +16,7 @@
>     along with this program; if not, see <http://www.gnu.org/licenses/>.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  #define DEFINE_TABLE
>  
> diff --git a/disas/sparc.c b/disas/sparc.c
> index f120f4e86d..5689533ce1 100644
> --- a/disas/sparc.c
> +++ b/disas/sparc.c
> @@ -27,7 +27,7 @@
>     see <http://www.gnu.org/licenses/>.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* The SPARC opcode table (and other related data) is defined in
>     the opcodes library in sparc-opc.c.  If you change anything here, make
> diff --git a/disas/tci.c b/disas/tci.c
> index 1cdf5eeafc..f1d6c6b469 100644
> --- a/disas/tci.c
> +++ b/disas/tci.c
> @@ -19,7 +19,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "tcg/tcg.h"
>  
>  /* Disassemble TCI bytecode. */
> diff --git a/disas/xtensa.c b/disas/xtensa.c
> index 5e3870b9ad..d7dda8c2d6 100644
> --- a/disas/xtensa.c
> +++ b/disas/xtensa.c
> @@ -26,7 +26,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "hw/xtensa/xtensa-isa.h"
>  
>  int print_insn_xtensa(bfd_vma memaddr, struct disassemble_info *info)
> diff --git a/include/disas/bfd.h b/include/disas/dis-asm.h
> similarity index 100%
> rename from include/disas/bfd.h
> rename to include/disas/dis-asm.h
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 9972e07786..e9bec3a5bc 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -21,7 +21,7 @@
>  #define QEMU_CPU_H
>  
>  #include "hw/qdev-core.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "exec/hwaddr.h"
>  #include "exec/memattrs.h"
>  #include "qapi/qapi-types-run-state.h"
> diff --git a/target/openrisc/disas.c b/target/openrisc/disas.c
> index bc63093ee9..5923b2429e 100644
> --- a/target/openrisc/disas.c
> +++ b/target/openrisc/disas.c
> @@ -19,7 +19,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "qemu/bitops.h"
>  #include "cpu.h"
>  
> diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
> index 996356dd99..20a64f3b77 100644
> --- a/target/ppc/translate_init.inc.c
> +++ b/target/ppc/translate_init.inc.c
> @@ -18,7 +18,7 @@
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
>  
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "exec/gdbstub.h"
>  #include "kvm_ppc.h"
>  #include "sysemu/arch_init.h"
> -- 
> 2.17.2
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH v2 16/17] disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h
@ 2019-04-18 11:29     ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 35+ messages in thread
From: Dr. David Alan Gilbert @ 2019-04-18 11:29 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Paolo Bonzini, qemu-devel

* Markus Armbruster (armbru@redhat.com) wrote:
> Commit dc99065b5f9 (v0.1.0) added dis-asm.h from binutils.
> 
> Commit 43d4145a986 (v0.1.5) inlined bfd.h into dis-asm.h to remove the
> dependency on binutils.
> 
> Commit 76cad71136b (v1.4.0) moved dis-asm.h to include/disas/bfd.h.
> The new name is confusing when you try to match against (pre GPLv3+)
> binutils.  Rename it back.  Keep it in the same directory, of course.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  disas.c                            | 2 +-
>  disas/alpha.c                      | 2 +-
>  disas/arm-a64.cc                   | 2 +-
>  disas/arm.c                        | 2 +-
>  disas/cris.c                       | 2 +-
>  disas/hppa.c                       | 2 +-
>  disas/i386.c                       | 2 +-
>  disas/lm32.c                       | 2 +-
>  disas/m68k.c                       | 2 +-
>  disas/microblaze.c                 | 2 +-
>  disas/mips.c                       | 2 +-
>  disas/moxie.c                      | 2 +-
>  disas/nanomips.cpp                 | 2 +-
>  disas/nios2.c                      | 2 +-
>  disas/ppc.c                        | 2 +-
>  disas/riscv.c                      | 2 +-
>  disas/s390.c                       | 2 +-
>  disas/sh4.c                        | 2 +-
>  disas/sparc.c                      | 2 +-
>  disas/tci.c                        | 2 +-
>  disas/xtensa.c                     | 2 +-
>  include/disas/{bfd.h => dis-asm.h} | 0
>  include/qom/cpu.h                  | 2 +-
>  target/openrisc/disas.c            | 2 +-
>  target/ppc/translate_init.inc.c    | 2 +-
>  25 files changed, 24 insertions(+), 24 deletions(-)
>  rename include/disas/{bfd.h => dis-asm.h} (100%)
> 
> diff --git a/disas.c b/disas.c
> index d15cceb863..41ad0102e2 100644
> --- a/disas.c
> +++ b/disas.c
> @@ -1,7 +1,7 @@
>  /* General "disassemble this chunk" code.  Used for debugging. */
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "elf.h"
>  #include "qemu/qemu-print.h"
>  
> diff --git a/disas/alpha.c b/disas/alpha.c
> index a0c9ecd49d..3db90fa665 100644
> --- a/disas/alpha.c
> +++ b/disas/alpha.c
> @@ -20,7 +20,7 @@ along with this file; see the file COPYING.  If not, see
>  <http://www.gnu.org/licenses/>. */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* MAX is redefined below, so remove any previous definition. */
>  #undef MAX
> diff --git a/disas/arm-a64.cc b/disas/arm-a64.cc
> index 9280950ce3..9fa779e175 100644
> --- a/disas/arm-a64.cc
> +++ b/disas/arm-a64.cc
> @@ -19,7 +19,7 @@
>  
>  extern "C" {
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  }
>  
>  #include "vixl/a64/disasm-a64.h"
> diff --git a/disas/arm.c b/disas/arm.c
> index 17ea120b44..7d940f2396 100644
> --- a/disas/arm.c
> +++ b/disas/arm.c
> @@ -23,7 +23,7 @@
>     for things we don't care about.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  #define ARM_EXT_V1	 0
>  #define ARM_EXT_V2	 0
> diff --git a/disas/cris.c b/disas/cris.c
> index 2dd56deea4..bf9eafc415 100644
> --- a/disas/cris.c
> +++ b/disas/cris.c
> @@ -20,7 +20,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "target/cris/opcode-cris.h"
>  
>  #define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
> diff --git a/disas/hppa.c b/disas/hppa.c
> index a2d371fdb1..2dbd1fc445 100644
> --- a/disas/hppa.c
> +++ b/disas/hppa.c
> @@ -19,7 +19,7 @@
>     along with this program; if not, see <http://www.gnu.org/licenses/>. */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* HP PA-RISC SOM object file format:  definitions internal to BFD.
>     Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
> diff --git a/disas/i386.c b/disas/i386.c
> index fc03b9f06a..4c1f0f877b 100644
> --- a/disas/i386.c
> +++ b/disas/i386.c
> @@ -32,7 +32,7 @@
>     the Intel manual for details.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "qemu/cutils.h"
>  
>  /* include/opcode/i386.h r1.78 */
> diff --git a/disas/lm32.c b/disas/lm32.c
> index fcc2cde23d..c0ef8160fe 100644
> --- a/disas/lm32.c
> +++ b/disas/lm32.c
> @@ -19,7 +19,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  typedef enum {
>      LM32_OP_SRUI = 0, LM32_OP_NORI, LM32_OP_MULI, LM32_OP_SH, LM32_OP_LB,
> diff --git a/disas/m68k.c b/disas/m68k.c
> index e544c7137f..863409c67c 100644
> --- a/disas/m68k.c
> +++ b/disas/m68k.c
> @@ -4,7 +4,7 @@
>  #include "qemu/osdep.h"
>  #include <math.h>
>  
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* **** floatformat.h from sourceware.org CVS 2005-08-14.  */
>  /* IEEE floating point support declarations, for GDB, the GNU Debugger.
> diff --git a/disas/microblaze.c b/disas/microblaze.c
> index c23605043a..0b89b9c4fa 100644
> --- a/disas/microblaze.c
> +++ b/disas/microblaze.c
> @@ -577,7 +577,7 @@ static const char pvr_register_prefix[] = "rpvr";
>  
>  #endif /* MICROBLAZE_OPC */
>  
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  #define get_field_rd(instr) get_field(instr, RD_MASK, RD_LOW)
>  #define get_field_r1(instr) get_field(instr, RA_MASK, RA_LOW)
> diff --git a/disas/mips.c b/disas/mips.c
> index 97f661a37e..dfefe5e589 100644
> --- a/disas/mips.c
> +++ b/disas/mips.c
> @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
>  along with this program; if not, see <http://www.gnu.org/licenses/>.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* mips.h.  Mips opcode list for GDB, the GNU debugger.
>     Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
> diff --git a/disas/moxie.c b/disas/moxie.c
> index 70b49ed74b..e94ab4c33d 100644
> --- a/disas/moxie.c
> +++ b/disas/moxie.c
> @@ -18,7 +18,7 @@
>  #define STATIC_TABLE
>  #define DEFINE_TABLE
>  
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  static void *stream;
>  
> diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
> index c8495b1a19..90e63b8367 100644
> --- a/disas/nanomips.cpp
> +++ b/disas/nanomips.cpp
> @@ -29,7 +29,7 @@
>  
>  extern "C" {
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  }
>  
>  #include <cstring>
> diff --git a/disas/nios2.c b/disas/nios2.c
> index de11f04cc4..c3e82140c7 100644
> --- a/disas/nios2.c
> +++ b/disas/nios2.c
> @@ -36,7 +36,7 @@
>  
>  /*#include "bfd.h"*/
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  
>  /****************************************************************************
> diff --git a/disas/ppc.c b/disas/ppc.c
> index da1140ba2b..a545437de9 100644
> --- a/disas/ppc.c
> +++ b/disas/ppc.c
> @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
>  along with this file; see the file COPYING.  If not,
>  see <http://www.gnu.org/licenses/>.  */
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #define BFD_DEFAULT_TARGET_SIZE 64
>  
>  /* ppc.h -- Header file for PowerPC opcode table
> diff --git a/disas/riscv.c b/disas/riscv.c
> index 27546dd790..59a9b0437a 100644
> --- a/disas/riscv.c
> +++ b/disas/riscv.c
> @@ -18,7 +18,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  
>  /* types */
> diff --git a/disas/s390.c b/disas/s390.c
> index 6393860239..b1f4e2a0c1 100644
> --- a/disas/s390.c
> +++ b/disas/s390.c
> @@ -22,7 +22,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* include/opcode/s390.h revision 1.9 */
>  /* s390.h -- Header file for S390 opcode table
> diff --git a/disas/sh4.c b/disas/sh4.c
> index 6b66176bed..55ef865a36 100644
> --- a/disas/sh4.c
> +++ b/disas/sh4.c
> @@ -16,7 +16,7 @@
>     along with this program; if not, see <http://www.gnu.org/licenses/>.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  #define DEFINE_TABLE
>  
> diff --git a/disas/sparc.c b/disas/sparc.c
> index f120f4e86d..5689533ce1 100644
> --- a/disas/sparc.c
> +++ b/disas/sparc.c
> @@ -27,7 +27,7 @@
>     see <http://www.gnu.org/licenses/>.  */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  
>  /* The SPARC opcode table (and other related data) is defined in
>     the opcodes library in sparc-opc.c.  If you change anything here, make
> diff --git a/disas/tci.c b/disas/tci.c
> index 1cdf5eeafc..f1d6c6b469 100644
> --- a/disas/tci.c
> +++ b/disas/tci.c
> @@ -19,7 +19,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "tcg/tcg.h"
>  
>  /* Disassemble TCI bytecode. */
> diff --git a/disas/xtensa.c b/disas/xtensa.c
> index 5e3870b9ad..d7dda8c2d6 100644
> --- a/disas/xtensa.c
> +++ b/disas/xtensa.c
> @@ -26,7 +26,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "hw/xtensa/xtensa-isa.h"
>  
>  int print_insn_xtensa(bfd_vma memaddr, struct disassemble_info *info)
> diff --git a/include/disas/bfd.h b/include/disas/dis-asm.h
> similarity index 100%
> rename from include/disas/bfd.h
> rename to include/disas/dis-asm.h
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 9972e07786..e9bec3a5bc 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -21,7 +21,7 @@
>  #define QEMU_CPU_H
>  
>  #include "hw/qdev-core.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "exec/hwaddr.h"
>  #include "exec/memattrs.h"
>  #include "qapi/qapi-types-run-state.h"
> diff --git a/target/openrisc/disas.c b/target/openrisc/disas.c
> index bc63093ee9..5923b2429e 100644
> --- a/target/openrisc/disas.c
> +++ b/target/openrisc/disas.c
> @@ -19,7 +19,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "qemu/bitops.h"
>  #include "cpu.h"
>  
> diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
> index 996356dd99..20a64f3b77 100644
> --- a/target/ppc/translate_init.inc.c
> +++ b/target/ppc/translate_init.inc.c
> @@ -18,7 +18,7 @@
>   * License along with this library; if not, see <http://www.gnu.org/licenses/>.
>   */
>  
> -#include "disas/bfd.h"
> +#include "disas/dis-asm.h"
>  #include "exec/gdbstub.h"
>  #include "kvm_ppc.h"
>  #include "sysemu/arch_init.h"
> -- 
> 2.17.2
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK


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

end of thread, other threads:[~2019-04-18 11:31 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17 19:17 [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 01/17] include: Include fprintf-fn.h only where needed Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 02/17] trace: Simplify how st_print_trace_file_status() prints Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 03/17] tcg: Simplify how dump_opcount_info() prints Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 04/17] tcg: Simplify how dump_exec_info() prints Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 05/17] tcg: Simplify how dump_drift_info() prints Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 06/17] qsp: Simplify how qsp_report() prints Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 07/17] block/qapi: Clean up how we print to monitor or stdout Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 08/17] memory: Clean up how mtree_info() prints Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 09/17] target: Simplify how the TARGET_cpu_list() print Markus Armbruster
2019-04-18 11:28   ` Dr. David Alan Gilbert
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 10/17] target: Clean up how the dump_mmu() print Markus Armbruster
2019-04-17 19:17 ` [Qemu-devel] [PATCH v2 11/17] target/i386: Simplify how x86_cpu_dump_local_apic_state() prints Markus Armbruster
2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 12/17] qom/cpu: Simplify how CPUClass::dump_statistics() prints Markus Armbruster
2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 13/17] qemu-print: New qemu_fprintf(), qemu_vfprintf() Markus Armbruster
2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 14/17] qom/cpu: Simplify how CPUClass:cpu_dump_state() prints Markus Armbruster
2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 15/17] monitor: Clean up how monitor_disas() funnels output to monitor Markus Armbruster
2019-04-17 19:35   ` Eric Blake
2019-04-18  6:20     ` Markus Armbruster
2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 16/17] disas: Rename include/disas/bfd.h back to include/disas/dis-asm.h Markus Armbruster
2019-04-17 19:18   ` Markus Armbruster
2019-04-18 11:29   ` Dr. David Alan Gilbert
2019-04-18 11:29     ` Dr. David Alan Gilbert
2019-04-17 19:18 ` [Qemu-devel] [PATCH v2 17/17] include: Move fprintf_function to disas/ Markus Armbruster
2019-04-17 19:42 ` [Qemu-devel] [PATCH v2 00/17] Clean up and simplify around fprintf_function no-reply
2019-04-17 19:47 ` no-reply
2019-04-17 19:52 ` no-reply
2019-04-17 19:55 ` no-reply
2019-04-17 20:01 ` no-reply
2019-04-17 20:06 ` no-reply
2019-04-17 20:10 ` no-reply
2019-04-17 20:13 ` no-reply
2019-04-17 20:17 ` no-reply
2019-04-17 20:22 ` no-reply
2019-04-17 20:27 ` no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.