Re: [Qemu-devel] [PATCH 02/43] arm: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
Thanks for review. I'll update and resend these pathces (probably next
week).

2017-04-01 17:51 GMT+03:00 Eric Blake <ebl...@redhat.com>:

> On 04/01/2017 08:32 AM, Danil Antonov wrote:
> >>From 1671b92e5a4a59d5e38ce754d1d0dde2401c8236 Mon Sep 17 00:00:00 2001
> > From: Danil Antonov <g.danil.a...@gmail.com>
> > Date: Wed, 29 Mar 2017 02:09:33 +0300
> > Subject: [PATCH 02/43] arm: made printf always compile in debug output
> >
> > Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
> > This will ensure that printf function will always compile even if debug
> > output is turned off and, in turn, will prevent bitrot of the format
> > strings.
>
> Again, prefer present tense over past tense in the commit message.
>
> >
> > Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
> > ---
> >  hw/arm/strongarm.c | 17 +++--
> >  hw/arm/z2.c| 16 ++--
> >  2 files changed, 21 insertions(+), 12 deletions(-)
> >
> > diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
> > index 3311cc3..88368ac 100644
> > --- a/hw/arm/strongarm.c
> > +++ b/hw/arm/strongarm.c
> > @@ -59,11 +59,16 @@
> >   - Enhance UART with modem signals
> >   */
> >
> > -#ifdef DEBUG
> > -# define DPRINTF(format, ...) printf(format , ## __VA_ARGS__)
> > -#else
> > -# define DPRINTF(format, ...) do { } while (0)
> > -#endif
> > +#ifndef DEBUG
> > +#define DEBUG 0
> > +#endif
> > +
> > +#define DPRINTF(fmt, ...) \
> > +do {  \
> > +if (DEBUG) {  \
> > +fprintf(stderr, fmt, ## __VA_ARGS__); \
>
> Again, changing from stdout to stderr should be mentioned as intentional
> in the commit message.
>
> Note that your change breaks the case of someone that used to do:
>
> make CFLAGS=-DDEBUG=
>
> because now it results in 'if ()' which is not valid syntax; likewise
> for someone that used to do CFLAGS=-DDEBUG=yes.  (Or put another way, as
> written, your patch forces someone to use -DDEBUG=0 or -DDEBUG=1).  A
> safer way is to make the 'if' condition a separate variable than the
> command-line trigger, as in the following, so that regardless of what
> DEBUG is defined to (including the empty string), you are only using
> DEBUG in the preprocessor, while the if conditional is under your
> complete control:
>
> #ifdef DEBUG
> # define DEBUG_PRINT 1
> #else
> # define DEBUG_PRINT 0
> #endif
>
> #definde DPRINTF()... if (DEBUG_PRINT)
>
> > @@ -1022,7 +1027,7 @@ static void
> > strongarm_uart_update_parameters(StrongARMUARTState
> > *s)
> >  s->char_transmit_time =  (NANOSECONDS_PER_SECOND / speed) *
> frame_size;
> >  qemu_chr_fe_ioctl(>chr, CHR_IOCTL_SERIAL_SET_PARAMS, );
> >
> > -DPRINTF(stderr, "%s speed=%d parity=%c data=%d stop=%d\n",
> > s->chr->label,
>
> Oh gross - the old code couldn't even compile correctly when DEBUG was
> defined (since printf(stderr) tries to treat the stderr pointer as a
> format string)!  This is a definite cleanup, and an argument that your
> switch from stdout to stderr is correct.
>
>
> > +++ b/hw/arm/z2.c
> > @@ -27,12 +27,16 @@
> >  #include "exec/address-spaces.h"
> >  #include "sysemu/qtest.h"
> >
> > -#ifdef DEBUG_Z2
> > -#define DPRINTF(fmt, ...) \
> > -printf(fmt, ## __VA_ARGS__)
> > -#else
> > -#define DPRINTF(fmt, ...)
> > -#endif
> > +#ifndef DEBUG_Z2
> > +#define DEBUG_Z2 0
> > +#endif
> > +
> > +#define DPRINTF(fmt, ...)\
> > +do { \
> > +if (DEBUG_Z2) {  \
>
> Again, it's best to separate your conditional to be something completely
> under you control, while still allowing the command line freedom to
> define DEBUG_Z2 to anything (whether an empty string or a non-numeric
> value).
>
> These types of comments probably apply throughout your entire series, so
> it may be better if I wait for a v2 before reviewing too many more.
>
> --
> Eric Blake   eblake redhat com+1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>


[Qemu-devel] [PATCH 42/43] pci-bridge: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From bd32eaf17d401067d46891facfa37fe2a315cd2a Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:44:02 +0300
Subject: [PATCH 42/43] pci-bridge: made printf always compile in debug
output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/pci-bridge/dec.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
index 840c961..84149da 100644
--- a/hw/pci-bridge/dec.c
+++ b/hw/pci-bridge/dec.c
@@ -32,14 +32,16 @@
 #include "hw/pci/pci_bus.h"

 /* debug DEC */
-//#define DEBUG_DEC
-
-#ifdef DEBUG_DEC
-#define DEC_DPRINTF(fmt, ...)   \
-do { printf("DEC: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DEC_DPRINTF(fmt, ...)
-#endif
+
+#ifndef DEBUG_DEC
+#define DEBUG_DEC 0
+#endif
+
+#define DEC_DPRINTF(fmt, ...) do { \
+if (DEBUG_DEC) {   \
+fprintf(stderr, "DEC: " fmt , ## __VA_ARGS__); \
+}  \
+} while (0);

 #define DEC_21154(obj) OBJECT_CHECK(DECState, (obj), TYPE_DEC_21154)

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 38/43] empty_slot: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From f91f364efb44edd51e865872eeb1bc2293d42930 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:42:32 +0300
Subject: [PATCH 38/43] empty_slot: made printf always compile in debug
output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/core/empty_slot.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/hw/core/empty_slot.c b/hw/core/empty_slot.c
index c1b9c2b..b58957d 100644
--- a/hw/core/empty_slot.c
+++ b/hw/core/empty_slot.c
@@ -16,12 +16,15 @@

 //#define DEBUG_EMPTY_SLOT

-#ifdef DEBUG_EMPTY_SLOT
-#define DPRINTF(fmt, ...)   \
-do { printf("empty_slot: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_EMPTY_SLOT
+#define DEBUG_EMPTY_SLOT 0
+#endif
+
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_EMPTY_SLOT) {   \
+fprintf(stderr, "empty_slot: " fmt , ## __VA_ARGS__); \
+} \
+} while (0);

 #define TYPE_EMPTY_SLOT "empty_slot"
 #define EMPTY_SLOT(obj) OBJECT_CHECK(EmptySlot, (obj), TYPE_EMPTY_SLOT)
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 43/43] ssi: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 0bf08ebad3ccfe3e07920f53a304478e1e3b5813 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:44:25 +0300
Subject: [PATCH 43/43] ssi: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/ssi/pl022.c | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/hw/ssi/pl022.c b/hw/ssi/pl022.c
index c136801..bf1cc3a 100644
--- a/hw/ssi/pl022.c
+++ b/hw/ssi/pl022.c
@@ -12,18 +12,22 @@
 #include "hw/ssi/ssi.h"
 #include "qemu/log.h"

-//#define DEBUG_PL022 1
-
-#ifdef DEBUG_PL022
-#define DPRINTF(fmt, ...) \
-do { printf("pl022: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__); exit(1);}
while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+#ifndef DEBUG_PL022
+#define DEBUG_PL022  0
+#endif
+
+#define DPRINTF(fmt, ...) do {   \
+if (DEBUG_PL022) {   \
+fprintf(stderr, "pl022: " fmt , ## __VA_ARGS__); \
+}\
+} while (0);
+
+#define BADF(fmt, ...) do { \
+fprintf(stderr, "pl022: error: " fmt , ## __VA_ARGS__); \
+if (DEBUG_PL022) {   \
+exit(1);\
+}   \
+} while (0);

 #define PL022_CR1_LBM 0x01
 #define PL022_CR1_SSE 0x02
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 41/43] nvram: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From f0ac5a35af1c521bb8f87720ec7f82a9452e38a4 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:43:45 +0300
Subject: [PATCH 41/43] nvram: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/nvram/mac_nvram.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c
index aef80e6..e152203 100644
--- a/hw/nvram/mac_nvram.c
+++ b/hw/nvram/mac_nvram.c
@@ -32,12 +32,16 @@
 /* debug NVR */
 //#define DEBUG_NVR

-#ifdef DEBUG_NVR
-#define NVR_DPRINTF(fmt, ...)   \
-do { printf("NVR: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define NVR_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_NVR
+#define DEBUG_NVR 0
+#endif
+
+#define NVR_DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_NVR) {  \
+fprintf(stderr, "NVR: " fmt, ## __VA_ARGS__); \
+} \
+} while (0)

 #define DEF_SYSTEM_SIZE 0xc10

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 40/43] mips: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From fafbd66ef7cd5e2295a5c14e24a6ec1520ca79f4 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:43:28 +0300
Subject: [PATCH 40/43] mips: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/mips/gt64xxx_pci.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 4811843..adb64ff 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -30,13 +30,16 @@
 #include "hw/i386/pc.h"
 #include "exec/address-spaces.h"

-//#define DEBUG

-#ifdef DEBUG
-#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__,
##__VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG
+#define DEBUG 0
+#endif
+
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG) {  \
+fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__); \
+} \
+} while (0);

 #define GT_REGS(0x1000 >> 2)

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 37/43] audio: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From ef4e9e576ae80c227d06721284bd49b699e71c71 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:41:59 +0300
Subject: [PATCH 37/43] audio: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/audio/lm4549.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/hw/audio/lm4549.c b/hw/audio/lm4549.c
index a46f230..962db8e 100644
--- a/hw/audio/lm4549.c
+++ b/hw/audio/lm4549.c
@@ -26,13 +26,17 @@
 #define LM4549_DUMP_DAC_INPUT 1
 #endif

-#ifdef LM4549_DEBUG
-#define DPRINTF(fmt, ...) \
-do { printf("lm4549: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
+#ifndef LM4549_DEBUG
+#define LM4549_DEBUG 0
 #endif

+#define DPRINTF(fmt, ...)\
+do { \
+if (LM4549_DEBUG) {  \
+fprintf(stderr, "lm4549: " fmt, ## __VA_ARGS__); \
+}\
+} while (0)
+
 #if defined(LM4549_DUMP_DAC_INPUT)
 static FILE *fp_dac_input;
 #endif
@@ -159,7 +163,7 @@ uint32_t lm4549_read(lm4549_state *s, hwaddr offset)
 assert(offset < 128);
 value = regfile[offset];

-DPRINTF("read [0x%02x] = 0x%04x\n", offset, value);
+DPRINTF("read [0x%02x] = 0x%04x\n", (int) offset, value);

 return value;
 }
@@ -170,7 +174,7 @@ void lm4549_write(lm4549_state *s,
 uint16_t *regfile = s->regfile;

 assert(offset < 128);
-DPRINTF("write [0x%02x] = 0x%04x\n", offset, value);
+DPRINTF("write [0x%02x] = 0x%04x\n", (int) offset, value);

 switch (offset) {
 case LM4549_Reset:
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 36/43] gpi: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From adb8f4b937b80629881ea23310a8d75ac4671b2a Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:41:38 +0300
Subject: [PATCH 36/43] gpi: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/gpio/pl061.c | 28 
 hw/gpio/puv3_gpio.c |  8 
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/hw/gpio/pl061.c b/hw/gpio/pl061.c
index 4ae2aa1..af0de24 100644
--- a/hw/gpio/pl061.c
+++ b/hw/gpio/pl061.c
@@ -12,18 +12,22 @@
 #include "hw/sysbus.h"
 #include "qemu/log.h"

-//#define DEBUG_PL061 1
-
-#ifdef DEBUG_PL061
-#define DPRINTF(fmt, ...) \
-do { printf("pl061: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__); exit(1);}
while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+#ifndef DEBUG_PL061
+#define DEBUG_PL061  0
+#endif
+
+#define DPRINTF(fmt, ...) do {   \
+if (DEBUG_PL061) {   \
+fprintf(stderr, "pl061: " fmt , ## __VA_ARGS__); \
+}\
+} while (0);
+
+#define BADF(fmt, ...) do { \
+fprintf(stderr, "pl061: error: " fmt , ## __VA_ARGS__); \
+if (DEBUG_PL061) {  \
+exit(1);\
+}   \
+} while (0);

 static const uint8_t pl061_id[12] =
   { 0x00, 0x00, 0x00, 0x00, 0x61, 0x10, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1
};
diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c
index 445afcc..48a8a4b 100644
--- a/hw/gpio/puv3_gpio.c
+++ b/hw/gpio/puv3_gpio.c
@@ -46,9 +46,9 @@ static uint64_t puv3_gpio_read(void *opaque, hwaddr
offset,
 ret = s->reg_GPIR;
 break;
 default:
-DPRINTF("Bad offset 0x%x\n", offset);
+DPRINTF("Bad offset 0x%lx\n", offset);
 }
-DPRINTF("offset 0x%x, value 0x%x\n", offset, ret);
+DPRINTF("offset 0x%lx, value 0x%x\n", offset, ret);

 return ret;
 }
@@ -58,7 +58,7 @@ static void puv3_gpio_write(void *opaque, hwaddr offset,
 {
 PUV3GPIOState *s = opaque;

-DPRINTF("offset 0x%x, value 0x%x\n", offset, value);
+DPRINTF("offset 0x%lx, value 0x%lx\n", offset, value);
 switch (offset) {
 case 0x04:
 s->reg_GPDR = value;
@@ -85,7 +85,7 @@ static void puv3_gpio_write(void *opaque, hwaddr offset,
 s->reg_GPIR = value;
 break;
 default:
-DPRINTF("Bad offset 0x%x\n", offset);
+DPRINTF("Bad offset 0x%lx\n", offset);
 }
 }

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 34/43] isa: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 2b9e98a4f5a7235bfef9dac5d0c94e5ecaeb1981 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:40:57 +0300
Subject: [PATCH 34/43] isa: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/isa/apm.c  | 14 --
 hw/isa/vt82c686.c | 18 ++
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/hw/isa/apm.c b/hw/isa/apm.c
index e232b0d..c481e22 100644
--- a/hw/isa/apm.c
+++ b/hw/isa/apm.c
@@ -25,13 +25,15 @@
 #include "hw/hw.h"
 #include "hw/pci/pci.h"

-//#define DEBUG
+#ifndef DEBUG
+#define DEBUG 0
+#endif

-#ifdef DEBUG
-# define APM_DPRINTF(format, ...)   printf(format, ## __VA_ARGS__)
-#else
-# define APM_DPRINTF(format, ...)   do { } while (0)
-#endif
+#define APM_DPRINTF(fmt, ...) do { \
+if (DEBUG) {   \
+fprintf(stderr, fmt , ## __VA_ARGS__); \
+}  \
+} while (0);

 /* fixed I/O location */
 #define APM_CNT_IOPORT  0xb2
diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c
index 41d5254..f427e5a 100644
--- a/hw/isa/vt82c686.c
+++ b/hw/isa/vt82c686.c
@@ -27,13 +27,15 @@
 #include "qemu/timer.h"
 #include "exec/address-spaces.h"

-//#define DEBUG_VT82C686B
+#ifndef DEBUG_VT82C686B
+#define DEBUG_VT82C686B 0
+#endif

-#ifdef DEBUG_VT82C686B
-#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__,
##__VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_VT82C686B) {\
+fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__); \
+} \
+} while (0);

 typedef struct SuperIOConfig
 {
@@ -57,7 +59,7 @@ static void superio_ioport_writeb(void *opaque, hwaddr
addr, uint64_t data,
 {
 SuperIOConfig *superio_conf = opaque;

-DPRINTF("superio_ioport_writeb  address 0x%x  val 0x%x\n", addr, data);
+DPRINTF("superio_ioport_writeb  address 0x%lx  val 0x%lx\n", addr,
data);
 if (addr == 0x3f0) {
 superio_conf->index = data & 0xff;
 } else {
@@ -101,7 +103,7 @@ static uint64_t superio_ioport_readb(void *opaque,
hwaddr addr, unsigned size)
 {
 SuperIOConfig *superio_conf = opaque;

-DPRINTF("superio_ioport_readb  address 0x%x\n", addr);
+DPRINTF("superio_ioport_readb  address 0x%lx\n", addr);
 return (superio_conf->config[superio_conf->index]);
 }

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 30/43] block: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 63139dc0a7e3b5c8caa1ecf6fbe900372fddeba0 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:39:12 +0300
Subject: [PATCH 30/43] block: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/block/pflash_cfi01.c | 18 +-
 hw/block/pflash_cfi02.c | 19 +++
 2 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 594d4cf..6e07ad7 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -55,15 +55,15 @@ do { \
 exit(1); \
 } while(0)

-/* #define PFLASH_DEBUG */
-#ifdef PFLASH_DEBUG
-#define DPRINTF(fmt, ...)   \
-do {\
-fprintf(stderr, "PFLASH: " fmt , ## __VA_ARGS__);   \
-} while (0)
-#else
-#define DPRINTF(fmt, ...) do { } while (0)
-#endif
+#ifndef PFLASH_DEBUG
+#define PFLASH_DEBUG 0
+#endif
+
+#define DPRINTF(fmt, ...) do {   \
+if (PFLASH_DEBUG) {  \
+fprintf(stderr, "PFLASH: " fmt, ## __VA_ARGS__); \
+}\
+} while (0);

 #define CFI_PFLASH01(obj) OBJECT_CHECK(pflash_t, (obj), TYPE_CFI_PFLASH01)

diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index e6c5c6c..be35bca 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -46,14 +46,17 @@
 #include "hw/sysbus.h"

 //#define PFLASH_DEBUG
-#ifdef PFLASH_DEBUG
-#define DPRINTF(fmt, ...)  \
-do {   \
-fprintf(stderr, "PFLASH: " fmt , ## __VA_ARGS__);   \
-} while (0)
-#else
-#define DPRINTF(fmt, ...) do { } while (0)
-#endif
+
+#ifndef PFLASH_DEBUG
+#define PFLASH_DEBUG 0
+#endif
+
+#define DPRINTF(fmt, ...) do {   \
+if (PFLASH_DEBUG) {  \
+fprintf(stderr, "PFLASH: " fmt, ## __VA_ARGS__); \
+}\
+} while (0);
+

 #define PFLASH_LAZY_ROMD_THRESHOLD 42

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 33/43] i2c: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 0372d38e66070fefc5f65573dc7fe7bce4cbb9fd Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:40:31 +0300
Subject: [PATCH 33/43] i2c: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/i2c/bitbang_i2c.c | 16 ++--
 hw/i2c/pm_smbus.c| 15 ++-
 hw/i2c/smbus.c   | 28 ++--
 3 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index 8be88ee..55a5f85 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -16,12 +16,16 @@

 //#define DEBUG_BITBANG_I2C

-#ifdef DEBUG_BITBANG_I2C
-#define DPRINTF(fmt, ...) \
-do { printf("bitbang_i2c: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#endif
+#ifndef DEBUG_BITBANG_I2C
+#define DEBUG_BITBANG_I2C 0
+#endif
+
+#define DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_BITBANG_I2C) {  \
+fprintf(stderr, "bitbang_i2c: " fmt, ## __VA_ARGS__); \
+} \
+} while (0)

 typedef enum bitbang_i2c_state {
 STOPPED = 0,
diff --git a/hw/i2c/pm_smbus.c b/hw/i2c/pm_smbus.c
index 6fc3923..b36a460 100644
--- a/hw/i2c/pm_smbus.c
+++ b/hw/i2c/pm_smbus.c
@@ -47,11 +47,16 @@

 //#define DEBUG

-#ifdef DEBUG
-# define SMBUS_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
-#else
-# define SMBUS_DPRINTF(format, ...) do { } while (0)
-#endif
+#ifndef DEBUG
+#define DEBUG 0
+#endif
+
+#define SMBUS_DPRINTF(fmt, ...)   \
+do {  \
+if (DEBUG) {  \
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0)


 static void smb_transaction(PMSMBus *s)
diff --git a/hw/i2c/smbus.c b/hw/i2c/smbus.c
index 2d1b79a..a81445b 100644
--- a/hw/i2c/smbus.c
+++ b/hw/i2c/smbus.c
@@ -16,16 +16,24 @@

 //#define DEBUG_SMBUS 1

-#ifdef DEBUG_SMBUS
-#define DPRINTF(fmt, ...) \
-do { printf("smbus(%02x): " fmt , dev->i2c.address, ## __VA_ARGS__); }
while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "smbus: error: " fmt , ## __VA_ARGS__); exit(1);}
while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "smbus: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+#ifndef DEBUG_SMBUS
+#define DEBUG_SMBUS 0
+#endif
+
+#define DPRINTF(fmt,
...)\
+do
{
\
+if (DEBUG_SMBUS)
{   \
+fprintf(stderr, "smbus(%02x): " fmt , dev->i2c.address, ##
__VA_ARGS__); \
+
}
\
+} while (0)
+
+#define BADF(fmt, ...)  \
+do {\
+fprintf(stderr, "smbus: error: " fmt , ## __VA_ARGS__); \
+if (DEBUG_SMBUS) {  \
+exit(1);\
+}   \
+} while (0)

 enum {
 SMBUS_IDLE,
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 32/43] char: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 9147a39cc2dabe76e7c1b38e801069390d5a3321 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:40:02 +0300
Subject: [PATCH 32/43] char: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/char/ipoctal232.c | 24 +---
 hw/char/serial.c | 16 +---
 2 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c
index 93929c2..180d8f7 100644
--- a/hw/char/ipoctal232.c
+++ b/hw/char/ipoctal232.c
@@ -13,14 +13,16 @@
 #include "qemu/bitops.h"
 #include "sysemu/char.h"

-/* #define DEBUG_IPOCTAL */

-#ifdef DEBUG_IPOCTAL
-#define DPRINTF2(fmt, ...) \
-do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF2(fmt, ...) do { } while (0)
-#endif
+#ifndef DEBUG_IPOCTAL
+#define DEBUG_IPOCTAL 0
+#endif
+
+#define DPRINTF2(fmt, ...) do {\
+if (DEBUG_IPOCTAL) {   \
+fprintf(stderr, fmt, ## __VA_ARGS__);  \
+}  \
+} while (0);

 #define DPRINTF(fmt, ...) DPRINTF2("IP-Octal: " fmt, ## __VA_ARGS__)

@@ -504,11 +506,11 @@ static void hostdev_event(void *opaque, int event)
 SCC2698Channel *ch = opaque;
 switch (event) {
 case CHR_EVENT_OPENED:
-DPRINTF("Device %s opened\n", ch->dev->label);
+DPRINTF("Device %s opened\n", ch->dev.chr->label);
 break;
 case CHR_EVENT_BREAK: {
 uint8_t zero = 0;
-DPRINTF("Device %s received break\n", ch->dev->label);
+DPRINTF("Device %s received break\n", ch->dev.chr->label);

 if (!(ch->sr & SR_BREAK)) {
 IPOctalState *dev = ch->ipoctal;
@@ -528,7 +530,7 @@ static void hostdev_event(void *opaque, int event)
 }
 break;
 default:
-DPRINTF("Device %s received event %d\n", ch->dev->label, event);
+DPRINTF("Device %s received event %d\n", ch->dev.chr->label,
event);
 }
 }

@@ -546,7 +548,7 @@ static void ipoctal_realize(DeviceState *dev, Error
**errp)
 qemu_chr_fe_set_handlers(>dev, hostdev_can_receive,
  hostdev_receive, hostdev_event,
  ch, NULL, true);
-DPRINTF("Redirecting channel %u to %s\n", i, ch->dev->label);
+DPRINTF("Redirecting channel %u to %s\n", i,
ch->dev.chr->label);
 } else {
 DPRINTF("Could not redirect channel %u, no chardev set\n", i);
 }
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 03d890c..9421c7a 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -97,13 +97,15 @@

 #define MAX_XMIT_RETRY  4

-#ifdef DEBUG_SERIAL
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do {} while (0)
-#endif
+#ifndef DEBUG_SERIAL
+#define DEBUG_SERIAL 0
+#endif
+
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_SERIAL) {   \
+fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); \
+} \
+} while (0);

 static void serial_receive1(void *opaque, const uint8_t *buf, int size);
 static void serial_xmit(SerialState *s);
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 31/43] display: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 40bba9c5cdb7060dd01d1c7d81140779e45a489d Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:39:40 +0300
Subject: [PATCH 31/43] display: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/display/sm501.c   | 15 ++-
 hw/display/ssd0303.c | 26 +++---
 hw/display/ssd0323.c | 28 +++-
 3 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/hw/display/sm501.c b/hw/display/sm501.c
index 040a0b9..ff16613 100644
--- a/hw/display/sm501.c
+++ b/hw/display/sm501.c
@@ -52,11 +52,16 @@
 //#define DEBUG_SM501
 //#define DEBUG_BITBLT

-#ifdef DEBUG_SM501
-#define SM501_DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
-#else
-#define SM501_DPRINTF(fmt, ...) do {} while(0)
-#endif
+#ifndef DEBUG_SM501
+#define DEBUG_SM501 0
+#endif
+
+#define SM501_DPRINTF(fmt, ...)   \
+do {  \
+if (DEBUG_SM501) {\
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0)


 #define MMIO_BASE_OFFSET 0x3e0
diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c
index 68a80b9..35ce7c4 100644
--- a/hw/display/ssd0303.c
+++ b/hw/display/ssd0303.c
@@ -14,18 +14,22 @@
 #include "hw/i2c/i2c.h"
 #include "ui/console.h"

-//#define DEBUG_SSD0303 1
+#ifndef DEBUG_SSD0303
+#define DEBUG_SSD0303 0
+#endif

-#ifdef DEBUG_SSD0303
-#define DPRINTF(fmt, ...) \
-do { printf("ssd0303: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "ssd0303: error: " fmt , ## __VA_ARGS__); exit(1);}
while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "ssd0303: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_SSD0303) {  \
+fprintf(stderr, "ssd0303: " fmt , ## __VA_ARGS__); \
+} \
+} while (0);
+
+#define BADF(fmt, ...) do {   \
+fprintf(stderr, "ssd0303: error: " fmt , ## __VA_ARGS__); \
+if (DEBUG_SSD0303) {  \
+exit(1);  \
+} \
+} while (0);

 /* Scaling factor for pixels.  */
 #define MAGNIFY 4
diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c
index e182893..70b1e33 100644
--- a/hw/display/ssd0323.c
+++ b/hw/display/ssd0323.c
@@ -14,20 +14,22 @@
 #include "hw/ssi/ssi.h"
 #include "ui/console.h"

-//#define DEBUG_SSD0323 1
+#ifndef DEBUG_SSD0323
+#define DEBUG_SSD0323 0
+#endif

-#ifdef DEBUG_SSD0323
-#define DPRINTF(fmt, ...) \
-do { printf("ssd0323: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { \
-fprintf(stderr, "ssd0323: error: " fmt , ## __VA_ARGS__); abort(); \
-} while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "ssd0323: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_SSD0323) {  \
+fprintf(stderr, "ssd0323: " fmt , ## __VA_ARGS__); \
+} \
+} while (0);
+
+#define BADF(fmt, ...) do {   \
+fprintf(stderr, "ssd0323: error: " fmt , ## __VA_ARGS__); \
+if (DEBUG_SSD0323) {  \
+abort();  \
+} \
+} while (0);

 /* Scaling factor for pixels.  */
 #define MAGNIFY 4
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 28/43] sparc64: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 825d7eda5d2900ef7eda37eeebf2b50ea445d50b Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:38:23 +0300
Subject: [PATCH 28/43] sparc64: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/sparc64/sparc64.c | 36 +++-
 hw/sparc64/sun4u.c   | 16 +---
 2 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/hw/sparc64/sparc64.c b/hw/sparc64/sparc64.c
index 4e4fdab..2f1136f 100644
--- a/hw/sparc64/sparc64.c
+++ b/hw/sparc64/sparc64.c
@@ -29,23 +29,25 @@
 #include "hw/sparc/sparc64.h"
 #include "qemu/timer.h"

-
-//#define DEBUG_IRQ
-//#define DEBUG_TIMER
-
-#ifdef DEBUG_IRQ
-#define CPUIRQ_DPRINTF(fmt, ...)\
-do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define CPUIRQ_DPRINTF(fmt, ...)
-#endif
-
-#ifdef DEBUG_TIMER
-#define TIMER_DPRINTF(fmt, ...)  \
-do { printf("TIMER: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define TIMER_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_IRQ
+#define DEBUG_IRQ 0
+#endif
+
+#ifndef DEBUG_TIMER
+#define DEBUG_TIMER 0
+#endif
+
+#define CPUIRQ_DPRINTF(fmt, ...) do { \
+if (DEBUG_IRQ) {  \
+fprintf(stderr, "CPUIRQ: " fmt , ## __VA_ARGS__); \
+} \
+} while (0);
+
+#define TIMER_DPRINTF(fmt, ...) do { \
+if (DEBUG_TIMER) {   \
+fprintf(stderr, "TIMER: " fmt , ## __VA_ARGS__); \
+}\
+} while (0);

 #define TICK_MAX 0x7fffULL

diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index d347b66..c27b738 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -46,14 +46,16 @@
 #include "elf.h"
 #include "qemu/cutils.h"

-//#define DEBUG_EBUS

-#ifdef DEBUG_EBUS
-#define EBUS_DPRINTF(fmt, ...)  \
-do { printf("EBUS: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define EBUS_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_EBUS
+#define DEBUG_EBUS 0
+#endif
+
+#define EBUS_DPRINTF(fmt, ...) do { \
+if (DEBUG_EBUS) {   \
+fprintf(stderr, "EBUS: " fmt , ## __VA_ARGS__); \
+}   \
+} while (0);

 #define KERNEL_LOAD_ADDR 0x00404000
 #define CMDLINE_ADDR 0x003ff000
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 27/43] vfio: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From c986c5a54a394feadfd885d41848f28d11fec40f Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:37:26 +0300
Subject: [PATCH 27/43] vfio: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 include/hw/vfio/vfio-common.h | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
index c582de1..3d3cc89 100644
--- a/include/hw/vfio/vfio-common.h
+++ b/include/hw/vfio/vfio-common.h
@@ -33,14 +33,15 @@
 #define ERR_PREFIX "vfio error: %s: "
 #define WARN_PREFIX "vfio warning: %s: "

-/*#define DEBUG_VFIO*/
-#ifdef DEBUG_VFIO
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "vfio: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+#ifndef DEBUG_VFIO
+#define DEBUG_VFIO 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+if (DEBUG_VFIO) {  \
+fprintf(stderr, "vfio: " fmt, ## __VA_ARGS__); \
+}  \
+} while (0);

 enum {
 VFIO_DEVICE_TYPE_PCI = 0,
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 26/43] unicore32: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 32ac7bdabbf1935a8a30f606aa3263461117e7d0 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:36:57 +0300
Subject: [PATCH 26/43] unicore32: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 include/hw/unicore32/puv3.h | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/hw/unicore32/puv3.h b/include/hw/unicore32/puv3.h
index 5a4839f..e9e3ae6 100644
--- a/include/hw/unicore32/puv3.h
+++ b/include/hw/unicore32/puv3.h
@@ -41,10 +41,15 @@
 #define PUV3_IRQS_OST0  (26)

 /* All puv3_*.c use DPRINTF for debug. */
-#ifdef DEBUG_PUV3
-#define DPRINTF(fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
+
+#ifndef DEBUG_PUV3
+#define DEBUG_PUV3 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+if (DEBUG_PUV3) {  \
+fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__); \
+}  \
+} while (0);

 #endif /* QEMU_HW_PUV3_H */
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 24/43] migration: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From e5719e802fcd1d1b426d687524ed46f10d044941 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:35:10 +0300
Subject: [PATCH 24/43] migration: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 migration/block.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/migration/block.c b/migration/block.c
index 7734ff7..a5b4e49 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -42,13 +42,15 @@

 //#define DEBUG_BLK_MIGRATION

-#ifdef DEBUG_BLK_MIGRATION
-#define DPRINTF(fmt, ...) \
-do { printf("blk_migration: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+#ifndef DEBUG_BLK_MIGRATION
+#define DEBUG_BLK_MIGRATION 0
+#endif
+
+#define DPRINTF(fmt, ...) do {  \
+if (DEBUG_BLK_MIGRATION) {  \
+fprintf(stderr, "blk_migration: " fmt, ## __VA_ARGS__); \
+}   \
+} while (0);

 typedef struct BlkMigDevState {
 /* Written during setup phase.  Can be read without a lock.  */
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 25/43] kvm-all: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From f818d3ef7db8cc5b99656fd1059c0d7d07dea571 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:35:36 +0300
Subject: [PATCH 25/43] kvm-all: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 kvm-all.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index 90b8573..47940b5 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -50,16 +50,16 @@
  */
 #define PAGE_SIZE getpagesize()

-//#define DEBUG_KVM
-
-#ifdef DEBUG_KVM
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
+#ifndef DEBUG_KVM
+#define DEBUG_KVM 0
 #endif

+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_KVM) {\
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0);
+
 #define KVM_MSI_HASHTAB_SIZE256

 struct KVMParkedVcpu {
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 22/43] virtio: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 2e5d92b2d1955b3e85f1e93ad98469d00c47a658 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:33:29 +0300
Subject: [PATCH 22/43] virtio: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/virtio/virtio-bus.c  | 15 ++-
 hw/virtio/virtio-mmio.c | 17 ++---
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
index 3042232..35cfef5 100644
--- a/hw/virtio/virtio-bus.c
+++ b/hw/virtio/virtio-bus.c
@@ -31,15 +31,20 @@
 #include "hw/virtio/virtio.h"
 #include "exec/address-spaces.h"

+
 /* #define DEBUG_VIRTIO_BUS */

-#ifdef DEBUG_VIRTIO_BUS
-#define DPRINTF(fmt, ...) \
-do { printf("virtio_bus: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do { } while (0)
+#ifndef DEBUG_VIRTIO_BUS
+#define DEBUG_VIRTIO_BUS 0
 #endif

+#define DPRINTF(fmt, ...)\
+do { \
+if (DEBUG_VIRTIO_BUS) {  \
+fprintf(stderr, "virtio_bus: " fmt, ## __VA_ARGS__); \
+}\
+} while (0)
+
 /* A VirtIODevice is being plugged */
 void virtio_bus_device_plugged(VirtIODevice *vdev, Error **errp)
 {
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 5807aa8..31e3094 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -30,13 +30,16 @@

 /* #define DEBUG_VIRTIO_MMIO */

-#ifdef DEBUG_VIRTIO_MMIO
-
-#define DPRINTF(fmt, ...) \
-do { printf("virtio_mmio: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_VIRTIO_MMIO
+#define DEBUG_VIRTIO_MMIO  0
+#endif
+
+#define DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_VIRTIO_MMIO) {  \
+fprintf(stderr, "virtio_mmio: " fmt, ## __VA_ARGS__); \
+} \
+} while (0)

 /* QOM macros */
 /* virtio-mmio-bus */
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 23/43] page-cahe: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From fc02b5cacabab0d1fc547167954abb7447bfef21 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:34:38 +0300
Subject: [PATCH 23/43] page-cahe: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 page_cache.c | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/page_cache.c b/page_cache.c
index 5f85787..783a9a4 100644
--- a/page_cache.c
+++ b/page_cache.c
@@ -18,13 +18,16 @@
 #include "qemu/host-utils.h"
 #include "migration/page_cache.h"

-#ifdef DEBUG_CACHE
-#define DPRINTF(fmt, ...) \
-do { fprintf(stdout, "cache: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+
+#ifndef DEBUG_CACHE
+#define DEBUG_CACHE 0
+#endif
+
+#define DPRINTF(fmt, ...) do {  \
+if (DEBUG_CACHE) {  \
+fprintf(stderr, "cache: " fmt, ## __VA_ARGS__); \
+}   \
+} while (0);

 /* the page in cache will not be replaced in two cycles */
 #define CACHED_PAGE_LIFETIME 2
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 21/43] s390: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From cbc3425092b6ee94d365f8714a39af5a583a Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:33:01 +0300
Subject: [PATCH 21/43] s390: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/s390x/s390-pci-bus.c  | 18 +++---
 hw/s390x/s390-pci-inst.c | 18 +++---
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 69b0291..6dd9bca 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -24,13 +24,17 @@
 #include "qemu/error-report.h"

 /* #define DEBUG_S390PCI_BUS */
-#ifdef DEBUG_S390PCI_BUS
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "S390pci-bus: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+
+#ifndef DEBUG_S390PCI_BUS
+#define DEBUG_S390PCI_BUS  0
+#endif
+
+#define DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_S390PCI_BUS) {  \
+fprintf(stderr, "S390pci-bus: " fmt, ## __VA_ARGS__); \
+} \
+} while (0)

 S390pciState *s390_get_phb(void)
 {
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index d2a8c0a..82b5617 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -21,13 +21,17 @@
 #include "sysemu/hw_accel.h"

 /* #define DEBUG_S390PCI_INST */
-#ifdef DEBUG_S390PCI_INST
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "s390pci-inst: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+
+#ifndef DEBUG_S390PCI_INST
+#define DEBUG_S390PCI_INST  0
+#endif
+
+#define DPRINTF(fmt, ...)  \
+do {   \
+if (DEBUG_S390PCI_INST) {  \
+fprintf(stderr, "s390pci-inst: " fmt, ## __VA_ARGS__); \
+}  \
+} while (0)

 static void s390_set_status_code(CPUS390XState *env,
  uint8_t r, uint64_t status_code)
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 20/43] i386: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From a132733828991a950855138982d4a60858e92b04 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:32:16 +0300
Subject: [PATCH 20/43] i386: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/i386/acpi-build.c   | 17 +++--
 hw/i386/intel_iommu.c  | 18 +-
 hw/i386/pc.c   | 16 ++--
 hw/i386/xen/xen_platform.c | 17 ++---
 4 files changed, 40 insertions(+), 28 deletions(-)

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2073108..53b3aaf 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -75,12 +75,17 @@
 #define ACPI_BUILD_TABLE_SIZE 0x2

 /* #define DEBUG_ACPI_BUILD */
-#ifdef DEBUG_ACPI_BUILD
-#define ACPI_BUILD_DPRINTF(fmt, ...)\
-do {printf("ACPI_BUILD: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define ACPI_BUILD_DPRINTF(fmt, ...)
-#endif
+
+#ifndef DEBUG_ACPI_BUILD
+#define DEBUG_ACPI_BUILD 0
+#endif
+
+#define ACPI_BUILD_DPRINTF(fmt, ...) \
+do { \
+if (DEBUG_ACPI_BUILD) {  \
+fprintf(stderr, "ACPI_BUILD: " fmt, ## __VA_ARGS__); \
+}\
+} while (0)

 /* Default IOAPIC ID */
 #define ACPI_BUILD_IOAPIC_ID 0x0
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 22d8226..562588b 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -37,8 +37,10 @@
 #include "kvm_i386.h"
 #include "trace.h"

-/*#define DEBUG_INTEL_IOMMU*/
-#ifdef DEBUG_INTEL_IOMMU
+#ifndef DEBUG_INTEL_IOMMU
+#define DEBUG_INTEL_IOMMU 0
+#endif
+
 enum {
 DEBUG_GENERAL, DEBUG_CSR, DEBUG_INV, DEBUG_MMU, DEBUG_FLOG,
 DEBUG_CACHE, DEBUG_IR,
@@ -46,14 +48,12 @@ enum {
 #define VTD_DBGBIT(x)   (1 << DEBUG_##x)
 static int vtd_dbgflags = VTD_DBGBIT(GENERAL) | VTD_DBGBIT(CSR);

-#define VTD_DPRINTF(what, fmt, ...) do { \
-if (vtd_dbgflags & VTD_DBGBIT(what)) { \
-fprintf(stderr, "(vtd)%s: " fmt "\n", __func__, \
-## __VA_ARGS__); } \
+#define VTD_DPRINTF(what, fmt,
...)  \
+do
{   \
+if (DEBUG_INTEL_IOMMU && vtd_dbgflags & VTD_DBGBIT(what))
{\
+fprintf(stderr, "(vtd)%s: " fmt "\n", __func__, ##
__VA_ARGS__);   \
+
}  \
 } while (0)
-#else
-#define VTD_DPRINTF(what, fmt, ...) do {} while (0)
-#endif

 static void vtd_define_quad(IntelIOMMUState *s, hwaddr addr, uint64_t val,
 uint64_t wmask, uint64_t w1cmask)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index d24388e..87b4312 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -73,12 +73,16 @@
 /* debug PC/ISA interrupts */
 //#define DEBUG_IRQ

-#ifdef DEBUG_IRQ
-#define DPRINTF(fmt, ...)   \
-do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_IRQ
+#define DEBUG_IRQ 0
+#endif
+
+#define DPRINTF(fmt, ...)\
+do { \
+if (DEBUG_IRQ) { \
+fprintf(stderr, "CPUIRQ: " fmt, ## __VA_ARGS__); \
+}\
+} while (0)

 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
 #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
diff --git a/hw/i386/xen/xen_platform.c b/hw/i386/xen/xen_platform.c
index 6010f35..218bc2f 100644
--- a/hw/i386/xen/xen_platform.c
+++ b/hw/i386/xen/xen_platform.c
@@ -41,13 +41,16 @@

 //#define DEBUG_PLATFORM

-#ifdef DEBUG_PLATFORM
-#define DPRINTF(fmt, ...) do { \
-fprintf(stderr, "xen_platform: " fmt, ## __VA_ARGS__); \
-} while (0)
-#else
-#define DPRINTF(fmt, ...) do { } while (0)
-#endif
+#ifndef DEBUG_PLATFORM
+#define DEBUG_PLATFORM 0
+#endif
+
+#define DPRINTF(fmt, ...)  \
+do {   \
+if (DEBUG_PLATFORM) {  \
+fprintf(stderr, "xen_platform: " fmt, ## __VA_ARGS__); \
+}  \
+} while (0)

 #define PFFLAG_ROM_LOCK 1 /* Sets whether ROM memory area is RW or RO */

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 19/43] input: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 2ff917db477911239c613f3b8f3605b12d669bfe Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:31:47 +0300
Subject: [PATCH 19/43] input: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/input/adb.c | 17 ++---
 hw/input/pckbd.c   | 17 +++--
 hw/input/vmmouse.c | 15 ++-
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/hw/input/adb.c b/hw/input/adb.c
index 43d3205..a8e0958 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -31,13 +31,16 @@

 /* debug ADB */
 //#define DEBUG_ADB
-
-#ifdef DEBUG_ADB
-#define ADB_DPRINTF(fmt, ...) \
-do { printf("ADB: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define ADB_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_ADB
+#define DEBUG_ADB 0
+#endif
+
+#define ADB_DPRINTF(fmt, ...)   \
+do {\
+if (DEBUG_ADB) {\
+fprintf(stderr, "ADB: " fmt , ## __VA_ARGS__);  \
+}   \
+} while (0)

 /* ADB commands */
 #define ADB_BUSRESET0x00
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index d414288..d886ab6 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -30,12 +30,17 @@

 /* debug PC keyboard */
 //#define DEBUG_KBD
-#ifdef DEBUG_KBD
-#define DPRINTF(fmt, ...)   \
-do { printf("KBD: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+
+#ifndef DEBUG_KBD
+#define DEBUG_KBD 0
+#endif
+
+#define DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_KBD) {  \
+fprintf(stderr, "KDB: " fmt , ## __VA_ARGS__); \
+} \
+} while (0)

 /*Keyboard Controller Commands */
 #define KBD_CCMD_READ_MODE0x20/* Read mode bits */
diff --git a/hw/input/vmmouse.c b/hw/input/vmmouse.c
index 6d15a88..2a4fa0a 100644
--- a/hw/input/vmmouse.c
+++ b/hw/input/vmmouse.c
@@ -46,11 +46,16 @@

 #define VMMOUSE_VERSION0x3442554a

-#ifdef DEBUG_VMMOUSE
-#define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...) do { } while (0)
-#endif
+#ifndef DEBUG_VMMOUSE
+#define DEBUG_VMMOUSE 0
+#endif
+
+#define DPRINTF(fmt, ...)  \
+do {   \
+if (DEBUG_VMMOUSE) {   \
+fprintf(stderr, fmt, ## __VA_ARGS__);  \
+}  \
+} while (0)

 #define TYPE_VMMOUSE "vmmouse"
 #define VMMOUSE(obj) OBJECT_CHECK(VMMouseState, (obj), TYPE_VMMOUSE)
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 17/43] net: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From d01cd76d0b20ee8fa67c07da64b0e2301e510247 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:30:42 +0300
Subject: [PATCH 17/43] net: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/net/dp8393x.c| 15 ++-
 hw/net/lan9118.c| 20 ++--
 hw/net/mcf_fec.c| 18 +++---
 hw/net/stellaris_enet.c | 28 ++--
 4 files changed, 53 insertions(+), 28 deletions(-)

diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index efa33ad..1236990 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -25,13 +25,13 @@
 #include "qemu/timer.h"
 #include 

-//#define DEBUG_SONIC
+#ifndef DEBUG_SONIC
+#define DEBUG_SONIC  0
+#endif

 #define SONIC_PROM_SIZE 0x1000

 #ifdef DEBUG_SONIC
-#define DPRINTF(fmt, ...) \
-do { printf("sonic: " fmt , ##  __VA_ARGS__); } while (0)
 static const char* reg_names[] = {
 "CR", "DCR", "RCR", "TCR", "IMR", "ISR", "UTDA", "CTDA",
 "TPS", "TFC", "TSA0", "TSA1", "TFS", "URDA", "CRDA", "CRBA0",
@@ -41,10 +41,15 @@ static const char* reg_names[] = {
 "SR", "WT0", "WT1", "RSC", "CRCT", "FAET", "MPT", "MDT",
 "0x30", "0x31", "0x32", "0x33", "0x34", "0x35", "0x36", "0x37",
 "0x38", "0x39", "0x3a", "0x3b", "0x3c", "0x3d", "0x3e", "DCR2" };
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
 #endif

+#define DPRINTF(fmt, ...)   \
+do {\
+if (DEBUG_SONIC) {  \
+fprintf(stderr, "sonic: " fmt, ## __VA_ARGS__); \
+}   \
+} while (0)
+
 #define SONIC_ERROR(fmt, ...) \
 do { printf("sonic ERROR: %s: " fmt, __func__ , ## __VA_ARGS__); } while
(0)

diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index 3db8937..427160a 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -22,17 +22,25 @@

 //#define DEBUG_LAN9118

+#ifndef DEBUG_LAN9118
+#define DEBUG_LAN9118 0
+#endif
+
 #ifdef DEBUG_LAN9118
-#define DPRINTF(fmt, ...) \
-do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0)
 #define BADF(fmt, ...) \
 do { hw_error("lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
 #else
-#define DPRINTF(fmt, ...) do {} while(0)
 #define BADF(fmt, ...) \
 do { fprintf(stderr, "lan9118: error: " fmt , ## __VA_ARGS__);} while (0)
 #endif

+#define DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_LAN9118) {  \
+fprintf(stderr, "lan9118: " fmt, ## __VA_ARGS__); \
+} \
+} while (0)
+
 #define CSR_ID_REV  0x50
 #define CSR_IRQ_CFG 0x54
 #define CSR_INT_STS 0x58
@@ -1033,7 +1041,7 @@ static void lan9118_writel(void *opaque, hwaddr
offset,
 s->int_sts |= val & SW_INT;
 break;
 case CSR_FIFO_INT:
-DPRINTF("FIFO INT levels %08x\n", val);
+DPRINTF("FIFO INT levels %08x\n", (int)val);
 s->fifo_int = val;
 break;
 case CSR_RX_CFG:
@@ -1114,9 +1122,9 @@ static void lan9118_writel(void *opaque, hwaddr
offset,
 if (val & 0x8000) {
 if (val & 0x4000) {
 s->mac_data = do_mac_read(s, val & 0xf);
-DPRINTF("MAC read %d = 0x%08x\n", val & 0xf, s->mac_data);
+DPRINTF("MAC read %lx = 0x%08x\n", val & 0xf, s->mac_data);
 } else {
-DPRINTF("MAC write %d = 0x%08x\n", val & 0xf, s->mac_data);
+DPRINTF("MAC write %lx = 0x%08x\n", val & 0xf,
s->mac_data);
 do_mac_write(s, val & 0xf, s->mac_data);
 }
 }
diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
index bfa6b4b..b1430ee 100644
--- a/hw/net/mcf_fec.c
+++ b/hw/net/mcf_fec.c
@@ -18,12 +18,16 @@

 //#define DEBUG_FEC 1

-#ifdef DEBUG_FEC
-#define DPRINTF(fmt, ...) \
-do { printf("mcf_fec: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...

[Qemu-devel] [PATCH 18/43] pci-host: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From b5c0463a6d755be8bfcf4402390e877abcf606c6 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:31:07 +0300
Subject: [PATCH 18/43] pci-host: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/pci-host/apb.c  | 16 ++--
 hw/pci-host/bonito.c   | 19 ---
 hw/pci-host/grackle.c  | 16 ++--
 hw/pci-host/uninorth.c | 16 ++--
 4 files changed, 42 insertions(+), 25 deletions(-)

diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index 653e711..e1ef3db 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -41,12 +41,16 @@
 /* debug APB */
 //#define DEBUG_APB

-#ifdef DEBUG_APB
-#define APB_DPRINTF(fmt, ...) \
-do { printf("APB: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define APB_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_APB
+#define DEBUG_APB 0
+#endif
+
+#define APB_DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_APB) {  \
+fprintf(stderr, "APB: " fmt, ## __VA_ARGS__); \
+} \
+} while (0)

 /* debug IOMMU */
 //#define DEBUG_IOMMU
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index 1999ece..49a28de 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -49,11 +49,16 @@

 //#define DEBUG_BONITO

-#ifdef DEBUG_BONITO
-#define DPRINTF(fmt, ...) fprintf(stderr, "%s: " fmt, __FUNCTION__,
##__VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_BONITO
+#define DEBUG_BONITO 0
+#endif
+
+#define DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_BONITO) {   \
+fprintf(stderr, "%s: " fmt, __FUNCTION__, ##__VA_ARGS__); \
+} \
+} while (0)

 /* from linux soure code. include/asm-mips/mips-boards/bonito64.h*/
 #define BONITO_BOOT_BASE0x1fc0
@@ -236,7 +241,7 @@ static void bonito_writel(void *opaque, hwaddr addr,

 saddr = addr >> 2;

-DPRINTF("bonito_writel "TARGET_FMT_plx" val %x saddr %x\n", addr, val,
saddr);
+DPRINTF("bonito_writel "TARGET_FMT_plx" val %lx saddr %x\n", addr,
val, saddr);
 switch (saddr) {
 case BONITO_BONPONCFG:
 case BONITO_IODEVCFG:
@@ -323,7 +328,7 @@ static void bonito_pciconf_writel(void *opaque, hwaddr
addr,
 PCIBonitoState *s = opaque;
 PCIDevice *d = PCI_DEVICE(s);

-DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %x\n", addr, val);
+DPRINTF("bonito_pciconf_writel "TARGET_FMT_plx" val %lx\n", addr, val);
 d->config_write(d, addr, val, 4);
 }

diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
index 2c8acda..129929c 100644
--- a/hw/pci-host/grackle.c
+++ b/hw/pci-host/grackle.c
@@ -31,12 +31,16 @@
 /* debug Grackle */
 //#define DEBUG_GRACKLE

-#ifdef DEBUG_GRACKLE
-#define GRACKLE_DPRINTF(fmt, ...)   \
-do { printf("GRACKLE: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define GRACKLE_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_GRACKLE
+#define DEBUG_GRACKLE 0
+#endif
+
+#define GRACKLE_DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_GRACKLE) {  \
+fprintf(stderr, "GRACKLE: " fmt, ## __VA_ARGS__); \
+} \
+} while (0)

 #define GRACKLE_PCI_HOST_BRIDGE(obj) \
 OBJECT_CHECK(GrackleState, (obj), TYPE_GRACKLE_PCI_HOST_BRIDGE)
diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index df342ac..408b29f 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -30,12 +30,16 @@
 /* debug UniNorth */
 //#define DEBUG_UNIN

-#ifdef DEBUG_UNIN
-#define UNIN_DPRINTF(fmt, ...)  \
-do { printf("UNIN: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define UNIN_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_UNIN
+#define DEBUG_UNIN 0
+#endif
+
+#define UNIN_DPRINTF(fmt, ...) \
+do {   \
+if (DEBUG_UNIN) {  \
+fprintf(stderr, "UNIN: " fmt, ## __VA_ARGS__); \
+}  \
+} while (0)

 static const int unin_irq_line[] = { 0x1b, 0x1c, 0x1d, 0x1e };

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 16/43] intc: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 3985e3226a996f019649b6b7a4d6e3e64f81ea8d Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:30:06 +0300
Subject: [PATCH 16/43] intc: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/intc/arm_gicv3_kvm.c   | 16 +---
 hw/intc/exynos4210_combiner.c | 18 +-
 hw/intc/heathrow_pic.c| 17 ++---
 hw/intc/i8259.c   | 16 +---
 hw/intc/ioapic.c  | 16 +---
 hw/intc/puv3_intc.c   |  4 ++--
 6 files changed, 48 insertions(+), 39 deletions(-)

diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index 81f0403..32e75c0 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -30,13 +30,15 @@
 #include "vgic_common.h"
 #include "migration/migration.h"

-#ifdef DEBUG_GICV3_KVM
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "kvm_gicv3: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+#ifndef DEBUG_GICV3_KVM
+#define DEBUG_GICV3_KVM 0
+#endif
+
+#define DPRINTF(fmt, ...) do {   \
+if (DEBUG_GICV3_KVM) {   \
+fprintf(stderr, "kvm_gicv3: " fmt , ## __VA_ARGS__); \
+}\
+} while (0);

 #define TYPE_KVM_ARM_GICV3 "kvm-arm-gicv3"
 #define KVM_ARM_GICV3(obj) \
diff --git a/hw/intc/exynos4210_combiner.c b/hw/intc/exynos4210_combiner.c
index f19a706..512fda6 100644
--- a/hw/intc/exynos4210_combiner.c
+++ b/hw/intc/exynos4210_combiner.c
@@ -32,15 +32,15 @@

 #include "hw/arm/exynos4210.h"

-//#define DEBUG_COMBINER
-
-#ifdef DEBUG_COMBINER
-#define DPRINTF(fmt, ...) \
-do { fprintf(stdout, "COMBINER: [%s:%d] " fmt, __func__ ,
__LINE__, \
-## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_COMBINER
+#define DEBUG_COMBINER 0
+#endif
+
+#define DPRINTF(fmt, ...) do
{  \
+if (DEBUG_COMBINER)
{   \
+fprintf(stdout, "COMBINER: [%s:%d] " fmt, __func__ , __LINE__, ##
__VA_ARGS__); \
+
}
\
+} while (0);

 #defineIIC_NGRP64/* Internal Interrupt Combiner
 Groups number */
diff --git a/hw/intc/heathrow_pic.c b/hw/intc/heathrow_pic.c
index 171f5ed..b9593f7 100644
--- a/hw/intc/heathrow_pic.c
+++ b/hw/intc/heathrow_pic.c
@@ -29,12 +29,15 @@
 /* debug PIC */
 //#define DEBUG_PIC

-#ifdef DEBUG_PIC
-#define PIC_DPRINTF(fmt, ...)   \
-do { printf("PIC: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define PIC_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_PIC
+#define DEBUG_PIC 0
+#endif
+
+#define PIC_DPRINTF(fmt, ...) do {\
+if (DEBUG_PIC) {  \
+fprintf(stderr, "PIC: " fmt , ## __VA_ARGS__); \
+} \
+} while (0);

 typedef struct HeathrowPIC {
 uint32_t events;
@@ -72,7 +75,7 @@ static void pic_write(void *opaque, hwaddr addr,
 unsigned int n;

 n = ((addr & 0xfff) - 0x10) >> 4;
-PIC_DPRINTF("writel: " TARGET_FMT_plx " %u: %08x\n", addr, n, value);
+PIC_DPRINTF("writel: " TARGET_FMT_plx " %u: %08x\n", addr, n, (int)
value);
 if (n >= 2)
 return;
 pic = >pics[n];
diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c
index fe9ecd6..43a20ce 100644
--- a/hw/intc/i8259.c
+++ b/hw/intc/i8259.c
@@ -32,14 +32,16 @@
 #include "hw/intc/intc.h"

 /* debug PIC */
-//#define DEBUG_PIC

-#ifdef DEBUG_PIC
-#define DPRINTF(fmt, ...)   \
-do { printf("pic: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_PIC
+#define DEBUG_PIC 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+if (DEBUG_PIC) {   \
+fprintf(stderr, "pic: " fmt , ## __VA_ARGS__); \
+}  \
+} while (0);

 //#define DEBUG_IRQ_LATENCY
 //#define DEBUG_IRQ_COUNT
diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
index 37c4386..684401a 100644
--- a/hw/intc/ioapic.c
+++ b/hw/intc/ioapic.c
@@ -35,14 +35,16 @@
 #include "hw/i386/x86-iommu.h"
 #include "trace.h"

-//#define DEBUG_IOAPIC

-#ifdef DEBUG_IOAPIC
-#define DPRINTF(fmt, ...) 

[Qemu-devel] [PATCH 15/43] timer: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 49700fb48d06fd29d13013b7d159017af5b7 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:29:29 +0300
Subject: [PATCH 15/43] timer: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/timer/exynos4210_mct.c | 43 ++-
 hw/timer/exynos4210_pwm.c | 18 +-
 hw/timer/exynos4210_rtc.c | 12 +---
 hw/timer/hpet.c   | 24 ++--
 hw/timer/mc146818rtc.c| 33 +++--
 hw/timer/pl031.c  | 17 +
 hw/timer/puv3_ost.c   |  4 ++--
 hw/timer/sun4v-rtc.c  | 18 ++
 8 files changed, 90 insertions(+), 79 deletions(-)

diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
index 0c18934..ebda0d3 100644
--- a/hw/timer/exynos4210_mct.c
+++ b/hw/timer/exynos4210_mct.c
@@ -61,15 +61,16 @@

 #include "hw/arm/exynos4210.h"

-//#define DEBUG_MCT

-#ifdef DEBUG_MCT
-#define DPRINTF(fmt, ...) \
-do { fprintf(stdout, "MCT: [%24s:%5d] " fmt, __func__, __LINE__, \
- ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_MCT
+#define DEBUG_MCT 0
+#endif
+
+#define DPRINTF(fmt, ...) do
{\
+if (DEBUG_MCT)
{  \
+fprintf(stdout, "MCT: [%24s:%5d] " fmt, __func__, __LINE__,  ##
__VA_ARGS__); \
+
}
\
+} while (0);

 #defineMCT_CFG  0x000
 #defineG_CNT_L  0x100
@@ -366,7 +367,7 @@ static void
exynos4210_mct_update_freq(Exynos4210MCTState *s);
 static void exynos4210_gfrc_set_count(Exynos4210MCTGT *s, uint64_t count)
 {
 s->count = count;
-DPRINTF("global timer frc set count 0x%llx\n", count);
+DPRINTF("global timer frc set count 0x%lx\n", count);
 ptimer_set_count(s->ptimer_frc, count);
 }

@@ -463,7 +464,7 @@ static int32_t exynos4210_gcomp_find(Exynos4210MCTState
*s)
 res = min_comp_i;
 }

-DPRINTF("found comparator %d: comp 0x%llx distance 0x%llx, gfrc
0x%llx\n",
+DPRINTF("found comparator %d: comp 0x%lx distance 0x%lx, gfrc 0x%lx\n",
 res,
 s->g_timer.reg.comp[res],
 distance_min,
@@ -902,7 +903,7 @@ static void exynos4210_ltick_event(void *opaque)
 if (s->reg.int_enb & L_INT_INTENB_ICNTEIE) {
 #ifdef DEBUG_MCT
 time2[s->id] = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
-DPRINTF("local timer[%d] IRQ: %llx\n", s->id,
+DPRINTF("local timer[%d] IRQ: %lx\n", s->id,
 time2[s->id] - time1[s->id]);
 time1[s->id] = time2[s->id];
 #endif
@@ -1006,7 +1007,7 @@ static uint64_t exynos4210_mct_read(void *opaque,
hwaddr offset,
 shift = 8 * (offset & 0x4);
 count = exynos4210_gfrc_get_count(>g_timer);
 value = UINT32_MAX & (count >> shift);
-DPRINTF("read FRC=0x%llx\n", count);
+DPRINTF("read FRC=0x%lx\n", count);
 break;

 case G_CNT_WSTAT:
@@ -1128,14 +1129,14 @@ static void exynos4210_mct_write(void *opaque,
hwaddr offset,
 case G_CNT_U:
 if (offset == G_CNT_L) {

-DPRINTF("global timer write to reg.cntl %llx\n", value);
+DPRINTF("global timer write to reg.cntl %lx\n", value);

 new_frc = (s->g_timer.reg.cnt & (uint64_t)UINT32_MAX << 32) +
value;
 s->g_timer.reg.cnt_wstat |= G_CNT_WSTAT_L;
 }
 if (offset == G_CNT_U) {

-DPRINTF("global timer write to reg.cntu %llx\n", value);
+DPRINTF("global timer write to reg.cntu %lx\n", value);

 new_frc = (s->g_timer.reg.cnt & UINT32_MAX) +
 ((uint64_t)value << 32);
@@ -1159,7 +1160,7 @@ static void exynos4210_mct_write(void *opaque, hwaddr
offset,
 (((uint64_t)UINT32_MAX << 32) >> shift)) +
 (value << shift);

-DPRINTF("comparator %d write 0x%llx val << %d\n", index, value, shift);
+DPRINTF("comparator %d write 0x%lx val << %d\n", index, value, shift);

 if (offset&0x4) {
 s->g_timer.reg.wstat |= G_WSTAT_COMP_U(index);
@@ -1175,7 +1176,7 @@ static void exynos4210_mct_write(void *opaque, hwaddr
offset,
 s->g_timer.reg.tcon = value;
 s->g_timer.reg.wstat |= G_WSTAT_TCON_WRITE;

-DPRINTF("glob

[Qemu-devel] [PATCH 14/43] usb: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 02b1e378eea154c0169a3d16b64ae27c64919c2c Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:28:51 +0300
Subject: [PATCH 14/43] usb: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/usb/dev-serial.c  | 17 +
 hw/usb/dev-storage.c | 17 +
 hw/usb/hcd-ehci.h| 10 +-
 hw/usb/hcd-xhci.c| 19 ---
 4 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/hw/usb/dev-serial.c b/hw/usb/dev-serial.c
index 6d51373..739e79b 100644
--- a/hw/usb/dev-serial.c
+++ b/hw/usb/dev-serial.c
@@ -17,14 +17,15 @@
 #include "hw/usb/desc.h"
 #include "sysemu/char.h"

-//#define DEBUG_Serial
-
-#ifdef DEBUG_Serial
-#define DPRINTF(fmt, ...) \
-do { printf("usb-serial: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#endif
+#ifndef DEBUG_Serial
+#define DEBUG_Serial 0
+#endif
+
+#define DPRINTF(fmt, ...) do {  \
+if (DEBUG_Serial) { \
+fprintf(stderr, "usb-serial: " fmt,## __VA_ARGS__); \
+}   \
+} while (0);

 #define RECV_BUF 384

diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index 8a61ec9..b85c006 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -24,14 +24,15 @@
 #include "qapi/visitor.h"
 #include "qemu/cutils.h"

-//#define DEBUG_MSD
-
-#ifdef DEBUG_MSD
-#define DPRINTF(fmt, ...) \
-do { printf("usb-msd: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#endif
+#ifndef DEBUG_MSD
+#define DEBUG_MSD 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+if (DEBUG_MSD) {   \
+fprintf(stderr, "usb-msd: " fmt , ## __VA_ARGS__); \
+}  \
+} while (0);

 /* USB requests.  */
 #define MassStorageReset  0xff
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 938d8aa..ca6094e 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -30,11 +30,11 @@
 #define EHCI_DEBUG   0
 #endif

-#if EHCI_DEBUG
-#define DPRINTF printf
-#else
-#define DPRINTF(...)
-#endif
+#define DPRINTF(fmt, ...) do {\
+if (EHCI_DEBUG) { \
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0);

 #define MMIO_SIZE0x1000
 #define CAPA_SIZE0x10
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index f0af852..9f5e5b2 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -32,11 +32,16 @@
 //#define DEBUG_XHCI
 //#define DEBUG_DATA

-#ifdef DEBUG_XHCI
-#define DPRINTF(...) fprintf(stderr, __VA_ARGS__)
-#else
-#define DPRINTF(...) do {} while (0)
-#endif
+#ifndef DEBUG_XHCI
+#define DEBUG_XHCI 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+if (DEBUG_XHCI) {  \
+fprintf(stderr, fmt , ## __VA_ARGS__); \
+}  \
+} while (0);
+
 #define FIXME(_msg) do { fprintf(stderr, "FIXME %s:%d %s\n", \
  __func__, __LINE__, _msg); abort(); }
while (0)

@@ -1806,7 +1811,7 @@ static int xhci_setup_packet(XHCITransfer *xfer)
 ep = xhci_epid_to_usbep(xfer->epctx);
 if (!ep) {
 DPRINTF("xhci: slot %d has no device\n",
-xfer->slotid);
+xfer->epctx->slotid);
 return -1;
 }
 }
@@ -1980,7 +1985,7 @@ static int xhci_submit(XHCIState *xhci, XHCITransfer
*xfer, XHCIEPContext *epctx
 {
 uint64_t mfindex;

-DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid);
+DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->epctx->slotid,
xfer->epctx->epid);

 xfer->in_xfer = epctx->type>>2;

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 13/43] pci: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 7ff1463852763cbe7b8260147aa0c19bf91c8cbb Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:27:57 +0300
Subject: [PATCH 13/43] pci: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/pci/msi.c  | 17 +++--
 hw/pci/pci.c  | 16 +++-
 hw/pci/pci_host.c | 16 ++--
 hw/pci/pcie.c | 18 --
 hw/pci/pcie_aer.c | 18 --
 5 files changed, 56 insertions(+), 29 deletions(-)

diff --git a/hw/pci/msi.c b/hw/pci/msi.c
index a87b227..b7cfa5c 100644
--- a/hw/pci/msi.c
+++ b/hw/pci/msi.c
@@ -72,12 +72,17 @@ static inline uint8_t msi_cap_sizeof(uint16_t flags)

 //#define MSI_DEBUG

-#ifdef MSI_DEBUG
-# define MSI_DPRINTF(fmt, ...)  \
-fprintf(stderr, "%s:%d " fmt, __func__, __LINE__, ## __VA_ARGS__)
-#else
-# define MSI_DPRINTF(fmt, ...)  do { } while (0)
-#endif
+#ifndef MSI_DEBUG
+#define MSI_DEBUG 0
+#endif
+
+#define MSI_DPRINTF(fmt,
...)  \
+do
{   \
+if (MSI_DEBUG)
{   \
+fprintf(stderr, "%s:%d " fmt, __func__, __LINE__, ##
__VA_ARGS__); \
+
}  \
+} while (0)
+
 #define MSI_DEV_PRINTF(dev, fmt, ...)   \
 MSI_DPRINTF("%s:%x " fmt, (dev)->name, (dev)->devfn, ## __VA_ARGS__)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index e6b08e1..80d08af 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -43,11 +43,17 @@
 #include "qemu/cutils.h"

 //#define DEBUG_PCI
-#ifdef DEBUG_PCI
-# define PCI_DPRINTF(format, ...)   printf(format, ## __VA_ARGS__)
-#else
-# define PCI_DPRINTF(format, ...)   do { } while (0)
-#endif
+//
+#ifndef DEBUG_PCI
+#define DEBUG_PCI 0
+#endif
+
+#define PCI_DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG_PCI) {  \
+fprintf(stderr, "pci: " fmt, ## __VA_ARGS__); \
+} \
+} while (0)

 static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
 static char *pcibus_get_dev_path(DeviceState *dev);
diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c
index 5eaa935..83fde14 100644
--- a/hw/pci/pci_host.c
+++ b/hw/pci/pci_host.c
@@ -27,12 +27,16 @@
 /* debug PCI */
 //#define DEBUG_PCI

-#ifdef DEBUG_PCI
-#define PCI_DPRINTF(fmt, ...) \
-do { printf("pci_host_data: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define PCI_DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_PCI
+#define DEBUG_PCI 0
+#endif
+
+#define PCI_DPRINTF(fmt, ...)   \
+do {\
+if (DEBUG_PCI) {\
+fprintf(stderr, "pci_host_data: " fmt, ## __VA_ARGS__); \
+}   \
+} while (0)

 /*
  * PCI address
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 18e634f..5148f69 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -30,12 +30,18 @@
 #include "qemu/range.h"

 //#define DEBUG_PCIE
-#ifdef DEBUG_PCIE
-# define PCIE_DPRINTF(fmt, ...) \
-fprintf(stderr, "%s:%d " fmt, __func__, __LINE__, ## __VA_ARGS__)
-#else
-# define PCIE_DPRINTF(fmt, ...) do {} while (0)
-#endif
+
+#ifndef DEBUG_PCIE
+#define DEBUG_PCIE 0
+#endif
+
+#define PCIE_DPRINTF(fmt,
...) \
+do
{   \
+if (DEBUG_PCIE)
{  \
+fprintf(stderr, "%s:%d " fmt, __func__, __LINE__, ##
__VA_ARGS__); \
+
}  \
+} while (0)
+
 #define PCIE_DEV_PRINTF(dev, fmt, ...)  \
 PCIE_DPRINTF("%s:%x "fmt, (dev)->name, (dev)->devfn, ## __VA_ARGS__)

diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c
index a8c1820..5dfedda 100644
--- a/hw/pci/pcie_aer.c
+++ b/hw/pci/pcie_aer.c
@@ -32,12 +32,18 @@
 #include "qapi/error.h"

 //#define DEBUG_PCIE
-#ifdef DEBUG_PCIE
-# define PCIE_DPRINTF(fmt, ...) \
-fprintf(stderr, "%s:%d " fmt, __fun

[Qemu-devel] [PATCH 12/43] sd: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 78c7cc133ba566b13afe6e9924e174b6d081e393 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:27:24 +0300
Subject: [PATCH 12/43] sd: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/sd/pl181.c  | 16 ++--
 hw/sd/sd.c | 14 +-
 hw/sd/ssi-sd.c | 27 +--
 3 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/hw/sd/pl181.c b/hw/sd/pl181.c
index 82c63a4..e4d350f 100644
--- a/hw/sd/pl181.c
+++ b/hw/sd/pl181.c
@@ -16,14 +16,18 @@
 #include "qapi/error.h"

 //#define DEBUG_PL181 1
-
-#ifdef DEBUG_PL181
-#define DPRINTF(fmt, ...) \
-do { printf("pl181: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
+//
+#ifndef DEBUG_PL181
+#define DEBUG_PL181 0
 #endif

+#define DPRINTF(fmt, ...)   \
+do {\
+if (DEBUG_PL181) {  \
+fprintf(stderr, "pl181: " fmt, ## __VA_ARGS__); \
+}   \
+} while (0)
+
 #define PL181_FIFO_LEN 16

 #define TYPE_PL181 "pl181"
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index ba47bff..f2cd369 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -43,13 +43,17 @@

 //#define DEBUG_SD 1

-#ifdef DEBUG_SD
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "SD: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
+#ifndef DEBUG_SD
+#define DEBUG_SD 0
 #endif

+#define DPRINTF(fmt, ...)\
+do { \
+if (DEBUG_SD) {  \
+fprintf(stderr, "SD: " fmt, ## __VA_ARGS__); \
+}\
+} while (0)
+
 #define ACMD41_ENQUIRY_MASK 0x00ff
 #define OCR_POWER_UP0x8000
 #define OCR_POWER_DELAY_NS  50 /* 0.5ms */
diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c
index 24001dc..c8168ae 100644
--- a/hw/sd/ssi-sd.c
+++ b/hw/sd/ssi-sd.c
@@ -18,18 +18,25 @@
 #include "qapi/error.h"

 //#define DEBUG_SSI_SD 1
-
-#ifdef DEBUG_SSI_SD
-#define DPRINTF(fmt, ...) \
-do { printf("ssi_sd: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "ssi_sd: error: " fmt , ## __VA_ARGS__); exit(1);}
while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "ssi_sd: error: " fmt , ## __VA_ARGS__);} while (0)
+#ifndef DEBUG_SSI_SD
+#define DEBUG_SSI_SD 0
 #endif

+#define DPRINTF(fmt, ...)\
+do { \
+if (DEBUG_SSI_SD) {  \
+fprintf(stderr, "ssi_sd: " fmt, ## __VA_ARGS__); \
+}\
+} while (0)
+
+#define BADF(fmt, ...)  \
+do {\
+fprintf(stderr, "ssi_sd: error: " fmt, ## __VA_ARGS__); \
+if (DEBUG_SSI_SD) { \
+exit(1);\
+}   \
+} while (0)
+
 typedef enum {
 SSI_SD_CMD = 0,
 SSI_SD_CMDARG,
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 11/43] scsi: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 48b18f304de1761128e8cccbb517ddad4346c824 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:26:43 +0300
Subject: [PATCH 11/43] scsi: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/scsi/lsi53c895a.c   | 26 --
 hw/scsi/scsi-disk.c| 17 ++---
 hw/scsi/scsi-generic.c | 17 +
 3 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 595c260..379db4b 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -24,16 +24,22 @@
 //#define DEBUG_LSI
 //#define DEBUG_LSI_REG

-#ifdef DEBUG_LSI
-#define DPRINTF(fmt, ...) \
-do { printf("lsi_scsi: " fmt , ## __VA_ARGS__); } while (0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__); exit(1);}
while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#define BADF(fmt, ...) \
-do { fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__);} while (0)
-#endif
+#ifndef DEBUG_LSI
+#define DEBUG_LSI 0
+#endif
+
+#define DPRINTF(fmt, ...) do {  \
+if (DEBUG_LSI) {\
+fprintf(stderr, "lsi_scsi: " fmt , ## __VA_ARGS__); \
+}   \
+} while (0);
+
+#define BADF(fmt, ...) do {\
+fprintf(stderr, "lsi_scsi: error: " fmt , ## __VA_ARGS__); \
+if (DEBUG_LSI) {   \
+exit(1);   \
+}  \
+} while (0);

 static const char *names[] = {
 "SCNTL0", "SCNTL1", "SCNTL2", "SCNTL3", "SCID", "SXFER", "SDID",
"GPREG",
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index a53f058..33213df 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -19,14 +19,17 @@
  * the host adapter emulator.
  */

-//#define DEBUG_SCSI

-#ifdef DEBUG_SCSI
-#define DPRINTF(fmt, ...) \
-do { printf("scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#endif
+#ifndef DEBUG_SCSI
+#define DEBUG_SCSI 0
+#endif
+
+#define DPRINTF(fmt, ...) do {   \
+if (DEBUG_SCSI) {\
+fprintf(stderr, "scsi-disk: " fmt , ## __VA_ARGS__); \
+}\
+} while (0);
+

 #include "qemu/osdep.h"
 #include "qapi/error.h"
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index a55ff87..dcd3c08 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -21,14 +21,15 @@

 #ifdef __linux__

-//#define DEBUG_SCSI
-
-#ifdef DEBUG_SCSI
-#define DPRINTF(fmt, ...) \
-do { printf("scsi-generic: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) do {} while(0)
-#endif
+#ifndef DEBUG_SCSI
+#define DEBUG_SCSI 0
+#endif
+
+#define DPRINTF(fmt, ...) do {  \
+if (DEBUG_SCSI) {   \
+fprintf(stderr, "scsi-generic: " fmt , ## __VA_ARGS__); \
+}   \
+} while (0);

 #define BADF(fmt, ...) \
 do { fprintf(stderr, "scsi-generic: " fmt , ## __VA_ARGS__); } while (0)
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 10/43] s390x: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From ea9cd8f02bd98548435f561e62f4f9b672318bcb Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:26:05 +0300
Subject: [PATCH 10/43] s390x: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 target/s390x/kvm.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index ac47154..ac994fe 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -47,15 +47,15 @@
 #include "exec/memattrs.h"
 #include "hw/s390x/s390-virtio-ccw.h"

-/* #define DEBUG_KVM */
-
-#ifdef DEBUG_KVM
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+#ifndef DEBUG_KVM
+#define DEBUG_KVM  0
+#endif
+
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_KVM) {  \
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0);

 #define kvm_vm_check_mem_attr(s, attr) \
 kvm_vm_check_attr(s, KVM_S390_VM_MEM_CTRL, attr)
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 09/43] ppc: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 236c82fee189c22b88313fda71816e486edab8a6 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 12:23:58 +0300
Subject: [PATCH 09/43] ppc: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 target/ppc/kvm.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 9f1f132..5425055 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -50,15 +50,15 @@
 #include "hw/ppc/spapr_cpu_core.h"
 #endif

-//#define DEBUG_KVM
-
-#ifdef DEBUG_KVM
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+#ifndef DEBUG_KVM
+#define DEBUG_KVM 0
+#endif
+
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_KVM) { \
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0);

 #define PROC_DEVTREE_CPU  "/proc/device-tree/cpus/"

-- 
2.8.0.rc3


[Qemu-devel] [PATCH 08/43] kvm: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 7aed02e5ee9662d4ff8e7857594fdf7b3b52c9e4 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 02:16:54 +0300
Subject: [PATCH 08/43] kvm: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 target/i386/kvm.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 55865db..46762e2 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -47,15 +47,15 @@
 #include "exec/memattrs.h"
 #include "trace.h"

-//#define DEBUG_KVM
-
-#ifdef DEBUG_KVM
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+#ifndef DEBUG_KVM
+#define DEBUG_KVM 0
+#endif
+
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_KVM) { \
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0);

 #define MSR_KVM_WALL_CLOCK  0x11
 #define MSR_KVM_SYSTEM_TIME 0x12
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 07/43] ldst_helper: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From a827e069c46b272ab952dfde370c1954decdf3dd Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 02:15:48 +0300
Subject: [PATCH 07/43] ldst_helper: made printf always compile in debug
output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 target/sparc/ldst_helper.c | 67
+++---
 1 file changed, 39 insertions(+), 28 deletions(-)

diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index 57968d9..7fe9b85 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -25,38 +25,49 @@
 #include "exec/cpu_ldst.h"
 #include "asi.h"

-//#define DEBUG_MMU
-//#define DEBUG_MXCC
 //#define DEBUG_UNALIGNED
 //#define DEBUG_UNASSIGNED
-//#define DEBUG_ASI
-//#define DEBUG_CACHE_CONTROL

-#ifdef DEBUG_MMU
-#define DPRINTF_MMU(fmt, ...)   \
-do { printf("MMU: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF_MMU(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_MMU
+#define DEBUG_MMU 0
+#endif

-#ifdef DEBUG_MXCC
-#define DPRINTF_MXCC(fmt, ...)  \
-do { printf("MXCC: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF_MXCC(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_MXCC
+#define DEBUG_MXCC 0
+#endif

-#ifdef DEBUG_ASI
-#define DPRINTF_ASI(fmt, ...)   \
-do { printf("ASI: " fmt , ## __VA_ARGS__); } while (0)
-#endif
+#ifndef DEBUG_ASI
+#define DEBUG_ASI 0
+#endif

-#ifdef DEBUG_CACHE_CONTROL
-#define DPRINTF_CACHE_CONTROL(fmt, ...) \
-do { printf("CACHE_CONTROL: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF_CACHE_CONTROL(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_CACHE_CONTROL
+#define DEBUG_CACHE_CONTROL 0
+#endif
+
+
+#define DPRINTF_MMU(fmt, ...) do {\
+if (DEBUG_MMU) {  \
+fprintf(stderr, "MMU: " fmt, ## __VA_ARGS__); \
+} \
+} while (0);
+
+#define DPRINTF_MXCC(fmt, ...) do {\
+if (DEBUG_MXCC) {  \
+fprintf(stderr, "MXCC: " fmt, ## __VA_ARGS__); \
+}  \
+} while (0);
+
+#define DPRINTF_ASI(fmt, ...) do {\
+if (DEBUG_ASI) {  \
+fprintf(stderr, "ASI: " fmt, ## __VA_ARGS__); \
+} \
+} while (0);
+
+#define DPRINTF_CACHE_CONTROL(fmt, ...) do {\
+if (DEBUG_CACHE_CONTROL) {  \
+fprintf(stderr, "CACHE_CONTROL: " fmt, ## __VA_ARGS__); \
+}   \
+} while (0);

 #ifdef TARGET_SPARC64
 #ifndef TARGET_ABI32
@@ -1631,7 +1642,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong
addr, target_ulong val,

 if (oldreg != env->immu.mmuregs[reg]) {
 DPRINTF_MMU("immu change reg[%d]: 0x%016" PRIx64 " ->
0x%016"
-PRIx64 "\n", reg, oldreg, env->immuregs[reg]);
+PRIx64 "\n", reg, oldreg,
env->immu.mmuregs[reg]);
 }
 #ifdef DEBUG_MMU
 dump_mmu(stdout, fprintf, env);
@@ -1715,7 +1726,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong
addr, target_ulong val,

 if (oldreg != env->dmmu.mmuregs[reg]) {
 DPRINTF_MMU("dmmu change reg[%d]: 0x%016" PRIx64 " ->
0x%016"
-PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]);
+PRIx64 "\n", reg, oldreg,
env->dmmu.mmuregs[reg]);
 }
 #ifdef DEBUG_MMU
 dump_mmu(stdout, fprintf, env);
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 07/43] ldst_helper: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From a827e069c46b272ab952dfde370c1954decdf3dd Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 02:15:48 +0300
Subject: [PATCH 07/43] ldst_helper: made printf always compile in debug
output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 target/sparc/ldst_helper.c | 67
+++---
 1 file changed, 39 insertions(+), 28 deletions(-)

diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index 57968d9..7fe9b85 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -25,38 +25,49 @@
 #include "exec/cpu_ldst.h"
 #include "asi.h"

-//#define DEBUG_MMU
-//#define DEBUG_MXCC
 //#define DEBUG_UNALIGNED
 //#define DEBUG_UNASSIGNED
-//#define DEBUG_ASI
-//#define DEBUG_CACHE_CONTROL

-#ifdef DEBUG_MMU
-#define DPRINTF_MMU(fmt, ...)   \
-do { printf("MMU: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF_MMU(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_MMU
+#define DEBUG_MMU 0
+#endif

-#ifdef DEBUG_MXCC
-#define DPRINTF_MXCC(fmt, ...)  \
-do { printf("MXCC: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF_MXCC(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_MXCC
+#define DEBUG_MXCC 0
+#endif

-#ifdef DEBUG_ASI
-#define DPRINTF_ASI(fmt, ...)   \
-do { printf("ASI: " fmt , ## __VA_ARGS__); } while (0)
-#endif
+#ifndef DEBUG_ASI
+#define DEBUG_ASI 0
+#endif

-#ifdef DEBUG_CACHE_CONTROL
-#define DPRINTF_CACHE_CONTROL(fmt, ...) \
-do { printf("CACHE_CONTROL: " fmt , ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF_CACHE_CONTROL(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_CACHE_CONTROL
+#define DEBUG_CACHE_CONTROL 0
+#endif
+
+
+#define DPRINTF_MMU(fmt, ...) do {\
+if (DEBUG_MMU) {  \
+fprintf(stderr, "MMU: " fmt, ## __VA_ARGS__); \
+} \
+} while (0);
+
+#define DPRINTF_MXCC(fmt, ...) do {\
+if (DEBUG_MXCC) {  \
+fprintf(stderr, "MXCC: " fmt, ## __VA_ARGS__); \
+}  \
+} while (0);
+
+#define DPRINTF_ASI(fmt, ...) do {\
+if (DEBUG_ASI) {  \
+fprintf(stderr, "ASI: " fmt, ## __VA_ARGS__); \
+} \
+} while (0);
+
+#define DPRINTF_CACHE_CONTROL(fmt, ...) do {\
+if (DEBUG_CACHE_CONTROL) {  \
+fprintf(stderr, "CACHE_CONTROL: " fmt, ## __VA_ARGS__); \
+}   \
+} while (0);

 #ifdef TARGET_SPARC64
 #ifndef TARGET_ABI32
@@ -1631,7 +1642,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong
addr, target_ulong val,

 if (oldreg != env->immu.mmuregs[reg]) {
 DPRINTF_MMU("immu change reg[%d]: 0x%016" PRIx64 " ->
0x%016"
-PRIx64 "\n", reg, oldreg, env->immuregs[reg]);
+PRIx64 "\n", reg, oldreg,
env->immu.mmuregs[reg]);
 }
 #ifdef DEBUG_MMU
 dump_mmu(stdout, fprintf, env);
@@ -1715,7 +1726,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong
addr, target_ulong val,

 if (oldreg != env->dmmu.mmuregs[reg]) {
 DPRINTF_MMU("dmmu change reg[%d]: 0x%016" PRIx64 " ->
0x%016"
-PRIx64 "\n", reg, oldreg, env->dmmuregs[reg]);
+PRIx64 "\n", reg, oldreg,
env->dmmu.mmuregs[reg]);
 }
 #ifdef DEBUG_MMU
 dump_mmu(stdout, fprintf, env);
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 06/43] unicore32: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From e7a576c46bcdaeb49c1c4fdbb59d38944df340ae Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 02:14:49 +0300
Subject: [PATCH 06/43] unicore32: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 target/unicore32/helper.c  | 16 +---
 target/unicore32/softmmu.c | 14 --
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/target/unicore32/helper.c b/target/unicore32/helper.c
index f9239dc..5df8de0 100644
--- a/target/unicore32/helper.c
+++ b/target/unicore32/helper.c
@@ -19,13 +19,15 @@
 #include "ui/console.h"
 #endif

-#undef DEBUG_UC32
-
-#ifdef DEBUG_UC32
-#define DPRINTF(fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
+#ifndef DEBUG_UC32
+#define DEBUG_UC32 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+if (DEBUG_UC32) {  \
+fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__); \
+}  \
+} while (0);

 UniCore32CPU *uc32_cpu_init(const char *cpu_model)
 {
diff --git a/target/unicore32/softmmu.c b/target/unicore32/softmmu.c
index e7152e7..173875b 100644
--- a/target/unicore32/softmmu.c
+++ b/target/unicore32/softmmu.c
@@ -16,13 +16,15 @@
 #include "cpu.h"
 #include "exec/exec-all.h"

-#undef DEBUG_UC32
+#ifndef DEBUG_UC32
+#define DEBUG_UC32 0
+#endif

-#ifdef DEBUG_UC32
-#define DPRINTF(fmt, ...) printf("%s: " fmt , __func__, ## __VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...) do {} while (0)
-#endif
+#define DPRINTF(fmt, ...) do { \
+if (DEBUG_UC32) {  \
+fprintf(stderr, "%s: " fmt, __func__, ## __VA_ARGS__); \
+}  \
+} while (0);

 #define SUPERPAGE_SIZE (1 << 22)
 #define UC32_PAGETABLE_READ(1 << 8)
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 05/43] xen-mapcache: made printf always compile in debug

2017-04-01 Thread Danil Antonov
>From 0e4a8a20c9c05e547d42be1b9ef868d12e7b43a9 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 02:14:06 +0300
Subject: [PATCH 05/43] xen-mapcache: made printf always compile in debug
 output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 xen-mapcache.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen-mapcache.c b/xen-mapcache.c
index 1a96d2e..c2d1e6f 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -22,15 +22,15 @@
 #include "trace-root.h"


-//#define MAPCACHE_DEBUG
-
-#ifdef MAPCACHE_DEBUG
-#  define DPRINTF(fmt, ...) do { \
-fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \
-} while (0)
-#else
-#  define DPRINTF(fmt, ...) do { } while (0)
-#endif
+#ifndef MAPCACHE_DEBUG
+#define MAPCACHE_DEBUG 0
+#endif
+
+#define DPRINTF(fmt, ...) do { \
+if (MAPCACHE_DEBUG) {  \
+fprintf(stderr, "xen_mapcache: " fmt, ## __VA_ARGS__); \
+}  \
+} while (0);

 #if HOST_LONG_BITS == 32
 #  define MCACHE_BUCKET_SHIFT 16
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 04/43] xen-hvm: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 05d558842b0a10ee3f0606eb54068b6ba03906a3 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 02:13:13 +0300
Subject: [PATCH 04/43] xen-hvm: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 xen-hvm.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen-hvm.c b/xen-hvm.c
index 5043beb..abf0f72 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -29,15 +29,15 @@
 #include 
 #include 

-//#define DEBUG_XEN_HVM
-
-#ifdef DEBUG_XEN_HVM
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+#ifndef DEBUG_XEN_HVM
+#define DEBUG_XEN_HVM 0
+#endif
+
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_XEN_HVM) {  \
+fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); \
+} \
+} while (0);

 static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi;
 static MemoryRegion *framebuffer;
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 02/43] arm: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 1671b92e5a4a59d5e38ce754d1d0dde2401c8236 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 02:09:33 +0300
Subject: [PATCH 02/43] arm: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/arm/strongarm.c | 17 +++--
 hw/arm/z2.c| 16 ++--
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
index 3311cc3..88368ac 100644
--- a/hw/arm/strongarm.c
+++ b/hw/arm/strongarm.c
@@ -59,11 +59,16 @@
  - Enhance UART with modem signals
  */

-#ifdef DEBUG
-# define DPRINTF(format, ...) printf(format , ## __VA_ARGS__)
-#else
-# define DPRINTF(format, ...) do { } while (0)
-#endif
+#ifndef DEBUG
+#define DEBUG 0
+#endif
+
+#define DPRINTF(fmt, ...) \
+do {  \
+if (DEBUG) {  \
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0)

 static struct {
 hwaddr io_base;
@@ -1022,7 +1027,7 @@ static void
strongarm_uart_update_parameters(StrongARMUARTState
*s)
 s->char_transmit_time =  (NANOSECONDS_PER_SECOND / speed) * frame_size;
 qemu_chr_fe_ioctl(>chr, CHR_IOCTL_SERIAL_SET_PARAMS, );

-DPRINTF(stderr, "%s speed=%d parity=%c data=%d stop=%d\n",
s->chr->label,
+DPRINTF("%s speed=%d parity=%c data=%d stop=%d\n", s->chr.chr->label,
 speed, parity, data_bits, stop_bits);
 }

diff --git a/hw/arm/z2.c b/hw/arm/z2.c
index 1607cbd..1ee8ed9 100644
--- a/hw/arm/z2.c
+++ b/hw/arm/z2.c
@@ -27,12 +27,16 @@
 #include "exec/address-spaces.h"
 #include "sysemu/qtest.h"

-#ifdef DEBUG_Z2
-#define DPRINTF(fmt, ...) \
-printf(fmt, ## __VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...)
-#endif
+#ifndef DEBUG_Z2
+#define DEBUG_Z2 0
+#endif
+
+#define DPRINTF(fmt, ...)\
+do { \
+if (DEBUG_Z2) {  \
+fprintf(stderr, "z2: " fmt, ## __VA_ARGS__); \
+}\
+} while (0)

 static const struct keymap map[0x100] = {
 [0 ... 0xff] = { -1, -1 },
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 03/43] xen-common: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 0e3f1f202ebbf14259dee89e523c1fbc6f08d4ed Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 02:12:31 +0300
Subject: [PATCH 03/43] xen-common: made printf always compile in debug
output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 xen-common.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen-common.c b/xen-common.c
index fd2c928..9361974 100644
--- a/xen-common.c
+++ b/xen-common.c
@@ -15,15 +15,15 @@
 #include "sysemu/accel.h"
 #include "migration/migration.h"

-//#define DEBUG_XEN
-
-#ifdef DEBUG_XEN
-#define DPRINTF(fmt, ...) \
-do { fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); } while (0)
-#else
-#define DPRINTF(fmt, ...) \
-do { } while (0)
-#endif
+#ifndef DEBUG_XEN
+#define DEBUG_XEN 0
+#endif
+
+#define DPRINTF(fmt, ...) do {\
+if (DEBUG_XEN) {  \
+fprintf(stderr, "xen: " fmt, ## __VA_ARGS__); \
+} \
+} while (0);

 static int store_dev_info(int domid, Chardev *cs, const char *string)
 {
-- 
2.8.0.rc3


[Qemu-devel] [PATCH 01/43] acpi: made printf always compile in debug output

2017-04-01 Thread Danil Antonov
>From 8127ae68568b3c6876a5ee58a74e5ef0439f548a Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Wed, 29 Mar 2017 01:59:37 +0300
Subject: [PATCH 01/43] acpi: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 hw/acpi/pcihp.c | 15 +--
 hw/acpi/piix4.c | 16 +---
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 2b0f3e1..bf880c1 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -39,13 +39,16 @@
 #include "qom/qom-qobject.h"
 #include "qapi/qmp/qint.h"

-//#define DEBUG

-#ifdef DEBUG
-# define ACPI_PCIHP_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
-#else
-# define ACPI_PCIHP_DPRINTF(format, ...) do { } while (0)
-#endif
+#ifndef DEBUG
+#define DEBUG 0
+#endif
+
+#define ACPI_PCIHP_DPRINTF(fmt, ...) do { \
+if (DEBUG) {  \
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0);

 #define ACPI_PCIHP_ADDR 0xae00
 #define ACPI_PCIHP_SIZE 0x0014
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index a553a7e..34e85b4 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -42,13 +42,15 @@
 #include "hw/xen/xen.h"
 #include "qom/cpu.h"

-//#define DEBUG
-
-#ifdef DEBUG
-# define PIIX4_DPRINTF(format, ...) printf(format, ## __VA_ARGS__)
-#else
-# define PIIX4_DPRINTF(format, ...) do { } while (0)
-#endif
+#ifndef DEBUG
+#define DEBUG 0
+#endif
+
+#define PIIX4_DPRINTF(fmt, ...) do {\
+if (DEBUG) {  \
+fprintf(stderr, fmt, ## __VA_ARGS__); \
+} \
+} while (0);

 #define GPE_BASE 0xafe0
 #define GPE_LEN 4
--
2.8.0.rc3


[Qemu-devel] [PATCH] debug: made printf always compile in debug output

2017-03-27 Thread Danil Antonov
>From cddb60744808eedbadebdc4f0258ee6db694c4a3 Mon Sep 17 00:00:00 2001
From: Danil Antonov <g.danil.a...@gmail.com>
Date: Mon, 27 Mar 2017 14:43:10 +0300
Subject: [PATCH] debug: made printf always compile in debug output

Wrapped printf calls inside debug macros (DPRINTF) in `if` statement.
This will ensure that printf function will always compile even if debug
output is turned off and, in turn, will prevent bitrot of the format
strings. Also updated some debug messages to remove compiler errors and
warnings.

Signed-off-by: Danil Antonov <g.danil.a...@gmail.com>
---
 A patch for "Bitrot prevention" in BiteSizedTasks.
 hw/acpi/pcihp.c   | 15 ++
 hw/acpi/piix4.c   | 16 ++-
 hw/arm/strongarm.c| 17 +++
 hw/arm/z2.c   | 16 +++
 hw/audio/lm4549.c | 18 +++-
 hw/block/pflash_cfi01.c   | 18 ++--
 hw/block/pflash_cfi02.c   | 19 ++--
 hw/char/ipoctal232.c  | 24 +---
 hw/char/serial.c  | 16 ++-
 hw/core/empty_slot.c  | 15 ++
 hw/display/sm501.c| 15 ++
 hw/display/ssd0303.c  | 26 ++---
 hw/display/ssd0323.c  | 28 +-
 hw/dma/i82374.c   | 18 +++-
 hw/dma/puv3_dma.c |  8 +++---
 hw/gpio/pl061.c   | 28 ++
 hw/gpio/puv3_gpio.c   |  8 +++---
 hw/i2c/bitbang_i2c.c  | 16 +++
 hw/i2c/pm_smbus.c | 15 ++
 hw/i2c/smbus.c| 28 +++---
 hw/i386/acpi-build.c  | 17 +++
 hw/i386/intel_iommu.c | 18 ++--
 hw/i386/pc.c  | 16 +++
 hw/i386/xen/xen_platform.c| 17 ++-
 hw/input/adb.c| 17 ++-
 hw/input/pckbd.c  | 17 +++
 hw/input/vmmouse.c| 15 ++
 hw/intc/arm_gicv3_kvm.c   | 16 ++-
 hw/intc/exynos4210_combiner.c | 18 ++--
 hw/intc/heathrow_pic.c| 17 ++-
 hw/intc/i8259.c   | 16 ++-
 hw/intc/ioapic.c  | 16 ++-
 hw/intc/puv3_intc.c   |  4 +--
 hw/ipack/tpci200.c| 16 +++
 hw/isa/apm.c  | 14 +
 hw/isa/vt82c686.c | 18 ++--
 hw/mips/gt64xxx_pci.c | 15 ++
 hw/misc/macio/cuda.c  | 15 ++
 hw/misc/puv3_pm.c |  8 +++---
 hw/net/dp8393x.c  | 15 ++
 hw/net/lan9118.c  | 20 +
 hw/net/mcf_fec.c  | 18 +++-
 hw/net/stellaris_enet.c   | 28 +++---
 hw/nvram/mac_nvram.c  | 16 +++
 hw/pci-bridge/dec.c   | 18 ++--
 hw/pci-host/apb.c | 16 +++
 hw/pci-host/bonito.c  | 19 +++-
 hw/pci-host/grackle.c | 16 +++
 hw/pci-host/uninorth.c| 16 +++
 hw/pci/msi.c  | 17 +++
 hw/pci/pci.c  | 16 +++
 hw/pci/pci_host.c | 16 +++
 hw/pci/pcie.c | 18 
 hw/pci/pcie_aer.c | 18 
 hw/s390x/s390-pci-bus.c   | 18 +++-
 hw/s390x/s390-pci-inst.c  | 18 +++-
 hw/scsi/lsi53c895a.c  | 26 ++---
 hw/scsi/scsi-disk.c   | 17 ++-
 hw/scsi/scsi-generic.c| 17 +--
 hw/sd/pl181.c | 16 +++
 hw/sd/sd.c| 14 +
 hw/sd/ssi-sd.c| 27 ++---
 hw/sparc64/sparc64.c  | 36 ---
 hw/sparc64/sun4u.c| 16 ++-
 hw/ssi/pl022.c| 28 ++
 hw/timer/exynos4210_mct.c | 43 +--
 hw/timer/exynos4210_pwm.c | 18 ++--
 hw/timer/exynos4210_rtc.c | 12 
 hw/timer/hpet.c   | 24 +---
 hw/timer/mc146818rtc.c| 33 -
 hw/timer/pl031.c  | 17 +--
 hw/timer/puv3_ost.c   |  4 +--
 hw/timer/sun4v-rtc.c  | 18 ++--
 hw/usb/dev-serial.c   | 17 +--
 hw/usb/dev-storage.c  | 17 +--
 hw/usb/hcd-ehci.h | 10 +++
 hw/usb/hcd-xhci.c | 19 +++-
 hw/virtio/virtio-bus.c| 15 ++
 hw/virtio/virtio-mmio.c   | 17 ++-
 include/hw/unicore32/puv3.h   | 15 ++
 include/hw/vfio/vfio-common.h | 17 +--
 kvm-all.c | 16 +--
 migration/block.c | 16 ++-
 page_cache.c  | 17 ++-
 target/i386/kvm.c | 18 ++--
 target/ppc/kvm.c  | 18 ++--
 target/s390x/kvm.c| 18 ++--
 target/sparc/ldst_helper.c| 67
+--
 target/un

[Qemu-devel] [Bug 1660599] Re: v2.8.0 won't compile if g++ compiler doesn't understand "-fstack-protector-strong"

2017-03-26 Thread Danil
Could you provide the command you've used?
I tried `CC=gcc-4.8 ./configure --enable-stack-protector && make` in Ubuntu 
14.04 and qemu v2.8.0. It didn't set `-fstack-protector-strong` flag, only 
`-fstack-protector-all`.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1660599

Title:
  v2.8.0 won't compile if g++ compiler doesn't understand "-fstack-
  protector-strong"

Status in QEMU:
  New

Bug description:
  For example, Ubuntu Trusty (LTS 14.04) uses g++ v4.8.5.
  Compilation fails with a syntax error saying that the 
""-fstack-protector-strong" option in g++ is unrecognized.
  Instead, under Ubuntu Xenial (LTS 16.04), the g++ compiler is v5.4.0 and the 
compilation goes on smoothly.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1660599/+subscriptions