Skip to contentSkip to conversation

hw/timer/imx_epit: Replace DPRINTF with trace events

PATCH In review jack wang 3 participants 5 messages Jun 17 – Jun 19 1 message not in the archive Arm i.MX and Layerscape

lore
Share & tools
lore

jack wang

author
#0 lore raw

PATCH v5 1/1 hw/timer/imx_epit: Replace DPRINTF with trace events

Clean up the codebase by removing the outdated DEBUG_IMX_EPIT and DPRINTF macros, replacing them with modern QEMU trace events.

This also removes an empty and meaningless DPRINTF("\n") in the imx_epit_realize function.

---
 hw/timer/imx_epit.c   | 25 +++++--------------------
 hw/timer/trace-events |  8 ++++++++
 2 files changed, 13 insertions(+), 20 deletions(-)
hw/timer/imx_epit.c +5 -20
index c67a39f10c..374ec7d324 100644
@@ -20,18 +20,7 @@
 #include "hw/misc/imx_ccm.h"
 #include "qemu/module.h"
 #include "qemu/log.h"
-
-#ifndef DEBUG_IMX_EPIT
-#define DEBUG_IMX_EPIT 0
-#endif
-
-#define DPRINTF(fmt, args...) \
-    do { \
-        if (DEBUG_IMX_EPIT) { \
-            fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_EPIT, \
-                                             __func__, ##args); \
-        } \
-    } while (0)
+#include "trace.h"
 
 static const char *imx_epit_reg_name(uint32_t reg)
 {
@@ -80,7 +69,7 @@ static uint32_t imx_epit_get_freq(IMXEPITState *s)
     uint32_t prescaler = 1 + extract32(s->cr, CR_PRESCALE_SHIFT, CR_PRESCALE_BITS);
     uint32_t f_in = imx_ccm_get_clock_frequency(s->ccm, imx_epit_clocks[clksrc]);
     uint32_t freq = f_in / prescaler;
-    DPRINTF("ptimer frequency is %u\n", freq);
+    trace_imx_epit_get_freq(freq);
     return freq;
 }
 
@@ -146,8 +135,7 @@ static uint64_t imx_epit_read(void *opaque, hwaddr offset, unsigned size)
                       HWADDR_PRIx "\n", TYPE_IMX_EPIT, __func__, offset);
         break;
     }
-
-    DPRINTF("(%s) = 0x%08x\n", imx_epit_reg_name(offset >> 2), reg_value);
+    trace_imx_epit_read(imx_epit_reg_name(offset >> 2), reg_value);
 
     return reg_value;
 }
@@ -328,8 +316,7 @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
 {
     IMXEPITState *s = IMX_EPIT(opaque);
 
-    DPRINTF("(%s, value = 0x%08x)\n", imx_epit_reg_name(offset >> 2),
-            (uint32_t)value);
+    trace_imx_epit_write(imx_epit_reg_name(offset >> 2), value);
 
     switch (offset >> 2) {
     case 0: /* CR */
@@ -362,7 +349,7 @@ static void imx_epit_cmp(void *opaque)
     /* The cmp ptimer can't be running when the peripheral is disabled */
     assert(s->cr & CR_EN);
 
-    DPRINTF("sr was %d\n", s->sr);
+    trace_imx_epit_cmp(s->sr);
     /* Set interrupt status bit SR.OCIF and update the interrupt state */
     s->sr |= SR_OCIF;
     imx_epit_update_int(s);
@@ -399,8 +386,6 @@ static void imx_epit_realize(DeviceState *dev, Error **errp)
     IMXEPITState *s = IMX_EPIT(dev);
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
 
-    DPRINTF("\n");
-
     sysbus_init_irq(sbd, &s->irq);
     memory_region_init_io(&s->iomem, OBJECT(s), &imx_epit_ops, s, TYPE_IMX_EPIT,
                           0x00001000);
hw/timer/trace-events +8 -0
index ac5afe84e8..cd83adb03d 100644
@@ -122,3 +122,11 @@ hpet_ram_write_tn_cmp(uint8_t reg_off) "hpet_ram_writel HPET_TN_CMP + %" PRIu8
 hpet_ram_write_invalid_tn_cmp(void) "invalid HPET_TN_CMP + 4 write"
 hpet_ram_write_invalid(void) "invalid hpet_ram_writel"
 hpet_ram_write_counter_write_while_enabled(void) "Writing counter while HPET enabled!"
+
+# imx_epit.c
+imx_epit_get_freq(uint32_t freq) "ptimer frequency is %u"
+imx_epit_read(const char *name, uint32_t value) "(%s) = 0x%08x"
+imx_epit_write(const char *name, uint64_t value) "(%s, value = 0x%08" PRIx64 ")"
+imx_epit_cmp(uint32_t sr) "sr was %d"
+
+
Signature · 1 line
2.53.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw
Quoted 8 lines

2026年6月18日 15:15,Michael Tokarev <[email protected]> 写道:

Quoted 2 lines · jack wang

Clean up the codebase by removing the outdated DEBUG_IMX_EPIT and DPRINTF macros, replacing them with modern QEMU trace events.

Quoted 7 lines

Hi!

I'm curious, why do you send these patches to me?

Thanks,

/mjt

To be honest,I am quite new to qemu and it is my first time to use git send emall to contribute so I am little confused about exact routing process
Last time I submitted a small patch to Peter and he kindly reviewed for me, and he still give me some advice.After I change according to his advice I tried to deliver the updated version to him.Since this patch is just change the #define macros with modern trace so I thought is may also fall under trivial category so I cc'd you as well. I apologize for the confusion and any noise this caused Thanks for your time Wang

#3 lore raw
Quoted 12 lines · Jack wang
Quoted 12 lines

2026年6月18日 15:15,Michael Tokarev <[email protected]> 写道:

Quoted 2 lines · jack wang

Clean up the codebase by removing the outdated DEBUG_IMX_EPIT and DPRINTF macros, replacing them with modern QEMU trace events.

Hi!

I'm curious, why do you send these patches to me?

Quoted 7 lines
Quoted 3 lines

Thanks,

/mjt

To be honest,I am quite new to qemu and it is my first time to use git send emall to contribute so I am little confused about exact routing process
Last time I submitted a small patch to Peter and he kindly reviewed for me, and he still give me some advice.After I change according to his advice I tried to deliver the updated version to him.Since this patch is just change the #define macros with modern trace so I thought is may also fall under trivial category so I cc'd you as well. I apologize for the confusion and any noise this caused Thanks for your time

Heh.

I weren't complaining, I just asked for your reasons.

Speaking of trivial patches, I'm not, but [email protected] is, and you Cc'ed it too. Right now I'm receiving 3 copies of every your email - sent to me directly, to qemu-devel@, and to qemu-trivial@. I can step out of qemu-trivial maintenance any time, or someone can help me, - they'll watch qemu-trivial@, not my own email.

I don't know why did you send to Peter directly, either, - well, ok, you can if he is listed in the MAINTAINERS file for the file you're editing. But generally it's not him but the output of get_maintainer.pl which should be used as the source for where to send emails.

Or if you reply to someone's patch, that too warrants a personal email. Or in a few other similar situations.

But I *think* (and I usually do that myself when sending emails) - the mailing list (qemu-devel and maybe qemu-trivial) is THE thing, get_maintainer.pl is THE thing, and that's about it. Unless there's a special reason to get an attention of particular person. And this is definitely not qemu-specific (the mailing lists are, but every other project has one or another mailing list/forum/etc).

Personally I try to not overload other people's mailboxes and instead try to make their mail sorting rules work (usually mailing list emails gets sorted to a specific folder, and people free to work on their projects when they see fit, keeping their inbox free of stuff which is also available elsewhere).

Thanks,

/mjt

#4 lore raw
In reply to Jack wang
Quoted 12 lines · Jack wang
Quoted 12 lines

2026年6月18日 15:15,Michael Tokarev <[email protected]> 写道:

Quoted 2 lines · jack wang

Clean up the codebase by removing the outdated DEBUG_IMX_EPIT and DPRINTF macros, replacing them with modern QEMU trace events.

Hi!

I'm curious, why do you send these patches to me?

Quoted 7 lines
Quoted 3 lines

Thanks,

/mjt

To be honest,I am quite new to qemu and it is my first time to use git send emall to contribute so I am little confused about exact routing process
Last time I submitted a small patch to Peter and he kindly reviewed for me, and he still give me some advice.After I change according to his advice I tried to deliver the updated version to him.Since this patch is just change the #define macros with modern trace so I thought is may also fall under trivial category so I cc'd you as well. I apologize for the confusion and any noise this caused Thanks for your time

Also please note I sent you a personal email with a single question, but you added two mailing lists back. I consider this to be rude.

Thanks,

/mjt

#5 lore raw
In reply to jack wang
Quoted 10 lines · jack wang

Clean up the codebase by removing the outdated DEBUG_IMX_EPIT and DPRINTF macros, replacing them with modern QEMU trace events.

This also removes an empty and meaningless DPRINTF("\n") in the imx_epit_realize function.

---

Thanks for this patch; I've applied it to target-arm.next, and it should get into upstream git within a week or so.

-- PMM