diff --git a/AUTHORS b/AUTHORS index da9f024227..d35e3255eb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -8,6 +8,8 @@ Github.com pull request). Note that these email addresses are not guaranteed to be current; they are simply a unique indicator of the individual who committed them. +Abhishek Joshi, Broadcom + abhishek.joshi@broadcom.com Abhishek Kulkarni, Indiana University adkulkar@cs.indiana.edu Adrian Knoth, Friedrich-Schiller-Universitat Jena diff --git a/opal/include/opal/sys/arm64/timer.h b/opal/include/opal/sys/arm64/timer.h index b93689c908..3e98c300e1 100644 --- a/opal/include/opal/sys/arm64/timer.h +++ b/opal/include/opal/sys/arm64/timer.h @@ -2,6 +2,7 @@ * Copyright (c) 2008 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2016 Broadcom Limited. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,14 +21,21 @@ static inline opal_timer_t opal_sys_timer_get_cycles(void) { opal_timer_t ret; - struct tms accurate_clock; - times(&accurate_clock); - ret = accurate_clock.tms_utime + accurate_clock.tms_stime; + __asm__ __volatile__ ("mrs %0, CNTVCT_EL0" : "=r" (ret)); return ret; } + +static inline opal_timer_t +opal_sys_timer_freq(void) +{ + opal_timer_t freq; + __asm__ __volatile__ ("mrs %0, CNTFRQ_EL0" : "=r" (freq)); + return (opal_timer_t)(freq); +} + #define OPAL_HAVE_SYS_TIMER_GET_CYCLES 1 #endif /* ! OPAL_SYS_ARCH_TIMER_H */ diff --git a/opal/include/opal/sys/timer.h b/opal/include/opal/sys/timer.h index fe97aef3ef..ff1a80e852 100644 --- a/opal/include/opal/sys/timer.h +++ b/opal/include/opal/sys/timer.h @@ -9,6 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2016 Broadcom Limited. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -84,6 +85,8 @@ BEGIN_C_DECLS #include "opal/sys/amd64/timer.h" #elif OPAL_ASSEMBLY_ARCH == OPAL_ARM #include "opal/sys/arm/timer.h" +#elif OPAL_ASSEMBLY_ARCH == OPAL_ARM64 +#include "opal/sys/arm64/timer.h" #elif OPAL_ASSEMBLY_ARCH == OPAL_IA32 #include "opal/sys/ia32/timer.h" #elif OPAL_ASSEMBLY_ARCH == OPAL_IA64 diff --git a/opal/mca/timer/linux/configure.m4 b/opal/mca/timer/linux/configure.m4 index 77557721db..2768fc8083 100644 --- a/opal/mca/timer/linux/configure.m4 +++ b/opal/mca/timer/linux/configure.m4 @@ -13,6 +13,7 @@ # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2016 Broadcom Limited. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -46,7 +47,7 @@ AC_DEFUN([MCA_opal_timer_linux_CONFIG],[ [timer_linux_happy="no"])]) case "${host}" in - i?86-*linux*|x86_64*linux*|ia64-*linux*|powerpc-*linux*|powerpc64-*linux*|sparc*-*linux*) + i?86-*linux*|x86_64*linux*|ia64-*linux*|powerpc-*linux*|powerpc64-*linux*|sparc*-*linux*|aarch64-*linux*) AS_IF([test "$timer_linux_happy" = "yes"], [AS_IF([test -r "/proc/cpuinfo"], [timer_linux_happy="yes"], diff --git a/opal/mca/timer/linux/timer_linux_component.c b/opal/mca/timer/linux/timer_linux_component.c index 9ebc479bca..45bdd8ec22 100644 --- a/opal/mca/timer/linux/timer_linux_component.c +++ b/opal/mca/timer/linux/timer_linux_component.c @@ -15,6 +15,7 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016 Broadcom Limited. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -107,6 +108,10 @@ static int opal_timer_linux_find_freq(void) opal_timer_linux_freq = 0; +#if OPAL_ASSEMBLY_ARCH == OPAL_ARM64 + opal_timer_linux_freq = opal_sys_timer_freq(); +#endif + if (0 == opal_timer_linux_freq) { /* first, look for a timebase field. probably only on PPC, but one never knows */