[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/19] hw/i2c/aspeed: rework raise interrupt trace event
From: |
Cédric Le Goater |
Subject: |
[PULL 15/19] hw/i2c/aspeed: rework raise interrupt trace event |
Date: |
Wed, 22 Jun 2022 11:55:16 +0200 |
From: Klaus Jensen <k.jensen@samsung.com>
Build a single string instead of having several parameters on the trace
event.
Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
[ clg: simplified trace buffer creation ]
Message-Id: <20220601210831.67259-2-its@irrelevant.dk>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/i2c/aspeed_i2c.c | 34 ++++++++++++++++++++++------------
hw/i2c/trace-events | 2 +-
2 files changed, 23 insertions(+), 13 deletions(-)
diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index 4c798b70e4c3..43ac9491ec36 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
#include "migration/vmstate.h"
+#include "qemu/cutils.h"
#include "qemu/log.h"
#include "qemu/module.h"
#include "qemu/error-report.h"
@@ -38,23 +39,32 @@ static inline void
aspeed_i2c_bus_raise_interrupt(AspeedI2CBus *bus)
uint32_t intr_ctrl_reg = aspeed_i2c_bus_intr_ctrl_offset(bus);
bool raise_irq;
- trace_aspeed_i2c_bus_raise_interrupt(bus->regs[reg_intr_sts],
- aspeed_i2c_bus_pkt_mode_en(bus) &&
- ARRAY_FIELD_EX32(bus->regs, I2CM_INTR_STS, PKT_CMD_DONE) ?
- "pktdone|" : "",
- SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, TX_NAK) ? "nak|" : "",
- SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, TX_ACK) ? "ack|" : "",
- SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, RX_DONE) ? "done|"
- : "",
- SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, NORMAL_STOP) ?
- "normal|" : "",
- SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, ABNORMAL) ? "abnormal"
- : "");
+ if (trace_event_get_state_backends(TRACE_ASPEED_I2C_BUS_RAISE_INTERRUPT)) {
+ g_autofree char *buf = g_strdup_printf("%s%s%s%s%s%s",
+ aspeed_i2c_bus_pkt_mode_en(bus) &&
+ ARRAY_FIELD_EX32(bus->regs, I2CM_INTR_STS, PKT_CMD_DONE) ?
+ "pktdone|" : "",
+ SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, TX_NAK) ?
+ "nak|" : "",
+ SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, TX_ACK) ?
+ "ack|" : "",
+ SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, RX_DONE) ?
+ "done|" : "",
+ SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, NORMAL_STOP) ?
+ "normal|" : "",
+ SHARED_ARRAY_FIELD_EX32(bus->regs, reg_intr_sts, ABNORMAL) ?
+ "abnormal" : "");
+
+ trace_aspeed_i2c_bus_raise_interrupt(bus->regs[reg_intr_sts], buf);
+ }
+
raise_irq = bus->regs[reg_intr_sts] & bus->regs[intr_ctrl_reg];
+
/* In packet mode we don't mask off INTR_STS */
if (!aspeed_i2c_bus_pkt_mode_en(bus)) {
bus->regs[reg_intr_sts] &= bus->regs[intr_ctrl_reg];
}
+
if (raise_irq) {
bus->controller->intr_status |= 1 << bus->id;
qemu_irq_raise(aic->bus_get_irq(bus));
diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
index 85e4bddff936..209275ed2dc8 100644
--- a/hw/i2c/trace-events
+++ b/hw/i2c/trace-events
@@ -9,7 +9,7 @@ i2c_recv(uint8_t address, uint8_t data) "recv(addr:0x%02x)
data:0x%02x"
# aspeed_i2c.c
aspeed_i2c_bus_cmd(uint32_t cmd, const char *cmd_flags, uint32_t count,
uint32_t intr_status) "handling cmd=0x%x %s count=%d intr=0x%x"
-aspeed_i2c_bus_raise_interrupt(uint32_t intr_status, const char *str1, const
char *str2, const char *str3, const char *str4, const char *str5, const char
*str6) "handled intr=0x%x %s%s%s%s%s%s"
+aspeed_i2c_bus_raise_interrupt(uint32_t intr_status, const char *s) "handled
intr=0x%x %s"
aspeed_i2c_bus_read(uint32_t busid, uint64_t offset, unsigned size, uint64_t
value) "bus[%d]: To 0x%" PRIx64 " of size %u: 0x%" PRIx64
aspeed_i2c_bus_write(uint32_t busid, uint64_t offset, unsigned size, uint64_t
value) "bus[%d]: To 0x%" PRIx64 " of size %u: 0x%" PRIx64
aspeed_i2c_bus_send(const char *mode, int i, int count, uint8_t byte) "%s send
%d/%d 0x%02x"
--
2.35.3
- [PULL 05/19] test/avocado/machine_aspeed.py: Add I2C tests to ast2600-evb, (continued)
- [PULL 05/19] test/avocado/machine_aspeed.py: Add I2C tests to ast2600-evb, Cédric Le Goater, 2022/06/22
- [PULL 06/19] test/avocado/machine_aspeed.py: Add an I2C RTC test, Cédric Le Goater, 2022/06/22
- [PULL 07/19] hw/registerfields: Add shared fields macros, Cédric Le Goater, 2022/06/22
- [PULL 08/19] aspeed: i2c: Migrate to registerfields API, Cédric Le Goater, 2022/06/22
- [PULL 09/19] aspeed: i2c: Use reg array instead of individual vars, Cédric Le Goater, 2022/06/22
- [PULL 11/19] aspeed: i2c: Add PKT_DONE IRQ to trace, Cédric Le Goater, 2022/06/22
- [PULL 12/19] aspeed: i2c: Move regs and helpers to header file, Cédric Le Goater, 2022/06/22
- [PULL 13/19] aspeed/i2c: Add ast1030 controller models, Cédric Le Goater, 2022/06/22
- [PULL 14/19] aspeed: Add I2C buses to AST1030 model, Cédric Le Goater, 2022/06/22
- [PULL 10/19] aspeed: i2c: Add new mode support, Cédric Le Goater, 2022/06/22
- [PULL 15/19] hw/i2c/aspeed: rework raise interrupt trace event,
Cédric Le Goater <=
- [PULL 16/19] hw/i2c/aspeed: add DEV_ADDR in old register mode, Cédric Le Goater, 2022/06/22
- [PULL 17/19] aspeed/i2c: Enable SLAVE_ADDR_RX_MATCH always, Cédric Le Goater, 2022/06/22
- [PULL 18/19] aspeed/hace: Add missing newlines to unimp messages, Cédric Le Goater, 2022/06/22
- [PULL 19/19] hw: m25p80: fixing individual test failure when tests are running in isolation, Cédric Le Goater, 2022/06/22
- Re: [PULL 00/19] aspeed queue, Richard Henderson, 2022/06/22