qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

hw/display/cg3: Convert debug printf()s to trace events

Convert DPRINTF() to trace events and remove ifdef'ry.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200526062252.19852-3-f4bug@amsat.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

authored by

Philippe Mathieu-Daudé and committed by
Gerd Hoffmann
85664cf0 edcbea00

+8 -10
+4 -10
hw/display/cg3.c
··· 35 35 #include "hw/qdev-properties.h" 36 36 #include "qemu/log.h" 37 37 #include "qemu/module.h" 38 + #include "trace.h" 38 39 39 40 /* Change to 1 to enable debugging */ 40 41 #define DEBUG_CG3 0 ··· 62 63 63 64 #define CG3_VRAM_SIZE 0x100000 64 65 #define CG3_VRAM_OFFSET 0x800000 65 - 66 - #define DPRINTF(fmt, ...) do { \ 67 - if (DEBUG_CG3) { \ 68 - printf("CG3: " fmt , ## __VA_ARGS__); \ 69 - } \ 70 - } while (0) 71 66 72 67 #define TYPE_CG3 "cgthree" 73 68 #define CG3(obj) OBJECT_CHECK(CG3State, (obj), TYPE_CG3) ··· 195 190 val = 0; 196 191 break; 197 192 } 198 - DPRINTF("read %02x from reg %" HWADDR_PRIx "\n", val, addr); 193 + trace_cg3_read(addr, val, size); 194 + 199 195 return val; 200 196 } 201 197 ··· 206 202 uint8_t regval; 207 203 int i; 208 204 209 - DPRINTF("write %" PRIx64 " to reg %" HWADDR_PRIx " size %d\n", 210 - val, addr, size); 211 - 205 + trace_cg3_write(addr, val, size); 212 206 switch (addr) { 213 207 case CG3_REG_BT458_ADDR: 214 208 s->dac_index = val;
+4
hw/display/trace-events
··· 151 151 artist_fill_window(unsigned int start_x, unsigned int start_y, unsigned int width, unsigned int height, uint32_t op, uint32_t ctlpln) "start=%ux%u length=%ux%u op=0x%08x ctlpln=0x%08x" 152 152 artist_block_move(unsigned int start_x, unsigned int start_y, unsigned int dest_x, unsigned int dest_y, unsigned int width, unsigned int height) "source %ux%u -> dest %ux%u size %ux%u" 153 153 artist_draw_line(unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y) "%ux%u %ux%u" 154 + 155 + # cg3.c 156 + cg3_read(uint32_t addr, uint32_t val, unsigned size) "read addr:0x%06"PRIx32" val:0x%08"PRIx32" size:%u" 157 + cg3_write(uint32_t addr, uint32_t val, unsigned size) "write addr:0x%06"PRIx32" val:0x%08"PRIx32" size:%u"