From: Laurent Vivier <laurent@vivier.eu>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Guan Xuetao <gxt@mprc.pku.edu.cn>
Subject: Re: [PATCH] hw/unicore32/puv3: Use qemu_log_mask(ERROR) instead of debug printf()
Date: Tue, 9 Jun 2020 19:02:09 +0200	[thread overview]
Message-ID: <827c7ed6-6c1a-306b-a6e8-3e24c36fadc3@vivier.eu> (raw)
In-Reply-To: <20200524164503.11944-1-f4bug@amsat.org>
Le 24/05/2020 à 18:45, Philippe Mathieu-Daudé a écrit :
> Replace some debug printf() calls by qemu_log_mask(LOG_GUEST_ERROR).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/dma/puv3_dma.c   |  9 +++++++--
>  hw/gpio/puv3_gpio.c | 15 +++++++++++----
>  hw/intc/puv3_intc.c |  9 +++++++--
>  hw/misc/puv3_pm.c   |  9 +++++++--
>  hw/timer/puv3_ost.c |  9 +++++++--
>  hw/unicore32/puv3.c |  2 --
>  6 files changed, 39 insertions(+), 14 deletions(-)
> 
> diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c
> index 5488d388a9..7fa979180f 100644
> --- a/hw/dma/puv3_dma.c
> +++ b/hw/dma/puv3_dma.c
> @@ -15,6 +15,7 @@
>  #undef DEBUG_PUV3
>  #include "hw/unicore32/puv3.h"
>  #include "qemu/module.h"
> +#include "qemu/log.h"
>  
>  #define PUV3_DMA_CH_NR          (6)
>  #define PUV3_DMA_CH_MASK        (0xff)
> @@ -43,7 +44,9 @@ static uint64_t puv3_dma_read(void *opaque, hwaddr offset,
>          ret = s->reg_CFG[PUV3_DMA_CH(offset)];
>          break;
>      default:
> -        DPRINTF("Bad offset 0x%x\n", offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad read offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>      DPRINTF("offset 0x%x, value 0x%x\n", offset, ret);
>  
> @@ -62,7 +65,9 @@ static void puv3_dma_write(void *opaque, hwaddr offset,
>          s->reg_CFG[PUV3_DMA_CH(offset)] = value;
>          break;
>      default:
> -        DPRINTF("Bad offset 0x%x\n", offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad write offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>      DPRINTF("offset 0x%x, value 0x%x\n", offset, value);
>  }
> diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c
> index d19e342514..7362b6715f 100644
> --- a/hw/gpio/puv3_gpio.c
> +++ b/hw/gpio/puv3_gpio.c
> @@ -15,6 +15,7 @@
>  #undef DEBUG_PUV3
>  #include "hw/unicore32/puv3.h"
>  #include "qemu/module.h"
> +#include "qemu/log.h"
>  
>  #define TYPE_PUV3_GPIO "puv3_gpio"
>  #define PUV3_GPIO(obj) OBJECT_CHECK(PUV3GPIOState, (obj), TYPE_PUV3_GPIO)
> @@ -47,7 +48,9 @@ static uint64_t puv3_gpio_read(void *opaque, hwaddr offset,
>          ret = s->reg_GPIR;
>          break;
>      default:
> -        DPRINTF("Bad offset 0x%x\n", offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad read offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>      DPRINTF("offset 0x%x, value 0x%x\n", offset, ret);
>  
> @@ -68,14 +71,16 @@ static void puv3_gpio_write(void *opaque, hwaddr offset,
>          if (s->reg_GPDR & value) {
>              s->reg_GPLR |= value;
>          } else {
> -            DPRINTF("Write gpio input port error!");
> +            qemu_log_mask(LOG_GUEST_ERROR, "%s: Write gpio input port\n",
> +                          __func__);
>          }
>          break;
>      case 0x0c:
>          if (s->reg_GPDR & value) {
>              s->reg_GPLR &= ~value;
>          } else {
> -            DPRINTF("Write gpio input port error!");
> +            qemu_log_mask(LOG_GUEST_ERROR, "%s: Write gpio input port\n",
> +                          __func__);
>          }
>          break;
>      case 0x10: /* GRER */
> @@ -86,7 +91,9 @@ static void puv3_gpio_write(void *opaque, hwaddr offset,
>          s->reg_GPIR = value;
>          break;
>      default:
> -        DPRINTF("Bad offset 0x%x\n", offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad write offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>  }
>  
> diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c
> index e018955ce8..090d4839d1 100644
> --- a/hw/intc/puv3_intc.c
> +++ b/hw/intc/puv3_intc.c
> @@ -16,6 +16,7 @@
>  #undef DEBUG_PUV3
>  #include "hw/unicore32/puv3.h"
>  #include "qemu/module.h"
> +#include "qemu/log.h"
>  
>  #define TYPE_PUV3_INTC "puv3_intc"
>  #define PUV3_INTC(obj) OBJECT_CHECK(PUV3INTCState, (obj), TYPE_PUV3_INTC)
> @@ -68,7 +69,9 @@ static uint64_t puv3_intc_read(void *opaque, hwaddr offset,
>          ret = s->reg_ICPR; /* the same value with ICPR */
>          break;
>      default:
> -        DPRINTF("Bad offset %x\n", (int)offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad read offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>      DPRINTF("offset 0x%x, value 0x%x\n", offset, ret);
>      return ret;
> @@ -88,7 +91,9 @@ static void puv3_intc_write(void *opaque, hwaddr offset,
>          s->reg_ICMR = value;
>          break;
>      default:
> -        DPRINTF("Bad offset 0x%x\n", (int)offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad write offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>          return;
>      }
>      puv3_intc_update(s);
> diff --git a/hw/misc/puv3_pm.c b/hw/misc/puv3_pm.c
> index c213500d9c..8989d363cd 100644
> --- a/hw/misc/puv3_pm.c
> +++ b/hw/misc/puv3_pm.c
> @@ -15,6 +15,7 @@
>  #undef DEBUG_PUV3
>  #include "hw/unicore32/puv3.h"
>  #include "qemu/module.h"
> +#include "qemu/log.h"
>  
>  #define TYPE_PUV3_PM "puv3_pm"
>  #define PUV3_PM(obj) OBJECT_CHECK(PUV3PMState, (obj), TYPE_PUV3_PM)
> @@ -73,7 +74,9 @@ static uint64_t puv3_pm_read(void *opaque, hwaddr offset,
>          ret = 0x7;
>          break;
>      default:
> -        DPRINTF("Bad offset 0x%x\n", offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad read offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>      DPRINTF("offset 0x%x, value 0x%x\n", offset, ret);
>  
> @@ -105,7 +108,9 @@ static void puv3_pm_write(void *opaque, hwaddr offset,
>      case 0x38:
>          break;
>      default:
> -        DPRINTF("Bad offset 0x%x\n", offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad write offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>      DPRINTF("offset 0x%x, value 0x%x\n", offset, value);
>  }
> diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c
> index 697519593b..f76b0bb1ca 100644
> --- a/hw/timer/puv3_ost.c
> +++ b/hw/timer/puv3_ost.c
> @@ -14,6 +14,7 @@
>  #include "hw/irq.h"
>  #include "hw/ptimer.h"
>  #include "qemu/module.h"
> +#include "qemu/log.h"
>  
>  #undef DEBUG_PUV3
>  #include "hw/unicore32/puv3.h"
> @@ -52,7 +53,9 @@ static uint64_t puv3_ost_read(void *opaque, hwaddr offset,
>          ret = s->reg_OIER;
>          break;
>      default:
> -        DPRINTF("Bad offset %x\n", (int)offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad read offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>      DPRINTF("offset 0x%x, value 0x%x\n", offset, ret);
>      return ret;
> @@ -88,7 +91,9 @@ static void puv3_ost_write(void *opaque, hwaddr offset,
>          s->reg_OIER = value;
>          break;
>      default:
> -        DPRINTF("Bad offset %x\n", (int)offset);
> +        qemu_log_mask(LOG_GUEST_ERROR,
> +                      "%s: Bad write offset 0x%"HWADDR_PRIx"\n",
> +                      __func__, offset);
>      }
>  }
>  
> diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c
> index 7f9c0238fe..eacacb4249 100644
> --- a/hw/unicore32/puv3.c
> +++ b/hw/unicore32/puv3.c
> @@ -16,8 +16,6 @@
>  #include "hw/boards.h"
>  #include "hw/loader.h"
>  #include "sysemu/qtest.h"
> -
> -#undef DEBUG_PUV3
>  #include "hw/unicore32/puv3.h"
>  #include "hw/input/i8042.h"
>  #include "hw/irq.h"
> 
Applied to my trivial-patches branch.
Thanks,
Laurent
     prev parent reply	other threads:[~2020-06-09 17:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-24 16:45 [PATCH] hw/unicore32/puv3: Use qemu_log_mask(ERROR) instead of debug printf() Philippe Mathieu-Daudé
2020-05-25  7:32 ` Thomas Huth
2020-06-03  6:03 ` Philippe Mathieu-Daudé
2020-06-09 17:02 ` Laurent Vivier [this message]
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=827c7ed6-6c1a-306b-a6e8-3e24c36fadc3@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=f4bug@amsat.org \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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).