diff mbox

qemu-log: add log category for MIPS MMU fault info

Message ID 1411463090-25466-1-git-send-email-antonynpavlov@gmail.com
State New
Headers show

Commit Message

Antony Pavlov Sept. 23, 2014, 9:04 a.m. UTC
Running barebox on qemu-system-mips* with '-d unimp' overloads
stderr by very very many mips_cpu_handle_mmu_fault() messages:

  mips_cpu_handle_mmu_fault address=b80003fd ret 0 physical 00000000180003fd prot 3
  mips_cpu_handle_mmu_fault address=a0800884 ret 0 physical 0000000000800884 prot 3
  mips_cpu_handle_mmu_fault pc a080cd80 ad b80003fd rw 0 mmu_idx 0

So it's very difficult to find LOG_UNIMP message.

The mips_cpu_handle_mmu_fault() messages appears on enabling ANY
logging! It's not very handy.

Adding separate log category for mips_cpu_handle_mmu_fault()
logging fixes the problem.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 include/qemu/log.h   | 1 +
 qemu-log.c           | 2 ++
 target-mips/helper.c | 6 ++++--
 3 files changed, 7 insertions(+), 2 deletions(-)

Comments

Peter Maydell Sept. 23, 2014, 9:08 a.m. UTC | #1
On 23 September 2014 10:04, Antony Pavlov <antonynpavlov@gmail.com> wrote:
> Running barebox on qemu-system-mips* with '-d unimp' overloads
> stderr by very very many mips_cpu_handle_mmu_fault() messages:
>
>   mips_cpu_handle_mmu_fault address=b80003fd ret 0 physical 00000000180003fd prot 3
>   mips_cpu_handle_mmu_fault address=a0800884 ret 0 physical 0000000000800884 prot 3
>   mips_cpu_handle_mmu_fault pc a080cd80 ad b80003fd rw 0 mmu_idx 0
>
> So it's very difficult to find LOG_UNIMP message.
>
> The mips_cpu_handle_mmu_fault() messages appears on enabling ANY
> logging! It's not very handy.
>
> Adding separate log category for mips_cpu_handle_mmu_fault()
> logging fixes the problem.

I don't think we should have CPU-specific logging categories
(the x86-only categories are somewhat legacy). Can you
make this a category that applies to all CPU architectures
rather than a MIPS specific one, please? Given most of them
have an MMU I think that just means removing the "mips
only" text from the help documentation...

thanks
-- PMM
diff mbox

Patch

diff --git a/include/qemu/log.h b/include/qemu/log.h
index d515424..195f665 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -40,6 +40,7 @@  static inline bool qemu_log_enabled(void)
 #define CPU_LOG_RESET      (1 << 9)
 #define LOG_UNIMP          (1 << 10)
 #define LOG_GUEST_ERROR    (1 << 11)
+#define CPU_LOG_MMU        (1 << 12)
 
 /* Returns true if a bit is set in the current loglevel mask
  */
diff --git a/qemu-log.c b/qemu-log.c
index 797f2af..d27766a 100644
--- a/qemu-log.c
+++ b/qemu-log.c
@@ -110,6 +110,8 @@  const QEMULogItem qemu_log_items[] = {
       "x86 only: show protected mode far calls/returns/exceptions" },
     { CPU_LOG_RESET, "cpu_reset",
       "x86 only: show CPU state before CPU resets" },
+    { CPU_LOG_MMU, "mmu",
+      "mips only: show MMU fault handling information" },
     { CPU_LOG_IOPORT, "ioport",
       "show all i/o ports accesses" },
     { LOG_UNIMP, "unimp",
diff --git a/target-mips/helper.c b/target-mips/helper.c
index 8a997e4..cb41061 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -309,7 +309,8 @@  int mips_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw,
 #if 0
     log_cpu_state(cs, 0);
 #endif
-    qemu_log("%s pc " TARGET_FMT_lx " ad %" VADDR_PRIx " rw %d mmu_idx %d\n",
+    qemu_log_mask(CPU_LOG_MMU,
+              "%s pc " TARGET_FMT_lx " ad %" VADDR_PRIx " rw %d mmu_idx %d\n",
               __func__, env->active_tc.PC, address, rw, mmu_idx);
 
     rw &= 1;
@@ -321,7 +322,8 @@  int mips_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw,
     access_type = ACCESS_INT;
     ret = get_physical_address(env, &physical, &prot,
                                address, rw, access_type);
-    qemu_log("%s address=%" VADDR_PRIx " ret %d physical " TARGET_FMT_plx
+    qemu_log_mask(CPU_LOG_MMU,
+             "%s address=%" VADDR_PRIx " ret %d physical " TARGET_FMT_plx
              " prot %d\n",
              __func__, address, ret, physical, prot);
     if (ret == TLBRET_MATCH) {