14979e861SLeo Yan // SPDX-License-Identifier: GPL-2.0 24979e861SLeo Yan 34979e861SLeo Yan #include <linux/types.h> 44979e861SLeo Yan 54979e861SLeo Yan #include "../../../util/tsc.h" 64979e861SLeo Yan rdtsc(void)74979e861SLeo Yanu64 rdtsc(void) 84979e861SLeo Yan { 94979e861SLeo Yan u64 val; 104979e861SLeo Yan 114979e861SLeo Yan /* 124979e861SLeo Yan * According to ARM DDI 0487F.c, from Armv8.0 to Armv8.5 inclusive, the 134979e861SLeo Yan * system counter is at least 56 bits wide; from Armv8.6, the counter 144979e861SLeo Yan * must be 64 bits wide. So the system counter could be less than 64 154979e861SLeo Yan * bits wide and it is attributed with the flag 'cap_user_time_short' 164979e861SLeo Yan * is true. 174979e861SLeo Yan */ 184979e861SLeo Yan asm volatile("mrs %0, cntvct_el0" : "=r" (val)); 194979e861SLeo Yan 204979e861SLeo Yan return val; 214979e861SLeo Yan } 22