hw/char/riscv_htif: Convert HTIF_DEBUG() to trace events
PATCH 1/1 hw/char/riscv_htif: Convert HTIF_DEBUG() to trace events
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
--- hw/char/riscv_htif.c | 15 +++------------ hw/char/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 12 deletions(-)
hw/char/riscv_htif.c +3 -12
@@ -32,14 +32,7 @@#include "exec/tswap.h" #include "system/dma.h" #include "system/runstate.h" - -#define RISCV_DEBUG_HTIF 0 -#define HTIF_DEBUG (fmt, ...) \ - do { \ - if (RISCV_DEBUG_HTIF) { \ - qemu_log_mask(LOG_TRACE, "%s: " fmt "\n", __func__, ##__VA_ARGS__);\ - } \ - } while (0) +#include "trace.h" #define HTIF_DEV_SHIFT 56#define HTIF_CMD_SHIFT 48
@@ -159,8 +152,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)uint64_t payload = val_written &0xFFFFFFFFFFFFULL ;int resp =0 ; -HTIF_DEBUG ("mtohost write: device: %d cmd: %d what: %02" PRIx64 -" -payload: %016" PRIx64"\n" , device, cmd, payload &0xFF , payload); +trace_htif_uart_write_to_host (device, cmd, payload);/* * Currently, there is a fixed mapping of devices:
@@ -251,8 +243,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written) } }else {qemu_log ("HTIF unknown device or command\n" ); -HTIF_DEBUG ("device: %d cmd: %d what: %02" PRIx64 -" payload: %016" PRIx64, device, cmd, payload &0xFF , payload); +trace_htif_uart_unknown_device_command (device, cmd, payload); }/* * Latest bbl does not set fromhost to 0 if there is a value in tohost.
hw/char/trace-events +4 -0
@@ -136,3 +136,7 @@ stm32f2xx_usart_read(char *id, unsigned size, uint64_t ofs, uint64_t val) " %s s stm32f2xx_usart_write(char *id, unsigned size, uint64_t ofs, uint64_t val) "%s size %d ofs 0x%02" PRIx64 " <- 0x%02" PRIx64 stm32f2xx_usart_drop(char *id) " %s dropping the chars" stm32f2xx_usart_receive(char *id, uint8_t chr) " %s receiving '%c'" + +# riscv_htif.c +htif_uart_write_to_host(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64 +htif_uart_unknown_device_command(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64
Signature · 1 line
2.47.1
Quoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Reviewed-by Alistair Francis <[email protected]>
Alistair
Quoted 61 lines
--- hw/char/riscv_htif.c | 15 +++------------ hw/char/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 12 deletions(-)hw/char/riscv_htif.c +3
-12@@ -32,14 +32,7 @@#include "exec/tswap.h" #include "system/dma.h" #include "system/runstate.h" - -#define RISCV_DEBUG_HTIF 0 -#define HTIF_DEBUG (fmt, ...) \ - do { \ - if (RISCV_DEBUG_HTIF) { \ - qemu_log_mask(LOG_TRACE, "%s: " fmt "\n", __func__, ##__VA_ARGS__);\ - } \ - } while (0) +#include "trace.h" #define HTIF_DEV_SHIFT 56#define HTIF_CMD_SHIFT 48@@ -159,8 +152,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)uint64_t payload = val_written &0xFFFFFFFFFFFFULL ;int resp =0 ; -HTIF_DEBUG ("mtohost write: device: %d cmd: %d what: %02" PRIx64 -" -payload: %016" PRIx64"\n" , device, cmd, payload &0xFF , payload); +trace_htif_uart_write_to_host (device, cmd, payload);/* * Currently, there is a fixed mapping of devices: @@ -251,8 +243,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written) } }else {qemu_log ("HTIF unknown device or command\n" ); -HTIF_DEBUG ("device: %d cmd: %d what: %02" PRIx64 -" payload: %016" PRIx64, device, cmd, payload &0xFF , payload); +trace_htif_uart_unknown_device_command (device, cmd, payload); }/* * Latest bbl does not set fromhost to 0 if there is a value in tohost. hw/char/trace-events +4
-1@@ -136,3 +136,7 @@ stm32f2xx_usart_read(char *id, unsigned size, uint64_t ofs, uint64_t val) " %s s stm32f2xx_usart_write(char *id, unsigned size, uint64_t ofs, uint64_t val) "%s size %d ofs 0x%02" PRIx64 " <- 0x%02" PRIx64 stm32f2xx_usart_drop(char *id) " %s dropping the chars" stm32f2xx_usart_receive(char *id, uint8_t chr) " %s receiving '%c'" + +# riscv_htif.c +htif_uart_write_to_host(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64 +htif_uart_unknown_device_command(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64 --2.47.1
Alistair Francis
AppliedQuoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Thanks!
Applied to riscv-to-apply.next
Alistair
Quoted 61 lines
--- hw/char/riscv_htif.c | 15 +++------------ hw/char/trace-events | 4 ++++ 2 files changed, 7 insertions(+), 12 deletions(-)hw/char/riscv_htif.c +3
-12@@ -32,14 +32,7 @@#include "exec/tswap.h" #include "system/dma.h" #include "system/runstate.h" - -#define RISCV_DEBUG_HTIF 0 -#define HTIF_DEBUG (fmt, ...) \ - do { \ - if (RISCV_DEBUG_HTIF) { \ - qemu_log_mask(LOG_TRACE, "%s: " fmt "\n", __func__, ##__VA_ARGS__);\ - } \ - } while (0) +#include "trace.h" #define HTIF_DEV_SHIFT 56#define HTIF_CMD_SHIFT 48@@ -159,8 +152,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)uint64_t payload = val_written &0xFFFFFFFFFFFFULL ;int resp =0 ; -HTIF_DEBUG ("mtohost write: device: %d cmd: %d what: %02" PRIx64 -" -payload: %016" PRIx64"\n" , device, cmd, payload &0xFF , payload); +trace_htif_uart_write_to_host (device, cmd, payload);/* * Currently, there is a fixed mapping of devices: @@ -251,8 +243,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written) } }else {qemu_log ("HTIF unknown device or command\n" ); -HTIF_DEBUG ("device: %d cmd: %d what: %02" PRIx64 -" payload: %016" PRIx64, device, cmd, payload &0xFF , payload); +trace_htif_uart_unknown_device_command (device, cmd, payload); }/* * Latest bbl does not set fromhost to 0 if there is a value in tohost. hw/char/trace-events +4
-1@@ -136,3 +136,7 @@ stm32f2xx_usart_read(char *id, unsigned size, uint64_t ofs, uint64_t val) " %s s stm32f2xx_usart_write(char *id, unsigned size, uint64_t ofs, uint64_t val) "%s size %d ofs 0x%02" PRIx64 " <- 0x%02" PRIx64 stm32f2xx_usart_drop(char *id) " %s dropping the chars" stm32f2xx_usart_receive(char *id, uint8_t chr) " %s receiving '%c'" + +# riscv_htif.c +htif_uart_write_to_host(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64 +htif_uart_unknown_device_command(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64 --2.47.1