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

aspeed/smc: Add some tracing

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200206112645.21275-2-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

authored by

Cédric Le Goater and committed by
Peter Maydell
bd6ce9a6 563152e0

+27
+1
Makefile.objs
··· 175 175 trace-events-subdirs += hw/sd 176 176 trace-events-subdirs += hw/sparc 177 177 trace-events-subdirs += hw/sparc64 178 + trace-events-subdirs += hw/ssi 178 179 trace-events-subdirs += hw/timer 179 180 trace-events-subdirs += hw/tpm 180 181 trace-events-subdirs += hw/usb
+17
hw/ssi/aspeed_smc.c
··· 31 31 #include "qapi/error.h" 32 32 #include "exec/address-spaces.h" 33 33 #include "qemu/units.h" 34 + #include "trace.h" 34 35 35 36 #include "hw/irq.h" 36 37 #include "hw/qdev-properties.h" ··· 513 514 514 515 s->ctrl->reg_to_segment(s, new, &seg); 515 516 517 + trace_aspeed_smc_flash_set_segment(cs, new, seg.addr, seg.addr + seg.size); 518 + 516 519 /* The start address of CS0 is read-only */ 517 520 if (cs == 0 && seg.addr != s->ctrl->flash_window_base) { 518 521 qemu_log_mask(LOG_GUEST_ERROR, ··· 753 756 __func__, aspeed_smc_flash_mode(fl)); 754 757 } 755 758 759 + trace_aspeed_smc_flash_read(fl->id, addr, size, ret, 760 + aspeed_smc_flash_mode(fl)); 756 761 return ret; 757 762 } 758 763 ··· 808 813 AspeedSMCState *s = fl->controller; 809 814 uint8_t addr_width = aspeed_smc_flash_is_4byte(fl) ? 4 : 3; 810 815 816 + trace_aspeed_smc_do_snoop(fl->id, s->snoop_index, s->snoop_dummies, 817 + (uint8_t) data & 0xff); 818 + 811 819 if (s->snoop_index == SNOOP_OFF) { 812 820 return false; /* Do nothing */ 813 821 ··· 858 866 AspeedSMCState *s = fl->controller; 859 867 int i; 860 868 869 + trace_aspeed_smc_flash_write(fl->id, addr, size, data, 870 + aspeed_smc_flash_mode(fl)); 871 + 861 872 if (!aspeed_smc_is_writable(fl)) { 862 873 qemu_log_mask(LOG_GUEST_ERROR, "%s: flash is not writable at 0x%" 863 874 HWADDR_PRIx "\n", __func__, addr); ··· 972 983 (s->ctrl->has_dma && addr == R_DMA_CHECKSUM) || 973 984 (addr >= R_SEG_ADDR0 && addr < R_SEG_ADDR0 + s->ctrl->max_slaves) || 974 985 (addr >= s->r_ctrl0 && addr < s->r_ctrl0 + s->ctrl->max_slaves)) { 986 + 987 + trace_aspeed_smc_read(addr, size, s->regs[addr]); 988 + 975 989 return s->regs[addr]; 976 990 } else { 977 991 qemu_log_mask(LOG_UNIMP, "%s: not implemented: 0x%" HWADDR_PRIx "\n", ··· 1091 1105 __func__, s->regs[R_DMA_FLASH_ADDR]); 1092 1106 return; 1093 1107 } 1108 + trace_aspeed_smc_dma_checksum(s->regs[R_DMA_FLASH_ADDR], data); 1094 1109 1095 1110 /* 1096 1111 * When the DMA is on-going, the DMA registers are updated ··· 1224 1239 uint32_t value = data; 1225 1240 1226 1241 addr >>= 2; 1242 + 1243 + trace_aspeed_smc_write(addr, size, data); 1227 1244 1228 1245 if (addr == s->r_conf || 1229 1246 (addr >= s->r_timings &&
+9
hw/ssi/trace-events
··· 1 + # aspeed_smc.c 2 + 3 + aspeed_smc_flash_set_segment(int cs, uint64_t reg, uint64_t start, uint64_t end) "CS%d segreg=0x%"PRIx64" [ 0x%"PRIx64" - 0x%"PRIx64" ]" 4 + aspeed_smc_flash_read(int cs, uint64_t addr, uint32_t size, uint64_t data, int mode) "CS%d @0x%" PRIx64 " size %u: 0x%" PRIx64" mode:%d" 5 + aspeed_smc_do_snoop(int cs, int index, int dummies, int data) "CS%d index:0x%x dummies:%d data:0x%x" 6 + aspeed_smc_flash_write(int cs, uint64_t addr, uint32_t size, uint64_t data, int mode) "CS%d @0x%" PRIx64 " size %u: 0x%" PRIx64" mode:%d" 7 + aspeed_smc_read(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size %u: 0x%" PRIx64 8 + aspeed_smc_dma_checksum(uint32_t addr, uint32_t data) "0x%08x: 0x%08x" 9 + aspeed_smc_write(uint64_t addr, uint32_t size, uint64_t data) "@0x%" PRIx64 " size %u: 0x%" PRIx64