clocksource: arch_timer: make virtual counter access configurable
authorGreg Hackmann <ghackmann@google.com>
Tue, 19 Sep 2017 17:55:17 +0000 (10:55 -0700)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 9 Jan 2018 12:35:07 +0000 (13:35 +0100)
Change-Id: Ibdb1fd768b748002b90bfc165612c12c8311f8a2
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/clocksource/Kconfig
drivers/clocksource/arm_arch_timer.c

index 2eb5f0efae903cd5235bdd2132ec455dfafe7c26..50f512629afd2a5e0a7a4fd083b44dbd4221fb4e 100644 (file)
@@ -158,6 +158,14 @@ config ARM_ARCH_TIMER_EVTSTREAM
          This must be disabled for hardware validation purposes to detect any
          hardware anomalies of missing events.
 
+config ARM_ARCH_TIMER_VCT_ACCESS
+       bool "Support for ARM architected timer virtual counter access in userspace"
+       default !ARM64
+       depends on ARM_ARCH_TIMER
+       help
+         This option enables support for reading the ARM architected timer's
+         virtual counter in userspace.
+
 config ARM_GLOBAL_TIMER
        bool
        select CLKSRC_OF if OF
index c64d543d64bf69576d9d75ffc54839439c70ea9b..1c029b49f96dfe75b27a55bc333122ee05027aef 100644 (file)
@@ -333,7 +333,10 @@ static void arch_counter_set_user_access(void)
                        | ARCH_TIMER_USR_PCT_ACCESS_EN);
 
        /* Enable user access to the virtual counter */
-       cntkctl |= ARCH_TIMER_USR_VCT_ACCESS_EN;
+       if (IS_ENABLED(CONFIG_ARM_ARCH_TIMER_VCT_ACCESS))
+               cntkctl |= ARCH_TIMER_USR_VCT_ACCESS_EN;
+       else
+               cntkctl &= ~ARCH_TIMER_USR_VCT_ACCESS_EN;
 
        arch_timer_set_cntkctl(cntkctl);
 }