Skip to content

Commit f04cac4

Browse files
philmdalistair23
authored andcommitted
hw/char/riscv_htif: Convert HTIF_DEBUG() to trace events
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20250116223609.81594-1-philmd@linaro.org> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
1 parent 941f76e commit f04cac4

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

hw/char/riscv_htif.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,7 @@
3232
#include "exec/tswap.h"
3333
#include "system/dma.h"
3434
#include "system/runstate.h"
35-
36-
#define RISCV_DEBUG_HTIF 0
37-
#define HTIF_DEBUG(fmt, ...) \
38-
do { \
39-
if (RISCV_DEBUG_HTIF) { \
40-
qemu_log_mask(LOG_TRACE, "%s: " fmt "\n", __func__, ##__VA_ARGS__);\
41-
} \
42-
} while (0)
35+
#include "trace.h"
4336

4437
#define HTIF_DEV_SHIFT 56
4538
#define HTIF_CMD_SHIFT 48
@@ -159,8 +152,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
159152
uint64_t payload = val_written & 0xFFFFFFFFFFFFULL;
160153
int resp = 0;
161154

162-
HTIF_DEBUG("mtohost write: device: %d cmd: %d what: %02" PRIx64
163-
" -payload: %016" PRIx64 "\n", device, cmd, payload & 0xFF, payload);
155+
trace_htif_uart_write_to_host(device, cmd, payload);
164156

165157
/*
166158
* Currently, there is a fixed mapping of devices:
@@ -251,8 +243,7 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
251243
}
252244
} else {
253245
qemu_log("HTIF unknown device or command\n");
254-
HTIF_DEBUG("device: %d cmd: %d what: %02" PRIx64
255-
" payload: %016" PRIx64, device, cmd, payload & 0xFF, payload);
246+
trace_htif_uart_unknown_device_command(device, cmd, payload);
256247
}
257248
/*
258249
* Latest bbl does not set fromhost to 0 if there is a value in tohost.

hw/char/trace-events

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,7 @@ stm32f2xx_usart_read(char *id, unsigned size, uint64_t ofs, uint64_t val) " %s s
136136
stm32f2xx_usart_write(char *id, unsigned size, uint64_t ofs, uint64_t val) "%s size %d ofs 0x%02" PRIx64 " <- 0x%02" PRIx64
137137
stm32f2xx_usart_drop(char *id) " %s dropping the chars"
138138
stm32f2xx_usart_receive(char *id, uint8_t chr) " %s receiving '%c'"
139+
140+
# riscv_htif.c
141+
htif_uart_write_to_host(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64
142+
htif_uart_unknown_device_command(uint8_t device, uint8_t cmd, uint64_t payload) "device: %u cmd: %02u payload: %016" PRIx64

0 commit comments

Comments
 (0)