On 13 August 2017 at 15:03, Jerin Jacob <jerin.ja...@caviumnetworks.com> wrote: > Use cntvct_el0 system register to get the system counter frequency. > > If the system is configured with RTE_ARM_EAL_RDTSC_USE_PMU then > return 0(let the common code calibrate the tsc frequency). > > CC: Jianbo Liu <jianbo....@linaro.org> > Signed-off-by: Jerin Jacob <jerin.ja...@caviumnetworks.com> > --- > .../common/include/arch/arm/rte_cycles_64.h | 30 > ++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h > b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h > index 154576910..5b95cb67d 100644 > --- a/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h > +++ b/lib/librte_eal/common/include/arch/arm/rte_cycles_64.h > @@ -58,6 +58,23 @@ rte_rdtsc(void) > asm volatile("mrs %0, cntvct_el0" : "=r" (tsc)); > return tsc; > } > + > +/** > + * Get the number of rdtsc cycles in one second if the architecture supports. > + * > + * @return > + * The number of rdtsc cycles in one second. Return zero if the > architecture > + * support is not available. > + */ > +static inline uint64_t > +rte_rdtsc_arch_hz(void) > +{ > + uint64_t freq; > + > + asm volatile("mrs %0, cntfrq_el0" : "=r" (freq)); > + return freq; > +} > + > #else > /** > * This is an alternative method to enable rte_rdtsc() with high resolution > @@ -85,6 +102,19 @@ rte_rdtsc(void) > asm volatile("mrs %0, pmccntr_el0" : "=r"(tsc)); > return tsc; > } > + > +/** > + * Get the number of rdtsc cycles in one second if the architecture supports. > + * > + * @return > + * The number of rdtsc cycles in one second. Return zero if the > architecture > + * support is not available. > + */ > +static inline uint64_t > +rte_rdtsc_arch_hz(void) > +{ > + return 0; > +} > #endif > > static inline uint64_t > -- > 2.14.0 >
Acked-by: Jianbo Liu <jianbo....@linaro.org>