[dpdk-dev,v2,4/5] eal/armv8: define architecture specific rdtsc hz
Checks
Commit Message
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
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.liu@linaro.org>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
---
.../common/include/arch/arm/rte_cycles_64.h | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
@@ -58,6 +58,23 @@
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 @@
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