1*4979e861SLeo Yan // SPDX-License-Identifier: GPL-2.0 2*4979e861SLeo Yan 3*4979e861SLeo Yan #include <linux/types.h> 4*4979e861SLeo Yan 5*4979e861SLeo Yan #include "../../../util/tsc.h" 6*4979e861SLeo Yan rdtsc(void)7*4979e861SLeo Yanu64 rdtsc(void) 8*4979e861SLeo Yan { 9*4979e861SLeo Yan u64 val; 10*4979e861SLeo Yan 11*4979e861SLeo Yan /* 12*4979e861SLeo Yan * According to ARM DDI 0487F.c, from Armv8.0 to Armv8.5 inclusive, the 13*4979e861SLeo Yan * system counter is at least 56 bits wide; from Armv8.6, the counter 14*4979e861SLeo Yan * must be 64 bits wide. So the system counter could be less than 64 15*4979e861SLeo Yan * bits wide and it is attributed with the flag 'cap_user_time_short' 16*4979e861SLeo Yan * is true. 17*4979e861SLeo Yan */ 18*4979e861SLeo Yan asm volatile("mrs %0, cntvct_el0" : "=r" (val)); 19*4979e861SLeo Yan 20*4979e861SLeo Yan return val; 21*4979e861SLeo Yan } 22