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

hw/display/exynos4210_fimd: Use qemu_log_mask(GUEST_ERROR)

Replace DPRINT_ERROR() by qemu_log_mask(GUEST_ERROR).

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

authored by

Philippe Mathieu-Daudé and committed by
Gerd Hoffmann
b3caeaf2 becce5e9

+29 -17
+29 -17
hw/display/exynos4210_fimd.c
··· 31 31 #include "ui/pixel_ops.h" 32 32 #include "qemu/bswap.h" 33 33 #include "qemu/module.h" 34 + #include "qemu/log.h" 34 35 35 36 /* Debug messages configuration */ 36 37 #define EXYNOS4210_FIMD_DEBUG 0 ··· 39 40 #if EXYNOS4210_FIMD_DEBUG == 0 40 41 #define DPRINT_L1(fmt, args...) do { } while (0) 41 42 #define DPRINT_L2(fmt, args...) do { } while (0) 42 - #define DPRINT_ERROR(fmt, args...) do { } while (0) 43 43 #elif EXYNOS4210_FIMD_DEBUG == 1 44 44 #define DPRINT_L1(fmt, args...) \ 45 45 do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0) 46 46 #define DPRINT_L2(fmt, args...) do { } while (0) 47 - #define DPRINT_ERROR(fmt, args...) \ 48 - do {fprintf(stderr, "QEMU FIMD ERROR: "fmt, ## args); } while (0) 49 47 #else 50 48 #define DPRINT_L1(fmt, args...) \ 51 49 do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0) 52 50 #define DPRINT_L2(fmt, args...) \ 53 51 do {fprintf(stderr, "QEMU FIMD: "fmt, ## args); } while (0) 54 - #define DPRINT_ERROR(fmt, args...) \ 55 - do {fprintf(stderr, "QEMU FIMD ERROR: "fmt, ## args); } while (0) 56 52 #endif 57 53 58 54 #if EXYNOS4210_FIMD_MODE_TRACE == 0 ··· 1108 1104 case FIMD_WINCON_BUF2_STAT: 1109 1105 return 2; 1110 1106 default: 1111 - DPRINT_ERROR("Non-existent buffer index\n"); 1107 + qemu_log_mask(LOG_GUEST_ERROR, "FIMD: Non-existent buffer index\n"); 1112 1108 return 0; 1113 1109 } 1114 1110 } ··· 1160 1156 1161 1157 if (int128_get64(w->mem_section.size) != w->fb_len || 1162 1158 !memory_region_is_ram(w->mem_section.mr)) { 1163 - DPRINT_ERROR("Failed to find window %u framebuffer region\n", win); 1159 + qemu_log_mask(LOG_GUEST_ERROR, 1160 + "FIMD: Failed to find window %u framebuffer region\n", 1161 + win); 1164 1162 goto error_return; 1165 1163 } 1166 1164 1167 1165 w->host_fb_addr = cpu_physical_memory_map(fb_start_addr, &fb_mapped_len, 1168 1166 false); 1169 1167 if (!w->host_fb_addr) { 1170 - DPRINT_ERROR("Failed to map window %u framebuffer\n", win); 1168 + qemu_log_mask(LOG_GUEST_ERROR, 1169 + "FIMD: Failed to map window %u framebuffer\n", win); 1171 1170 goto error_return; 1172 1171 } 1173 1172 1174 1173 if (fb_mapped_len != w->fb_len) { 1175 - DPRINT_ERROR("Window %u mapped framebuffer length is less then " 1176 - "expected\n", win); 1174 + qemu_log_mask(LOG_GUEST_ERROR, 1175 + "FIMD: Window %u mapped framebuffer length is less than " 1176 + "expected\n", win); 1177 1177 cpu_physical_memory_unmap(w->host_fb_addr, fb_mapped_len, 0, 0); 1178 1178 goto error_return; 1179 1179 } ··· 1490 1490 break; 1491 1491 case 3: 1492 1492 if (w != 1 && w != 2) { 1493 - DPRINT_ERROR("Bad write offset 0x%08x\n", offset); 1493 + qemu_log_mask(LOG_GUEST_ERROR, 1494 + "FIMD: Bad write offset 0x%08"HWADDR_PRIx"\n", 1495 + offset); 1494 1496 return; 1495 1497 } 1496 1498 s->window[w].osdsize = val; ··· 1624 1626 break; 1625 1627 case FIMD_VIDW0ADD0_B2 ... FIMD_VIDW4ADD0_B2: 1626 1628 if (offset & 0x0004) { 1627 - DPRINT_ERROR("bad write offset 0x%08x\n", offset); 1629 + qemu_log_mask(LOG_GUEST_ERROR, 1630 + "FIMD: bad write offset 0x%08"HWADDR_PRIx"\n", 1631 + offset); 1628 1632 break; 1629 1633 } 1630 1634 w = (offset - FIMD_VIDW0ADD0_B2) >> 3; ··· 1638 1642 break; 1639 1643 case FIMD_SHD_ADD0_START ... FIMD_SHD_ADD0_END: 1640 1644 if (offset & 0x0004) { 1641 - DPRINT_ERROR("bad write offset 0x%08x\n", offset); 1645 + qemu_log_mask(LOG_GUEST_ERROR, 1646 + "FIMD: bad write offset 0x%08"HWADDR_PRIx"\n", 1647 + offset); 1642 1648 break; 1643 1649 } 1644 1650 s->window[(offset - FIMD_SHD_ADD0_START) >> 3].shadow_buf_start = val; 1645 1651 break; 1646 1652 case FIMD_SHD_ADD1_START ... FIMD_SHD_ADD1_END: 1647 1653 if (offset & 0x0004) { 1648 - DPRINT_ERROR("bad write offset 0x%08x\n", offset); 1654 + qemu_log_mask(LOG_GUEST_ERROR, 1655 + "FIMD: bad write offset 0x%08"HWADDR_PRIx"\n", 1656 + offset); 1649 1657 break; 1650 1658 } 1651 1659 s->window[(offset - FIMD_SHD_ADD1_START) >> 3].shadow_buf_end = val; ··· 1665 1673 s->window[w].palette[i] = val; 1666 1674 break; 1667 1675 default: 1668 - DPRINT_ERROR("bad write offset 0x%08x\n", offset); 1676 + qemu_log_mask(LOG_GUEST_ERROR, 1677 + "FIMD: bad write offset 0x%08"HWADDR_PRIx"\n", offset); 1669 1678 break; 1670 1679 } 1671 1680 } ··· 1715 1724 break; 1716 1725 case 3: 1717 1726 if (w != 1 && w != 2) { 1718 - DPRINT_ERROR("bad read offset 0x%08x\n", offset); 1727 + qemu_log_mask(LOG_GUEST_ERROR, 1728 + "FIMD: bad read offset 0x%08"HWADDR_PRIx"\n", 1729 + offset); 1719 1730 return 0xBAADBAAD; 1720 1731 } 1721 1732 ret = s->window[w].osdsize; ··· 1809 1820 return s->window[w].palette[i]; 1810 1821 } 1811 1822 1812 - DPRINT_ERROR("bad read offset 0x%08x\n", offset); 1823 + qemu_log_mask(LOG_GUEST_ERROR, 1824 + "FIMD: bad read offset 0x%08"HWADDR_PRIx"\n", offset); 1813 1825 return 0xBAADBAAD; 1814 1826 } 1815 1827