for (icount = 0; icount < OTX2_TIM_CALIB_ITER; icount++) {
real_bkt = otx2_read64(tim_ring->base + TIM_LF_RING_REL) >> 44;
- bkt_cyc = rte_rdtsc();
+ bkt_cyc = tim_cntvct();
bucket = (bkt_cyc - tim_ring->ring_start_cyc) /
tim_ring->tck_int;
bucket = bucket % (tim_ring->nb_bkts);
tim_err_desc(rc);
goto fail;
}
-#ifdef RTE_ARM_EAL_RDTSC_USE_PMU
- uint64_t tenns_stmp, tenns_diff;
- uint64_t pmu_stmp;
-
- pmu_stmp = rte_rdtsc();
- asm volatile("mrs %0, cntvct_el0" : "=r" (tenns_stmp));
-
- tenns_diff = tenns_stmp - rsp->timestarted;
- pmu_stmp = pmu_stmp - (NSEC2TICK(tenns_diff * 10, rte_get_timer_hz()));
- tim_ring->ring_start_cyc = pmu_stmp;
-#else
tim_ring->ring_start_cyc = rsp->timestarted;
-#endif
- tim_ring->tck_int = NSEC2TICK(tim_ring->tck_nsec, rte_get_timer_hz());
+ tim_ring->tck_int = NSEC2TICK(tim_ring->tck_nsec, tim_cntfrq());
tim_ring->tot_int = tim_ring->tck_int * tim_ring->nb_bkts;
tim_ring->fast_div = rte_reciprocal_value_u64(tim_ring->tck_int);
tim_ring->fast_bkt = rte_reciprocal_value_u64(tim_ring->nb_bkts);
struct rte_event_timer_adapter_stats *stats)
{
struct otx2_tim_ring *tim_ring = adapter->data->adapter_priv;
- uint64_t bkt_cyc = rte_rdtsc() - tim_ring->ring_start_cyc;
-
+ uint64_t bkt_cyc = tim_cntvct() - tim_ring->ring_start_cyc;
stats->evtim_exp_count = __atomic_load_n(&tim_ring->arm_cnt,
__ATOMIC_RELAXED);
return mz->addr;
}
+#ifdef RTE_ARCH_ARM64
+static inline uint64_t
+tim_cntvct(void)
+{
+ return __rte_arm64_cntvct();
+}
+
+static inline uint64_t
+tim_cntfrq(void)
+{
+ return __rte_arm64_cntfrq();
+}
+#else
+static inline uint64_t
+tim_cntvct(void)
+{
+ return 0;
+}
+
+static inline uint64_t
+tim_cntfrq(void)
+{
+ return 0;
+}
+#endif
+
#define TIM_ARM_FASTPATH_MODES \
FP(sp, 0, 0, 0, OTX2_TIM_ENA_DFB | OTX2_TIM_SP) \
FP(mp, 0, 0, 1, OTX2_TIM_ENA_DFB | OTX2_TIM_MP) \
static inline void
tim_sync_start_cyc(struct otx2_tim_ring *tim_ring)
{
- uint64_t cur_cyc = rte_rdtsc();
+ uint64_t cur_cyc = tim_cntvct();
uint32_t real_bkt;
if (cur_cyc - tim_ring->last_updt_cyc > tim_ring->tot_int) {
real_bkt = otx2_read64(tim_ring->base + TIM_LF_RING_REL) >> 44;
- cur_cyc = rte_rdtsc();
+ cur_cyc = tim_cntvct();
tim_ring->ring_start_cyc = cur_cyc -
(real_bkt * tim_ring->tck_int);
const uint32_t rel_bkt, struct otx2_tim_bkt **bkt,
struct otx2_tim_bkt **mirr_bkt)
{
- const uint64_t bkt_cyc = rte_rdtsc() - tim_ring->ring_start_cyc;
+ const uint64_t bkt_cyc = tim_cntvct() - tim_ring->ring_start_cyc;
uint64_t bucket =
rte_reciprocal_divide_u64(bkt_cyc, &tim_ring->fast_div) +
rel_bkt;