DPDK  25.11.0
rte_pmu_pmc_arm64.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2025 Marvell.
3  */
4 
5 #ifndef RTE_PMU_PMC_ARM64_H
6 #define RTE_PMU_PMC_ARM64_H
7 
8 #include <rte_common.h>
9 
10 static __rte_always_inline uint64_t
11 rte_pmu_pmc_read(int index)
12 {
13  uint64_t val;
14 
15  if (index == 31) {
16  /* CPU Cycles (0x11) must be read via pmccntr_el0 */
17  asm volatile("mrs %0, pmccntr_el0" : "=r" (val));
18  } else {
19  asm volatile(
20  "msr pmselr_el0, %x0\n"
21  "mrs %0, pmxevcntr_el0\n"
22  : "=r" (val)
23  : "rZ" (index)
24  );
25  }
26 
27  return val;
28 }
29 #define rte_pmu_pmc_read rte_pmu_pmc_read
30 
31 #endif /* RTE_PMU_PMC_ARM64_H */
#define __rte_always_inline
Definition: rte_common.h:490