Message ID | 1458161499-15313-7-git-send-email-ben.sanda@dornerworks.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, Mar 16, 2016 at 01:51:39PM -0700, Benjamin Sanda wrote: > From: bensanda <ben.sanda@dornerworks.com> > > Modified to provide support for xentrace on the ARM platform. Changed get_cycles() to return the core timestamp tick count for use by the trace buffer timestamping routines in xentrace. > > Signed-off-by: Benjamin Sanda <ben.sanda@dornerworks.com> That is missing the CC to Stefano or Julien. CC-ing them. > --- > xen/include/asm-arm/time.h | 13 ++++++++----- > 1 file changed, 8 insertions(+), 5 deletions(-) > > diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h > index 5b9a31d..f3a22d5 100644 > --- a/xen/include/asm-arm/time.h > +++ b/xen/include/asm-arm/time.h > @@ -1,15 +1,21 @@ > #ifndef __ARM_TIME_H__ > #define __ARM_TIME_H__ > > +#include <asm/regs.h> > + > #define DT_MATCH_TIMER \ > DT_MATCH_COMPATIBLE("arm,armv7-timer"), \ > DT_MATCH_COMPATIBLE("arm,armv8-timer") > > -typedef unsigned long cycles_t; > +/* Counter value at boot time */ > +extern uint64_t boot_count; > + > +typedef uint64_t cycles_t; > > static inline cycles_t get_cycles (void) > { > - return 0; > + /* return raw tick count of main timer */ > + return READ_SYSREG64(CNTPCT_EL0) - boot_count; > } > > /* List of timer's IRQ */ > @@ -34,9 +40,6 @@ unsigned int timer_get_irq(enum timer_ppi ppi); > /* Set up the timer interrupt on this CPU */ > extern void init_timer_interrupt(void); > > -/* Counter value at boot time */ > -extern uint64_t boot_count; > - > extern s_time_t ticks_to_ns(uint64_t ticks); > extern uint64_t ns_to_ticks(s_time_t ns); > > -- > 2.7.2 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel
On Fri, 25 Mar 2016, Konrad Rzeszutek Wilk wrote: > On Wed, Mar 16, 2016 at 01:51:39PM -0700, Benjamin Sanda wrote: > > From: bensanda <ben.sanda@dornerworks.com> > > > > Modified to provide support for xentrace on the ARM platform. Changed get_cycles() to return the core timestamp tick count for use by the trace buffer timestamping routines in xentrace. > > > > Signed-off-by: Benjamin Sanda <ben.sanda@dornerworks.com> > > That is missing the CC to Stefano or Julien. CC-ing them. Thanks > > xen/include/asm-arm/time.h | 13 ++++++++----- > > 1 file changed, 8 insertions(+), 5 deletions(-) > > > > diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h > > index 5b9a31d..f3a22d5 100644 > > --- a/xen/include/asm-arm/time.h > > +++ b/xen/include/asm-arm/time.h > > @@ -1,15 +1,21 @@ > > #ifndef __ARM_TIME_H__ > > #define __ARM_TIME_H__ > > > > +#include <asm/regs.h> > > + > > #define DT_MATCH_TIMER \ > > DT_MATCH_COMPATIBLE("arm,armv7-timer"), \ > > DT_MATCH_COMPATIBLE("arm,armv8-timer") > > > > -typedef unsigned long cycles_t; > > +/* Counter value at boot time */ > > +extern uint64_t boot_count; Changing cycles_t to uint64_t sounds good, but why did you move boot_count here from below? > > +typedef uint64_t cycles_t; > > > > static inline cycles_t get_cycles (void) > > { > > - return 0; > > + /* return raw tick count of main timer */ > > + return READ_SYSREG64(CNTPCT_EL0) - boot_count; > > } > > > > /* List of timer's IRQ */ > > @@ -34,9 +40,6 @@ unsigned int timer_get_irq(enum timer_ppi ppi); > > /* Set up the timer interrupt on this CPU */ > > extern void init_timer_interrupt(void); > > > > -/* Counter value at boot time */ > > -extern uint64_t boot_count; > > - > > extern s_time_t ticks_to_ns(uint64_t ticks); > > extern uint64_t ns_to_ticks(s_time_t ns); > > > > -- > > 2.7.2 > > > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xen.org > > http://lists.xen.org/xen-devel >
Stefano, Thank you for the comments. In response: > Changing cycles_t to uint64_t sounds good, but why did you move > boot_count here from below? I had to move it up so it would be defined for use in the updated get_cycles() call: return READ_SYSREG64(CNTPCT_EL0) - boot_count; Should get_cyclces not use boot_count? I included it as the normal system time call uses it so I assumed this should be consistent. Thanks, Ben Sanda
On Thu, 31 Mar 2016, Ben Sanda wrote: > Stefano, > > Thank you for the comments. In response: > > > Changing cycles_t to uint64_t sounds good, but why did you move > > boot_count here from below? > > I had to move it up so it would be defined for use in the updated > get_cycles() call: > return READ_SYSREG64(CNTPCT_EL0) - boot_count; > > Should get_cyclces not use boot_count? I included it as the normal > system time call uses it so I assumed this should be consistent. Sorry I misread your patch. Your implementation of get_cycles is correct but I would prefer to avoid including asm/regs.h in time.h. I would prefer if the implementation was in xen/arch/arm/time.c (even if that means no static inline). Then you could base get_s_time on get_cycles.
diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h index 5b9a31d..f3a22d5 100644 --- a/xen/include/asm-arm/time.h +++ b/xen/include/asm-arm/time.h @@ -1,15 +1,21 @@ #ifndef __ARM_TIME_H__ #define __ARM_TIME_H__ +#include <asm/regs.h> + #define DT_MATCH_TIMER \ DT_MATCH_COMPATIBLE("arm,armv7-timer"), \ DT_MATCH_COMPATIBLE("arm,armv8-timer") -typedef unsigned long cycles_t; +/* Counter value at boot time */ +extern uint64_t boot_count; + +typedef uint64_t cycles_t; static inline cycles_t get_cycles (void) { - return 0; + /* return raw tick count of main timer */ + return READ_SYSREG64(CNTPCT_EL0) - boot_count; } /* List of timer's IRQ */ @@ -34,9 +40,6 @@ unsigned int timer_get_irq(enum timer_ppi ppi); /* Set up the timer interrupt on this CPU */ extern void init_timer_interrupt(void); -/* Counter value at boot time */ -extern uint64_t boot_count; - extern s_time_t ticks_to_ns(uint64_t ticks); extern uint64_t ns_to_ticks(s_time_t ns);