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

hw/gpio/zaurus.c: Use LOG_GUEST_ERROR for bad guest register accesses

Instead of logging guest accesses to invalid register offsets in this
device using zaurus_printf() (which just prints to stderr), use the
usual qemu_log_mask(LOG_GUEST_ERROR,...).

Since this was the only use of the zaurus_printf() macro outside
spitz.c, we can move the definition of that macro from sharpsl.h
to spitz.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200628142429.17111-14-peter.maydell@linaro.org

+10 -8
+3
hw/arm/spitz.c
··· 62 62 #define SPITZ_MACHINE_CLASS(klass) \ 63 63 OBJECT_CLASS_CHECK(SpitzMachineClass, klass, TYPE_SPITZ_MACHINE) 64 64 65 + #define zaurus_printf(format, ...) \ 66 + fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__) 67 + 65 68 #undef REG_FMT 66 69 #define REG_FMT "0x%02lx" 67 70
+7 -5
hw/gpio/zaurus.c
··· 22 22 #include "hw/sysbus.h" 23 23 #include "migration/vmstate.h" 24 24 #include "qemu/module.h" 25 - 26 - #undef REG_FMT 27 - #define REG_FMT "0x%02lx" 25 + #include "qemu/log.h" 28 26 29 27 /* SCOOP devices */ 30 28 ··· 104 102 case SCOOP_GPRR: 105 103 return s->gpio_level; 106 104 default: 107 - zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); 105 + qemu_log_mask(LOG_GUEST_ERROR, 106 + "scoop_read: bad register offset 0x%02" HWADDR_PRIx "\n", 107 + addr); 108 108 } 109 109 110 110 return 0; ··· 150 150 scoop_gpio_handler_update(s); 151 151 break; 152 152 default: 153 - zaurus_printf("Bad register offset " REG_FMT "\n", (unsigned long)addr); 153 + qemu_log_mask(LOG_GUEST_ERROR, 154 + "scoop_write: bad register offset 0x%02" HWADDR_PRIx "\n", 155 + addr); 154 156 } 155 157 } 156 158
-3
include/hw/arm/sharpsl.h
··· 9 9 10 10 #include "exec/hwaddr.h" 11 11 12 - #define zaurus_printf(format, ...) \ 13 - fprintf(stderr, "%s: " format, __func__, ##__VA_ARGS__) 14 - 15 12 /* zaurus.c */ 16 13 17 14 #define SL_PXA_PARAM_BASE 0xa0000a00