qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: QEMU Developer <qemu-devel@nongnu.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Stefan Weil <sw@weilnetz.de>
Subject: [Qemu-devel] [PATCH] memory: Use standard log messages for unassigned memory read / write
Date: Wed,  7 Sep 2016 21:13:47 +0200	[thread overview]
Message-ID: <1473275627-20024-1-git-send-email-sw@weilnetz.de> (raw)

The old log messages are implemented by conditional compilation
and not available by default.

The new log messages can be enabled either by a command line option
(-d unimp) or in the QEMU monitor (log unimp).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---

The new code is very useful when implementing new platforms or
looking for problems with existing platforms which are only
partially emulated (I use it for Raspberry Pi).

target-sparc/ldst_helper.c also uses DEBUG_UNASSIGNED
and could get similar code.

Regards,
Stefan


 memory.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/memory.c b/memory.c
index 0eb6895..92f8879 100644
--- a/memory.c
+++ b/memory.c
@@ -23,6 +23,7 @@
 #include "qapi/visitor.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
+#include "qemu/log.h"
 #include "qom/object.h"
 #include "trace.h"
 
@@ -31,8 +32,6 @@
 #include "sysemu/kvm.h"
 #include "sysemu/sysemu.h"
 
-//#define DEBUG_UNASSIGNED
-
 static unsigned memory_region_transaction_depth;
 static bool memory_region_update_pending;
 static bool ioeventfd_update_pending;
@@ -1101,9 +1100,7 @@ static void memory_region_initfn(Object *obj)
 static uint64_t unassigned_mem_read(void *opaque, hwaddr addr,
                                     unsigned size)
 {
-#ifdef DEBUG_UNASSIGNED
-    printf("Unassigned mem read " TARGET_FMT_plx "\n", addr);
-#endif
+    qemu_log_mask(LOG_UNIMP, "%s " TARGET_FMT_plx "\n", __func__, addr);
     if (current_cpu != NULL) {
         cpu_unassigned_access(current_cpu, addr, false, false, 0, size);
     }
@@ -1113,9 +1110,8 @@ static uint64_t unassigned_mem_read(void *opaque, hwaddr addr,
 static void unassigned_mem_write(void *opaque, hwaddr addr,
                                  uint64_t val, unsigned size)
 {
-#ifdef DEBUG_UNASSIGNED
-    printf("Unassigned mem write " TARGET_FMT_plx " = 0x%"PRIx64"\n", addr, val);
-#endif
+    qemu_log_mask(LOG_UNIMP, "%s " TARGET_FMT_plx " = 0x%" PRIx64 "\n",
+                  __func__, addr, val);
     if (current_cpu != NULL) {
         cpu_unassigned_access(current_cpu, addr, true, false, 0, size);
     }
-- 
2.1.4

             reply	other threads:[~2016-09-07 19:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07 19:13 Stefan Weil [this message]
2016-09-07 20:17 ` [Qemu-devel] [PATCH] memory: Use standard log messages for unassigned memory read / write no-reply
2016-09-07 20:50   ` Stefan Weil
2016-09-08  5:06     ` Fam Zheng
2016-09-07 21:29 ` Peter Maydell
2016-09-08  5:43   ` Stefan Weil
2016-09-08  9:37     ` Paolo Bonzini
2016-09-08 17:40       ` Stefan Weil

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=1473275627-20024-1-git-send-email-sw@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).