* [PATCH 0/3] hw/misc: Replace DPRINTF with trace events in i.MX CCM family
@ 2026-06-23 17:03 jack wang
2026-06-23 17:03 ` [PATCH 1/3] hw/misc/imx_ccm: Replace DPRINTF with trace events jack wang
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jack wang @ 2026-06-23 17:03 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, jack wang
This series modernizes the three i.MX CCM device models by removing
the old DEBUG_IMX*_CCM / DPRINTF macros and emitting QEMU trace
events instead, following the same pattern already merged for
hw/timer/imx_epit (commit 5005b00d41).
Patches are split per file so each commit changes one device, keeps
git bisect clean, and stays in scope for the trivial-patches team.
No behavior change is intended: the previous DEBUG_IMX_CCM switches defaulted to 0,
so DPRINTF output was off by default. After this series the same information is
available via -trace 'imx*ccm'.
jack wang (3):
hw/misc/imx_ccm: Replace DPRINTF with trace events
hw/misc/imx25_ccm: Replace DPRINTF with trace events
hw/misc/imx31_ccm: Replace DPRINTF with trace events
hw/misc/imx25_ccm.c | 34 ++++++++++------------------------
hw/misc/imx31_ccm.c | 33 ++++++++++-----------------------
hw/misc/imx_ccm.c | 18 +++---------------
hw/misc/trace-events | 23 +++++++++++++++++++++++
4 files changed, 46 insertions(+), 62 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] hw/misc/imx_ccm: Replace DPRINTF with trace events
2026-06-23 17:03 [PATCH 0/3] hw/misc: Replace DPRINTF with trace events in i.MX CCM family jack wang
@ 2026-06-23 17:03 ` jack wang
2026-06-23 17:03 ` [PATCH 2/3] hw/misc/imx25_ccm: " jack wang
2026-06-23 17:03 ` [PATCH 3/3] hw/misc/imx31_ccm: " jack wang
2 siblings, 0 replies; 4+ messages in thread
From: jack wang @ 2026-06-23 17:03 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, jack wang, Peter Maydell, open list:i.MX31 (kzm)
---
hw/misc/imx_ccm.c | 18 +++---------------
hw/misc/trace-events | 4 ++++
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/hw/misc/imx_ccm.c b/hw/misc/imx_ccm.c
index 9403c5daa3..30b8aaab8e 100644
--- a/hw/misc/imx_ccm.c
+++ b/hw/misc/imx_ccm.c
@@ -14,18 +14,7 @@
#include "qemu/osdep.h"
#include "hw/misc/imx_ccm.h"
#include "qemu/module.h"
-
-#ifndef DEBUG_IMX_CCM
-#define DEBUG_IMX_CCM 0
-#endif
-
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX_CCM) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_CCM, \
- __func__, ##args); \
- } \
- } while (0)
+#include "hw/misc/trace.h"
uint32_t imx_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
@@ -37,7 +26,7 @@ uint32_t imx_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
freq = klass->get_clock_frequency(dev, clock);
}
- DPRINTF("(clock = %d) = %u\n", clock, freq);
+ trace_imx_ccm_get_clock_frequency(clock,freq);
return freq;
}
@@ -64,8 +53,7 @@ uint32_t imx_ccm_calc_pll(uint32_t pllreg, uint32_t base_freq)
freq = ((2 * (base_freq >> 10) * (mfi * mfd + mfn)) /
(mfd * pd)) << 10;
- DPRINTF("(pllreg = 0x%08x, base_freq = %u) = %d\n", pllreg, base_freq,
- freq);
+ trace_imx_ccm_calc_pll(pllreg, base_freq, freq);
return freq;
}
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
index b88accc437..fdb4844045 100644
--- a/hw/misc/trace-events
+++ b/hw/misc/trace-events
@@ -237,6 +237,10 @@ iotkit_secctl_s_write(uint32_t offset, uint64_t data, unsigned size) "IoTKit Sec
iotkit_secctl_ns_read(uint32_t offset, uint64_t data, unsigned size) "IoTKit SecCtl NS regs read: offset 0x%x data 0x%" PRIx64 " size %u"
iotkit_secctl_ns_write(uint32_t offset, uint64_t data, unsigned size) "IoTKit SecCtl NS regs write: offset 0x%x data 0x%" PRIx64 " size %u"
+# imx_ccm.c
+imx_ccm_get_clock_frequency(uint32_t clock, uint32_t freq) "(clock = %u) = %u"
+imx_ccm_calc_pll(uint32_t pllreq, uint32_t base_freq, uint32_t freq) "(pllreg = 0x%08x, base_freq = %u) = %u"
+
# imx6_ccm.c
imx6_analog_get_periph_clk(uint32_t freq) "freq = %u Hz"
imx6_analog_get_pll2_clk(uint32_t freq) "freq = %u Hz"
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] hw/misc/imx25_ccm: Replace DPRINTF with trace events
2026-06-23 17:03 [PATCH 0/3] hw/misc: Replace DPRINTF with trace events in i.MX CCM family jack wang
2026-06-23 17:03 ` [PATCH 1/3] hw/misc/imx_ccm: Replace DPRINTF with trace events jack wang
@ 2026-06-23 17:03 ` jack wang
2026-06-23 17:03 ` [PATCH 3/3] hw/misc/imx31_ccm: " jack wang
2 siblings, 0 replies; 4+ messages in thread
From: jack wang @ 2026-06-23 17:03 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-trivial, jack wang, Peter Maydell, Jean-Christophe Dubois,
open list:i.MX25 PDK
---
hw/misc/imx25_ccm.c | 34 ++++++++++------------------------
hw/misc/trace-events | 9 +++++++++
2 files changed, 19 insertions(+), 24 deletions(-)
diff --git a/hw/misc/imx25_ccm.c b/hw/misc/imx25_ccm.c
index a6665d5535..1ee652a117 100644
--- a/hw/misc/imx25_ccm.c
+++ b/hw/misc/imx25_ccm.c
@@ -16,18 +16,8 @@
#include "migration/vmstate.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "hw/misc/trace.h"
-#ifndef DEBUG_IMX25_CCM
-#define DEBUG_IMX25_CCM 0
-#endif
-
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX25_CCM) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX25_CCM, \
- __func__, ##args); \
- } \
- } while (0)
static const char *imx25_ccm_reg_name(uint32_t reg)
{
@@ -118,12 +108,12 @@ static uint32_t imx25_ccm_get_mpll_clk(IMXCCMState *dev)
freq = imx_ccm_calc_pll(s->reg[IMX25_CCM_MPCTL_REG], CKIH_FREQ);
}
- DPRINTF("freq = %u\n", freq);
+ trace_imx25_ccm_get_mpll_clk(freq);
return freq;
}
-static uint32_t imx25_ccm_get_mcu_clk(IMXCCMState *dev)
+static uint32_t imx25_ccm_get_mcu_clk(IMX25CCMState *dev)
{
uint32_t freq;
IMX25CCMState *s = IMX25_CCM(dev);
@@ -136,7 +126,7 @@ static uint32_t imx25_ccm_get_mcu_clk(IMXCCMState *dev)
freq = freq / (1 + EXTRACT(s->reg[IMX25_CCM_CCTL_REG], ARM_CLK_DIV));
- DPRINTF("freq = %u\n", freq);
+ trace_imx25_ccm_get_mcu_clk(freq);
return freq;
}
@@ -149,7 +139,7 @@ static uint32_t imx25_ccm_get_ahb_clk(IMXCCMState *dev)
freq = imx25_ccm_get_mcu_clk(dev)
/ (1 + EXTRACT(s->reg[IMX25_CCM_CCTL_REG], AHB_CLK_DIV));
- DPRINTF("freq = %u\n", freq);
+ trace_imx25_ccm_get_ahb_clk(freq);
return freq;
}
@@ -160,7 +150,7 @@ static uint32_t imx25_ccm_get_ipg_clk(IMXCCMState *dev)
freq = imx25_ccm_get_ahb_clk(dev) / 2;
- DPRINTF("freq = %u\n", freq);
+ trace_imx25_ccm_get_ipg_clk(freq);
return freq;
}
@@ -168,7 +158,7 @@ static uint32_t imx25_ccm_get_ipg_clk(IMXCCMState *dev)
static uint32_t imx25_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
{
uint32_t freq = 0;
- DPRINTF("Clock = %d)\n", clock);
+ trace_imx25_ccm_get_clock_frequency(clock, freq);
switch (clock) {
case CLK_NONE:
@@ -186,7 +176,7 @@ static uint32_t imx25_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
break;
}
- DPRINTF("Clock = %d) = %u\n", clock, freq);
+ trace_imx25_ccm_get_clock_frequency(clock, freq);
return freq;
}
@@ -195,8 +185,6 @@ static void imx25_ccm_reset(DeviceState *dev)
{
IMX25CCMState *s = IMX25_CCM(dev);
- DPRINTF("\n");
-
memset(s->reg, 0, IMX25_CCM_MAX_REG * sizeof(uint32_t));
s->reg[IMX25_CCM_MPCTL_REG] = 0x800b2c01;
s->reg[IMX25_CCM_UPCTL_REG] = 0x84042800;
@@ -238,8 +226,7 @@ static uint64_t imx25_ccm_read(void *opaque, hwaddr offset, unsigned size)
HWADDR_PRIx "\n", TYPE_IMX25_CCM, __func__, offset);
}
- DPRINTF("reg[%s] => 0x%" PRIx32 "\n", imx25_ccm_reg_name(offset >> 2),
- value);
+ trace_imx25_ccm_read(imx25_ccm_reg_name(offset >> 2), value);
return value;
}
@@ -249,8 +236,7 @@ static void imx25_ccm_write(void *opaque, hwaddr offset, uint64_t value,
{
IMX25CCMState *s = (IMX25CCMState *)opaque;
- DPRINTF("reg[%s] <= 0x%" PRIx32 "\n", imx25_ccm_reg_name(offset >> 2),
- (uint32_t)value);
+ trace_imx25_ccm_write(imx25_ccm_reg_name(offset >> 2), (uint32_t)value);
if (offset < 0x70) {
/*
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
index fdb4844045..ebe9b4fb22 100644
--- a/hw/misc/trace-events
+++ b/hw/misc/trace-events
@@ -273,6 +273,15 @@ imx6_src_reset(void) ""
imx7_src_read(const char *reg_name, uint32_t value) "reg[%s] => 0x%" PRIx32
imx7_src_write(const char *reg_name, uint32_t value) "reg[%s] <= 0x%" PRIx32
+# imx25_ccm.c
+imx25_ccm_get_mpll_clk(uint32_t freq) "freq = %u"
+imx25_ccm_get_mcu_clk(uint32_t freq) "freq = %u"
+imx25_ccm_get_ahb_clk(uint32_t freq) "freq = %u"
+imx25_ccm_get_ipg_clk(uint32_t freq) "freq = %u"
+imx25_ccm_get_clock_frequency(unsigned clock, uint32_t freq) "(clock = %d) = %u"
+imx25_ccm_read(const char *reg, uint32_t value) "reg[%s] => 0x%" PRIx32
+imx25_ccm_write(const char *reg, uint32_t value) "reg[%s] <= 0x%" PRIx32
+
# iotkit-sysinfo.c
iotkit_sysinfo_read(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysInfo read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
iotkit_sysinfo_write(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysInfo write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] hw/misc/imx31_ccm: Replace DPRINTF with trace events
2026-06-23 17:03 [PATCH 0/3] hw/misc: Replace DPRINTF with trace events in i.MX CCM family jack wang
2026-06-23 17:03 ` [PATCH 1/3] hw/misc/imx_ccm: Replace DPRINTF with trace events jack wang
2026-06-23 17:03 ` [PATCH 2/3] hw/misc/imx25_ccm: " jack wang
@ 2026-06-23 17:03 ` jack wang
2 siblings, 0 replies; 4+ messages in thread
From: jack wang @ 2026-06-23 17:03 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, jack wang, Peter Maydell, open list:i.MX31 (kzm)
---
hw/misc/imx31_ccm.c | 33 ++++++++++-----------------------
hw/misc/trace-events | 10 ++++++++++
2 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/hw/misc/imx31_ccm.c b/hw/misc/imx31_ccm.c
index 339458e859..e3edd6df8f 100644
--- a/hw/misc/imx31_ccm.c
+++ b/hw/misc/imx31_ccm.c
@@ -16,21 +16,10 @@
#include "migration/vmstate.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "hw/misc/trace.h"
#define CKIH_FREQ 26000000 /* 26MHz crystal input */
-#ifndef DEBUG_IMX31_CCM
-#define DEBUG_IMX31_CCM 0
-#endif
-
-#define DPRINTF(fmt, args...) \
- do { \
- if (DEBUG_IMX31_CCM) { \
- fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX31_CCM, \
- __func__, ##args); \
- } \
- } while (0)
-
static const char *imx31_ccm_reg_name(uint32_t reg)
{
static char unknown[20];
@@ -120,7 +109,7 @@ static uint32_t imx31_ccm_get_pll_ref_clk(IMXCCMState *dev)
freq = CKIH_FREQ;
}
- DPRINTF("freq = %u\n", freq);
+ trace_imx31_ccm_get_pll_ref_clk(freq);
return freq;
}
@@ -133,7 +122,7 @@ static uint32_t imx31_ccm_get_mpll_clk(IMXCCMState *dev)
freq = imx_ccm_calc_pll(s->reg[IMX31_CCM_MPCTL_REG],
imx31_ccm_get_pll_ref_clk(dev));
- DPRINTF("freq = %u\n", freq);
+ trace_imx31_ccm_get_mpll_clk(freq);
return freq;
}
@@ -150,7 +139,7 @@ static uint32_t imx31_ccm_get_mcu_main_clk(IMXCCMState *dev)
freq = imx31_ccm_get_mpll_clk(dev);
}
- DPRINTF("freq = %u\n", freq);
+ trace_imx31_ccm_get_mcu_main_clk(freq);
return freq;
}
@@ -163,7 +152,7 @@ static uint32_t imx31_ccm_get_hclk_clk(IMXCCMState *dev)
freq = imx31_ccm_get_mcu_main_clk(dev)
/ (1 + EXTRACT(s->reg[IMX31_CCM_PDR0_REG], MAX));
- DPRINTF("freq = %u\n", freq);
+ trace_imx31_ccm_get_hclk_clk(freq);
return freq;
}
@@ -176,7 +165,7 @@ static uint32_t imx31_ccm_get_ipg_clk(IMXCCMState *dev)
freq = imx31_ccm_get_hclk_clk(dev)
/ (1 + EXTRACT(s->reg[IMX31_CCM_PDR0_REG], IPG));
- DPRINTF("freq = %u\n", freq);
+ trace_imx31_ccm_get_ipg_clk(freq);
return freq;
}
@@ -201,7 +190,7 @@ static uint32_t imx31_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
break;
}
- DPRINTF("Clock = %d) = %u\n", clock, freq);
+ trace_imx31_ccm_get_clock_frequency(clock, freq);
return freq;
}
@@ -210,7 +199,7 @@ static void imx31_ccm_reset(DeviceState *dev)
{
IMX31CCMState *s = IMX31_CCM(dev);
- DPRINTF("()\n");
+
memset(s->reg, 0, sizeof(uint32_t) * IMX31_CCM_MAX_REG);
@@ -244,8 +233,7 @@ static uint64_t imx31_ccm_read(void *opaque, hwaddr offset, unsigned size)
HWADDR_PRIx "\n", TYPE_IMX31_CCM, __func__, offset);
}
- DPRINTF("reg[%s] => 0x%" PRIx32 "\n", imx31_ccm_reg_name(offset >> 2),
- value);
+ trace_imx31_ccm_read(imx31_ccm_reg_name(offset >> 2), value);
return (uint64_t)value;
}
@@ -255,8 +243,7 @@ static void imx31_ccm_write(void *opaque, hwaddr offset, uint64_t value,
{
IMX31CCMState *s = (IMX31CCMState *)opaque;
- DPRINTF("reg[%s] <= 0x%" PRIx32 "\n", imx31_ccm_reg_name(offset >> 2),
- (uint32_t)value);
+ trace_imx31_ccm_write(imx31_ccm_reg_name(offset >> 2), value);
switch (offset >> 2) {
case IMX31_CCM_CCMR_REG:
diff --git a/hw/misc/trace-events b/hw/misc/trace-events
index ebe9b4fb22..0c2565ddb8 100644
--- a/hw/misc/trace-events
+++ b/hw/misc/trace-events
@@ -282,6 +282,16 @@ imx25_ccm_get_clock_frequency(unsigned clock, uint32_t freq) "(clock = %d) = %u"
imx25_ccm_read(const char *reg, uint32_t value) "reg[%s] => 0x%" PRIx32
imx25_ccm_write(const char *reg, uint32_t value) "reg[%s] <= 0x%" PRIx32
+# imx31_ccm.c
+imx31_ccm_get_mpll_clk(uint32_t freq) "freq = %u"
+imx31_ccm_get_pll_ref_clk(uint32_t freq) "freq = %u"
+imx31_ccm_get_mcu_main_clk(uint32_t freq) "freq = %u"
+imx31_ccm_get_hclk_clk(uint32_t freq) "freq = %u"
+imx31_ccm_get_ipg_clk(uint32_t freq) "freq = %u"
+imx31_ccm_get_clock_frequency(unsigned clock, uint32_t freq) "(clock = %u) = %u"
+imx31_ccm_read(const char *reg, uint32_t value) "reg[%s] => 0x%" PRIx32
+imx31_ccm_write(const char *reg, uint32_t value) "reg[%s] <= 0x%" PRIx32
+
# iotkit-sysinfo.c
iotkit_sysinfo_read(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysInfo read: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
iotkit_sysinfo_write(uint64_t offset, uint64_t data, unsigned size) "IoTKit SysInfo write: offset 0x%" PRIx64 " data 0x%" PRIx64 " size %u"
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-23 17:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 17:03 [PATCH 0/3] hw/misc: Replace DPRINTF with trace events in i.MX CCM family jack wang
2026-06-23 17:03 ` [PATCH 1/3] hw/misc/imx_ccm: Replace DPRINTF with trace events jack wang
2026-06-23 17:03 ` [PATCH 2/3] hw/misc/imx25_ccm: " jack wang
2026-06-23 17:03 ` [PATCH 3/3] hw/misc/imx31_ccm: " jack wang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.