From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Artyom Tarasenko" <atar4qemu@gmail.com>,
"Chris Wulff" <crwulff@gmail.com>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Marek Vasut" <marex@denx.de>,
"Max Filippov" <jcmvbkbc@gmail.com>,
"Dr . David Alan Gilbert" <dave@treblig.org>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Yoshinori Sato" <ysato@users.sourceforge.jp>,
"Markus Armbruster" <armbru@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
qemu-ppc@nongnu.org, "Laurent Vivier" <laurent@vivier.eu>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH-for-9.1 21/21] target/xtensa: Replace qemu_printf() by monitor_printf() in monitor
Date: Thu, 21 Mar 2024 16:48:37 +0100 [thread overview]
Message-ID: <20240321154838.95771-22-philmd@linaro.org> (raw)
In-Reply-To: <20240321154838.95771-1-philmd@linaro.org>
Replace qemu_printf() by monitor_printf() / monitor_puts() in monitor.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
target/xtensa/mmu.h | 2 +-
target/xtensa/monitor.c | 117 ++++++++++++++++++++--------------------
2 files changed, 61 insertions(+), 58 deletions(-)
diff --git a/target/xtensa/mmu.h b/target/xtensa/mmu.h
index 3e1d2c03ea..ef7504e16e 100644
--- a/target/xtensa/mmu.h
+++ b/target/xtensa/mmu.h
@@ -90,6 +90,6 @@ int xtensa_get_physical_addr(CPUXtensaState *env, bool update_tlb,
unsigned *access);
void xtensa_reset_mmu(CPUXtensaState *env);
-void xtensa_dump_mmu(CPUXtensaState *env);
+void xtensa_dump_mmu(Monitor *mon, CPUXtensaState *env);
#endif
diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c
index 9ba068d624..1c3dc85ea1 100644
--- a/target/xtensa/monitor.c
+++ b/target/xtensa/monitor.c
@@ -22,7 +22,6 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
-#include "qemu/qemu-print.h"
#include "qemu/units.h"
#include "monitor/monitor.h"
#include "monitor/hmp-target.h"
@@ -31,7 +30,7 @@
#include "mmu.h"
-static void dump_tlb(CPUXtensaState *env, bool dtlb)
+static void dump_tlb(Monitor *mon, CPUXtensaState *env, bool dtlb)
{
unsigned wi, ei;
const xtensa_tlb *conf =
@@ -40,7 +39,7 @@ static void dump_tlb(CPUXtensaState *env, bool dtlb)
xtensa_option_enabled(env->config, XTENSA_OPTION_MMU) ?
mmu_attr_to_access : region_attr_to_access;
- qemu_printf("%s:\n", dtlb ? "DTLB" : "IBLB");
+ monitor_puts(mon, dtlb ? "DTLB\n" : "IBLB\n");
for (wi = 0; wi < conf->nways; ++wi) {
uint32_t sz = ~xtensa_tlb_get_addr_mask(env, dtlb, wi) + 1;
const char *sz_text;
@@ -71,35 +70,39 @@ static void dump_tlb(CPUXtensaState *env, bool dtlb)
if (print_header) {
print_header = false;
- qemu_printf("Way %u (%d %s)\n", wi, sz, sz_text);
- qemu_printf("\tVaddr Paddr ASID Attr RWX Cache\n"
- "\t---------- ---------- ---- ---- --- -------\n");
+ monitor_printf(mon,
+ "Way %u (%d %s)\n", wi, sz, sz_text);
+ monitor_puts(mon,
+ "\tVaddr Paddr ASID Attr RWX Cache\n"
+ "\t---------- ---------- ---- ---- --- -------\n");
}
- qemu_printf("\t0x%08x 0x%08x 0x%02x 0x%02x %c%c%c %s\n",
- entry->vaddr,
- entry->paddr,
- entry->asid,
- entry->attr,
- (access & PAGE_READ) ? 'R' : '-',
- (access & PAGE_WRITE) ? 'W' : '-',
- (access & PAGE_EXEC) ? 'X' : '-',
- cache_text[cache_idx] ?
- cache_text[cache_idx] : "Invalid");
+ monitor_printf(mon,
+ "\t0x%08x 0x%08x 0x%02x 0x%02x %c%c%c %s\n",
+ entry->vaddr,
+ entry->paddr,
+ entry->asid,
+ entry->attr,
+ (access & PAGE_READ) ? 'R' : '-',
+ (access & PAGE_WRITE) ? 'W' : '-',
+ (access & PAGE_EXEC) ? 'X' : '-',
+ cache_text[cache_idx] ?
+ cache_text[cache_idx] : "Invalid");
}
}
}
}
-static void dump_mpu(CPUXtensaState *env, const char *map_desc,
+static void dump_mpu(Monitor *mon, CPUXtensaState *env, const char *map_desc,
const xtensa_mpu_entry *entry, unsigned n)
{
unsigned i;
- qemu_printf("%s map:\n", map_desc);
- qemu_printf("\t%s Vaddr Attr Ring0 Ring1 System Type CPU cache\n"
- "\t%s ---------- ---------- ----- ----- ------------- ---------\n",
- env ? "En" : " ",
- env ? "--" : " ");
+ monitor_printf(mon, "%s map:\n", map_desc);
+ monitor_printf(mon,
+ "\t%s Vaddr Attr Ring0 Ring1 System Type CPU cache\n"
+ "\t%s ---------- ---------- ----- ----- ------------- ---------\n",
+ env ? "En" : " ",
+ env ? "--" : " ");
for (i = 0; i < n; ++i) {
uint32_t attr = entry[i].attr;
@@ -108,64 +111,64 @@ static void dump_mpu(CPUXtensaState *env, const char *map_desc,
unsigned type = mpu_attr_to_type(attr);
char cpu_cache = (type & XTENSA_MPU_TYPE_CPU_CACHE) ? '-' : ' ';
- qemu_printf("\t %c 0x%08x 0x%08x %c%c%c %c%c%c ",
- env ?
- ((env->sregs[MPUENB] & (1u << i)) ? '+' : '-') : ' ',
- entry[i].vaddr, attr,
- (access0 & PAGE_READ) ? 'R' : '-',
- (access0 & PAGE_WRITE) ? 'W' : '-',
- (access0 & PAGE_EXEC) ? 'X' : '-',
- (access1 & PAGE_READ) ? 'R' : '-',
- (access1 & PAGE_WRITE) ? 'W' : '-',
- (access1 & PAGE_EXEC) ? 'X' : '-');
+ monitor_printf(mon, "\t %c 0x%08x 0x%08x %c%c%c %c%c%c ",
+ env ?
+ ((env->sregs[MPUENB] & (1u << i)) ? '+' : '-') : ' ',
+ entry[i].vaddr, attr,
+ (access0 & PAGE_READ) ? 'R' : '-',
+ (access0 & PAGE_WRITE) ? 'W' : '-',
+ (access0 & PAGE_EXEC) ? 'X' : '-',
+ (access1 & PAGE_READ) ? 'R' : '-',
+ (access1 & PAGE_WRITE) ? 'W' : '-',
+ (access1 & PAGE_EXEC) ? 'X' : '-');
switch (type & XTENSA_MPU_SYSTEM_TYPE_MASK) {
case XTENSA_MPU_SYSTEM_TYPE_DEVICE:
- qemu_printf("Device %cB %3s\n",
- (type & XTENSA_MPU_TYPE_B) ? ' ' : 'n',
- (type & XTENSA_MPU_TYPE_INT) ? "int" : "");
+ monitor_printf(mon, "Device %cB %3s\n",
+ (type & XTENSA_MPU_TYPE_B) ? ' ' : 'n',
+ (type & XTENSA_MPU_TYPE_INT) ? "int" : "");
break;
case XTENSA_MPU_SYSTEM_TYPE_NC:
- qemu_printf("Sys NC %cB %c%c%c\n",
- (type & XTENSA_MPU_TYPE_B) ? ' ' : 'n',
- (type & XTENSA_MPU_TYPE_CPU_R) ? 'r' : cpu_cache,
- (type & XTENSA_MPU_TYPE_CPU_W) ? 'w' : cpu_cache,
- (type & XTENSA_MPU_TYPE_CPU_C) ? 'c' : cpu_cache);
+ monitor_printf(mon, "Sys NC %cB %c%c%c\n",
+ (type & XTENSA_MPU_TYPE_B) ? ' ' : 'n',
+ (type & XTENSA_MPU_TYPE_CPU_R) ? 'r' : cpu_cache,
+ (type & XTENSA_MPU_TYPE_CPU_W) ? 'w' : cpu_cache,
+ (type & XTENSA_MPU_TYPE_CPU_C) ? 'c' : cpu_cache);
break;
case XTENSA_MPU_SYSTEM_TYPE_C:
- qemu_printf("Sys C %c%c%c %c%c%c\n",
- (type & XTENSA_MPU_TYPE_SYS_R) ? 'R' : '-',
- (type & XTENSA_MPU_TYPE_SYS_W) ? 'W' : '-',
- (type & XTENSA_MPU_TYPE_SYS_C) ? 'C' : '-',
- (type & XTENSA_MPU_TYPE_CPU_R) ? 'r' : cpu_cache,
- (type & XTENSA_MPU_TYPE_CPU_W) ? 'w' : cpu_cache,
- (type & XTENSA_MPU_TYPE_CPU_C) ? 'c' : cpu_cache);
+ monitor_printf(mon, "Sys C %c%c%c %c%c%c\n",
+ (type & XTENSA_MPU_TYPE_SYS_R) ? 'R' : '-',
+ (type & XTENSA_MPU_TYPE_SYS_W) ? 'W' : '-',
+ (type & XTENSA_MPU_TYPE_SYS_C) ? 'C' : '-',
+ (type & XTENSA_MPU_TYPE_CPU_R) ? 'r' : cpu_cache,
+ (type & XTENSA_MPU_TYPE_CPU_W) ? 'w' : cpu_cache,
+ (type & XTENSA_MPU_TYPE_CPU_C) ? 'c' : cpu_cache);
break;
default:
- qemu_printf("Unknown\n");
+ monitor_puts(mon, "Unknown\n");
break;
}
}
}
-void xtensa_dump_mmu(CPUXtensaState *env)
+void xtensa_dump_mmu(Monitor *mon, 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))) {
- dump_tlb(env, false);
- qemu_printf("\n");
- dump_tlb(env, true);
+ dump_tlb(mon, env, false);
+ monitor_puts(mon, "\n");
+ dump_tlb(mon, env, true);
} else if (xtensa_option_enabled(env->config, XTENSA_OPTION_MPU)) {
- dump_mpu(env, "Foreground",
+ dump_mpu(mon, env, "Foreground",
env->mpu_fg, env->config->n_mpu_fg_segments);
- qemu_printf("\n");
- dump_mpu(NULL, "Background",
+ monitor_puts(mon, "\n");
+ dump_mpu(mon, NULL, "Background",
env->config->mpu_bg, env->config->n_mpu_bg_segments);
} else {
- qemu_printf("No TLB for this CPU core\n");
+ monitor_puts(mon, "No TLB for this CPU core\n");
}
}
@@ -177,5 +180,5 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "No CPU available\n");
return;
}
- xtensa_dump_mmu(env1);
+ xtensa_dump_mmu(mon, env1);
}
--
2.41.0
next prev parent reply other threads:[~2024-03-21 15:53 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 15:48 [PATCH-for-9.1 00/21] target/monitor: Cleanup around hmp_info_tlb() Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.0? 01/21] host/atomic128: Include missing 'qemu/atomic.h' header Philippe Mathieu-Daudé
2024-03-21 17:05 ` Richard Henderson
2024-04-23 13:54 ` Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 02/21] hw/core: Remove check on NEED_CPU_H in tcg-cpu-ops.h Philippe Mathieu-Daudé
2024-03-21 21:17 ` Richard Henderson
2024-03-21 15:48 ` [PATCH-for-9.1 03/21] target/i386: Move APIC related code to cpu-apic.c Philippe Mathieu-Daudé
2024-03-21 21:43 ` Richard Henderson
2024-04-24 8:26 ` Zhao Liu
2024-04-24 12:05 ` Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 04/21] target/i386: Extract x86_dump_mmu() from hmp_info_tlb() Philippe Mathieu-Daudé
2024-03-21 21:46 ` Richard Henderson
2024-03-21 15:48 ` [PATCH-for-9.1 05/21] target/m68k: Replace qemu_printf() by monitor_printf() in monitor Philippe Mathieu-Daudé
2024-03-21 21:49 ` Richard Henderson
2024-03-24 23:43 ` Dr. David Alan Gilbert
2024-03-25 0:38 ` BALATON Zoltan
2024-03-28 21:59 ` Dr. David Alan Gilbert
2024-03-28 22:29 ` BALATON Zoltan
2024-04-24 7:35 ` Markus Armbruster
2024-04-24 9:19 ` BALATON Zoltan
2024-04-24 9:22 ` BALATON Zoltan
2024-03-21 15:48 ` [PATCH-for-9.1 06/21] target/m68k: Have dump_ttr() take a @description argument Philippe Mathieu-Daudé
2024-03-21 21:49 ` Richard Henderson
2024-03-21 15:48 ` [PATCH-for-9.1 07/21] target/m68k: Move MMU monitor commands from helper.c to monitor.c Philippe Mathieu-Daudé
2024-03-21 21:50 ` Richard Henderson
2024-03-21 15:48 ` [PATCH-for-9.1 08/21] target/microblaze: Prefix MMU API with 'mb_' Philippe Mathieu-Daudé
2024-03-23 13:13 ` Edgar E. Iglesias
2024-03-21 15:48 ` [PATCH-for-9.1 09/21] target/mips: Prefix MMU API with 'mips_' Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 10/21] target/nios2: Prefix MMU API with 'nios2_' Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 11/21] target/nios2: Move monitor commands to monitor.c Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 12/21] target/nios2: Replace qemu_printf() by monitor_printf() in monitor Philippe Mathieu-Daudé
2024-04-24 7:38 ` Markus Armbruster
2024-03-21 15:48 ` [PATCH-for-9.1 13/21] target/ppc: " Philippe Mathieu-Daudé
2024-04-24 7:39 ` Markus Armbruster
2024-03-21 15:48 ` [PATCH-for-9.1 14/21] target/sh4: Extract sh4_dump_mmu() from hmp_info_tlb() Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.0? 15/21] target/sparc: Fix string format errors when DEBUG_MMU is defined Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 16/21] target/sparc: Replace qemu_printf() by monitor_printf() in monitor Philippe Mathieu-Daudé
2024-04-24 7:44 ` Markus Armbruster
2024-04-24 12:08 ` Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 17/21] target/xtensa: Prefix MMU API with 'xtensa_' Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 18/21] target/xtensa: Extract MMU API to new mmu.c/mmu.h files Philippe Mathieu-Daudé
2024-03-23 19:23 ` Max Filippov
2024-03-21 15:48 ` [PATCH-for-9.1 19/21] target/xtensa: Simplify dump_mpu() and dump_tlb() Philippe Mathieu-Daudé
2024-03-21 15:48 ` [PATCH-for-9.1 20/21] target/xtensa: Move monitor commands to monitor.c Philippe Mathieu-Daudé
2024-03-21 15:48 ` Philippe Mathieu-Daudé [this message]
2024-04-24 7:45 ` [PATCH-for-9.1 21/21] target/xtensa: Replace qemu_printf() by monitor_printf() in monitor Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240321154838.95771-22-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=armbru@redhat.com \
--cc=atar4qemu@gmail.com \
--cc=crwulff@gmail.com \
--cc=danielhb413@gmail.com \
--cc=dave@treblig.org \
--cc=edgar.iglesias@gmail.com \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=laurent@vivier.eu \
--cc=marex@denx.de \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=npiggin@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).