Skip to contentSkip to conversation

qemu-log: remove -d ioport

PATCH In review Paolo Bonzini 3 participants 7 messages Oct 16, 2015 – Oct 23, 2015

lore
Share & tools
lore
#0 lore raw

cover qemu-log: remove -d ioport

All of its uses are disabled at compile-time by default, so convert to tracepoints or expands the existing ones.

Paolo Bonzini (3):
prep: do not use CPU_LOG_IOPORT, convert to tracepoints
ioport: do not use CPU_LOG_IOPORT, expand tracepoints
qemu-log: remove -d ioport

 hw/ppc/prep.c      | 30 +++---------------------------
 include/qemu/log.h |  1 -
 ioport.c           | 26 ++++++--------------------
 qemu-log.c         |  2 --
 trace-events       |  8 ++++++--
 5 files changed, 15 insertions(+), 52 deletions(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/3 prep: do not use CPU_LOG_IOPORT, convert to tracepoints

These messages are disabled by default; a perfect usecase for tracepoints. Convert them over.

---
 hw/ppc/prep.c | 30 +++---------------------------
 trace-events  |  4 ++++
 2 files changed, 7 insertions(+), 27 deletions(-)
hw/ppc/prep.c +3 -27
index d95222b..5ad28f7 100644
@@ -42,11 +42,9 @@
 #include "sysemu/arch_init.h"
 #include "sysemu/qtest.h"
 #include "exec/address-spaces.h"
+#include "trace.h"
 #include "elf.h"
 
-//#define HARD_DEBUG_PPC_IO
-//#define DEBUG_PPC_IO
-
 /* SMP is not enabled, for now */
 #define MAX_CPUS 1
 
@@ -57,26 +55,6 @@
 #define KERNEL_LOAD_ADDR 0x01000000
 #define INITRD_LOAD_ADDR 0x01800000
 
-#if defined (HARD_DEBUG_PPC_IO) && !defined (DEBUG_PPC_IO)
-#define DEBUG_PPC_IO
-#endif
-
-#if defined (HARD_DEBUG_PPC_IO)
-#define PPC_IO_DPRINTF(fmt, ...)                         \
-do {                                                     \
-    if (qemu_loglevel_mask(CPU_LOG_IOPORT)) {            \
-        qemu_log("%s: " fmt, __func__ , ## __VA_ARGS__); \
-    } else {                                             \
-        printf("%s : " fmt, __func__ , ## __VA_ARGS__);  \
-    }                                                    \
-} while (0)
-#elif defined (DEBUG_PPC_IO)
-#define PPC_IO_DPRINTF(fmt, ...) \
-qemu_log_mask(CPU_LOG_IOPORT, fmt, ## __VA_ARGS__)
-#else
-#define PPC_IO_DPRINTF(fmt, ...) do { } while (0)
-#endif
-
 /* Constants for devices init */
 static const int ide_iobase[2] = { 0x1f0, 0x170 };
 static const int ide_iobase2[2] = { 0x3f6, 0x376 };
@@ -199,8 +177,7 @@ static void PREP_io_800_writeb (void *opaque, uint32_t addr, uint32_t val)
 {
     sysctrl_t *sysctrl = opaque;
 
-    PPC_IO_DPRINTF("0x%08" PRIx32 " => 0x%02" PRIx32 "\n",
-                   addr - PPC_IO_BASE, val);
+    trace_prep_io_800_writeb(addr - PPC_IO_BASE, val);
     switch (addr) {
     case 0x0092:
         /* Special port 92 */
@@ -327,8 +304,7 @@ static uint32_t PREP_io_800_readb (void *opaque, uint32_t addr)
         printf("ERROR: unaffected IO port: %04" PRIx32 " read\n", addr);
         break;
     }
-    PPC_IO_DPRINTF("0x%08" PRIx32 " <= 0x%02" PRIx32 "\n",
-                   addr - PPC_IO_BASE, retval);
+    trace_prep_io_800_readb(addr - PPC_IO_BASE, retval);
 
     return retval;
 }
trace-events +4 -0
index a0ddc6b..2d3f1d7 100644
@@ -1383,6 +1383,10 @@ spapr_iommu_new_table(uint64_t liobn, void *tcet, void *table, int fd) "liobn=%"
 # hw/ppc/ppc.c
 ppc_tb_adjust(uint64_t offs1, uint64_t offs2, int64_t diff, int64_t seconds) "adjusted from 0x%"PRIx64" to 0x%"PRIx64", diff %"PRId64" (%"PRId64"s)"
 
+# hw/ppc/prep.c
+prep_io_800_writeb(uint32_t addr, uint32_t val) "0x%08" PRIx32 " => 0x%02" PRIx32
+prep_io_800_readb(uint32_t addr, uint32_t retval) "0x%08" PRIx32 " <= 0x%02" PRIx32
+
 # util/hbitmap.c
 hbitmap_iter_skip_words(const void *hb, void *hbi, uint64_t pos, unsigned long cur) "hb %p hbi %p pos %"PRId64" cur 0x%lx"
 hbitmap_reset(void *hb, uint64_t start, uint64_t count, uint64_t sbit, uint64_t ebit) "hb %p items %"PRIu64",%"PRIu64" bits %"PRIu64"..%"PRIu64
Signature · 1 line
2.5.0
#2 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/3] prep: do not use CPU_LOG_IOPORT, convert to tracepoints

Quoted 4 lines · Paolo Bonzini

These messages are disabled by default; a perfect usecase for tracepoints. Convert them over.

Looks good to me. Applied to ppc-next.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#3 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/3] prep: do not use CPU_LOG_IOPORT, convert to tracepoints

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Quoted 7 lines · David Gibson
Quoted 4 lines · Paolo Bonzini

These messages are disabled by default; a perfect usecase for tracepoints. Convert them over.

Looks good to me. Applied to ppc-next.

Feel free to apply the whole series then. Thanks!

Paolo
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWKeITAAoJEL/70l94x66DndYH/2FC/HazCk2RGFCvsUn9kHTY dvCNGXSD8XeJ3Z4WM+8PNMiQl5MPX87VFAY8vDwFWgHecjMSMNJTCLmJr+KeKssS +wBiZYrY/pfCwyQ3BjDKx/mw4jTbCOE7XnDQ3yKtLkU2WQMqbL89BO1fIgL1QfU3 uI1599TypHPN8VozcDYiInT4P6OoM272XmIcNe8zOMZgT2vqD0sUwAsi5DKNYZ5B CgFh5VbiItjGLpKoq4WBJaVqD5jD3ZvbGS+ORmYxo5zXLyGxPuCFQj4vOYiKn/28 eUUPy0qCVmymwtLFoh1CBJ95RNg02aPD5hrld2oj3CiJoIKuVoHk4t4u7p0plBg= =llio
-----END PGP SIGNATURE-----

#4 lore raw

Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/3] prep: do not use CPU_LOG_IOPORT, convert to tracepoints

In reply to David Gibson

Am 23.10.2015 um 03:38 schrieb David Gibson:

Quoted 7 lines · Paolo Bonzini
Quoted 4 lines

These messages are disabled by default; a perfect usecase for tracepoints. Convert them over.

Looks good to me. Applied to ppc-next.

Would've been nice to ask first, but

I do have some PReP refactorings for a 2.4 issue from Markus that I would like to get into 2.5, so please submit your ppc queue early.

Thanks,
Andreas

#5 lore raw

PATCH 2/3 ioport: do not use CPU_LOG_IOPORT, expand tracepoints

In reply to Paolo Bonzini

These messages are disabled by default; a perfect usecase for tracepoints, which in fact already exist. Add the missing information to them and stop using qemu_log_mask.

---
 ioport.c     | 26 ++++++--------------------
 trace-events |  4 ++--
 2 files changed, 8 insertions(+), 22 deletions(-)
ioport.c +6 -20
index e39093e..193ef76 100644
@@ -30,14 +30,6 @@
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 
-//#define DEBUG_IOPORT
-
-#ifdef DEBUG_IOPORT
-#  define LOG_IOPORT(...) qemu_log_mask(CPU_LOG_IOPORT, ## __VA_ARGS__)
-#else
-#  define LOG_IOPORT(...) do { } while (0)
-#endif
-
 typedef struct MemoryRegionPortioList {
     MemoryRegion mr;
     void *portio_opaque;
@@ -62,8 +54,7 @@ const MemoryRegionOps unassigned_io_ops = {
 
 void cpu_outb(pio_addr_t addr, uint8_t val)
 {
-    LOG_IOPORT("outb: %04"FMT_pioaddr" %02"PRIx8"\n", addr, val);
-    trace_cpu_out(addr, val);
+    trace_cpu_out(addr, 'b', val);
     address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                         &val, 1);
 }
@@ -72,8 +63,7 @@ void cpu_outw(pio_addr_t addr, uint16_t val)
 {
     uint8_t buf[2];
 
-    LOG_IOPORT("outw: %04"FMT_pioaddr" %04"PRIx16"\n", addr, val);
-    trace_cpu_out(addr, val);
+    trace_cpu_out(addr, 'w', val);
     stw_p(buf, val);
     address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                         buf, 2);
@@ -83,8 +73,7 @@ void cpu_outl(pio_addr_t addr, uint32_t val)
 {
     uint8_t buf[4];
 
-    LOG_IOPORT("outl: %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);
-    trace_cpu_out(addr, val);
+    trace_cpu_out(addr, 'l', val);
     stl_p(buf, val);
     address_space_write(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                         buf, 4);
@@ -96,8 +85,7 @@ uint8_t cpu_inb(pio_addr_t addr)
 
     address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED,
                        &val, 1);
-    trace_cpu_in(addr, val);
-    LOG_IOPORT("inb : %04"FMT_pioaddr" %02"PRIx8"\n", addr, val);
+    trace_cpu_in(addr, 'b', val);
     return val;
 }
 
@@ -108,8 +96,7 @@ uint16_t cpu_inw(pio_addr_t addr)
 
     address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 2);
     val = lduw_p(buf);
-    trace_cpu_in(addr, val);
-    LOG_IOPORT("inw : %04"FMT_pioaddr" %04"PRIx16"\n", addr, val);
+    trace_cpu_in(addr, 'w', val);
     return val;
 }
 
@@ -120,8 +107,7 @@ uint32_t cpu_inl(pio_addr_t addr)
 
     address_space_read(&address_space_io, addr, MEMTXATTRS_UNSPECIFIED, buf, 4);
     val = ldl_p(buf);
-    trace_cpu_in(addr, val);
-    LOG_IOPORT("inl : %04"FMT_pioaddr" %08"PRIx32"\n", addr, val);
+    trace_cpu_in(addr, 'l', val);
     return val;
 }
 
trace-events +2 -2
index 2d3f1d7..5d857ea 100644
@@ -139,8 +139,8 @@ paio_submit_co(int64_t sector_num, int nb_sectors, int type) "sector_num %"PRId6
 paio_submit(void *acb, void *opaque, int64_t sector_num, int nb_sectors, int type) "acb %p opaque %p sector_num %"PRId64" nb_sectors %d type %d"
 
 # ioport.c
-cpu_in(unsigned int addr, unsigned int val) "addr %#x value %u"
-cpu_out(unsigned int addr, unsigned int val) "addr %#x value %u"
+cpu_in(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
+cpu_out(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
 
 # balloon.c
 # Since requests are raised via monitor, not many tracepoints are needed.
Signature · 1 line
2.5.0
#6 lore raw

PATCH 3/3 qemu-log: remove -d ioport

In reply to Paolo Bonzini

It was disabled at compile-time, and has now been replaced by tracepoints.

---
 include/qemu/log.h | 1 -
 qemu-log.c         | 2 --
 2 files changed, 3 deletions(-)
include/qemu/log.h +0 -1
index f880e66..d565f16 100644
@@ -35,7 +35,6 @@ static inline bool qemu_log_enabled(void)
 #define CPU_LOG_INT        (1 << 4)
 #define CPU_LOG_EXEC       (1 << 5)
 #define CPU_LOG_PCALL      (1 << 6)
-#define CPU_LOG_IOPORT     (1 << 7)
 #define CPU_LOG_TB_CPU     (1 << 8)
 #define CPU_LOG_RESET      (1 << 9)
 #define LOG_UNIMP          (1 << 10)
qemu-log.c +0 -2
index 13f3813..cf74fb5 100644
@@ -112,8 +112,6 @@ const QEMULogItem qemu_log_items[] = {
       "x86 only: show protected mode far calls/returns/exceptions" },
     { CPU_LOG_RESET, "cpu_reset",
       "show CPU state before CPU resets" },
-    { CPU_LOG_IOPORT, "ioport",
-      "show all i/o ports accesses" },
     { LOG_UNIMP, "unimp",
       "log unimplemented functionality" },
     { LOG_GUEST_ERROR, "guest_errors",
Signature · 1 line
2.5.0