diff options
author | Andrew Murray <andrew.murray@arm.com> | 2019-04-09 05:52:40 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2019-04-16 11:27:12 -0400 |
commit | aaba098fe6ce594ae6f963dc041be6307e499f19 (patch) | |
tree | 619d471f27d373e460f251afacddc19889dafe5c /drivers/clocksource/arm_arch_timer.c | |
parent | a823c35ff2eda73046cc1847326071de350fceda (diff) |
arm64: HWCAP: add support for AT_HWCAP2
As we will exhaust the first 32 bits of AT_HWCAP let's start
exposing AT_HWCAP2 to userspace to give us up to 64 caps.
Whilst it's possible to use the remaining 32 bits of AT_HWCAP, we
prefer to expand into AT_HWCAP2 in order to provide a consistent
view to userspace between ILP32 and LP64. However internal to the
kernel we prefer to continue to use the full space of elf_hwcap.
To reduce complexity and allow for future expansion, we now
represent hwcaps in the kernel as ordinals and use a
KERNEL_HWCAP_ prefix. This allows us to support automatic feature
based module loading for all our hwcaps.
We introduce cpu_set_feature to set hwcaps which complements the
existing cpu_have_feature helper. These helpers allow us to clean
up existing direct uses of elf_hwcap and reduce any future effort
required to move beyond 64 caps.
For convenience we also introduce cpu_{have,set}_named_feature which
makes use of the cpu_feature macro to allow providing a hwcap name
without a {KERNEL_}HWCAP_ prefix.
Signed-off-by: Andrew Murray <andrew.murray@arm.com>
[will: use const_ilog2() and tweak documentation]
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'drivers/clocksource/arm_arch_timer.c')
-rw-r--r-- | drivers/clocksource/arm_arch_timer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index aa4ec53281ce..6cc8aff83805 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
@@ -833,7 +833,11 @@ static void arch_timer_evtstrm_enable(int divider) | |||
833 | cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT) | 833 | cntkctl |= (divider << ARCH_TIMER_EVT_TRIGGER_SHIFT) |
834 | | ARCH_TIMER_VIRT_EVT_EN; | 834 | | ARCH_TIMER_VIRT_EVT_EN; |
835 | arch_timer_set_cntkctl(cntkctl); | 835 | arch_timer_set_cntkctl(cntkctl); |
836 | #ifdef CONFIG_ARM64 | ||
837 | cpu_set_named_feature(EVTSTRM); | ||
838 | #else | ||
836 | elf_hwcap |= HWCAP_EVTSTRM; | 839 | elf_hwcap |= HWCAP_EVTSTRM; |
840 | #endif | ||
837 | #ifdef CONFIG_COMPAT | 841 | #ifdef CONFIG_COMPAT |
838 | compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM; | 842 | compat_elf_hwcap |= COMPAT_HWCAP_EVTSTRM; |
839 | #endif | 843 | #endif |
@@ -1055,7 +1059,11 @@ static int arch_timer_cpu_pm_notify(struct notifier_block *self, | |||
1055 | } else if (action == CPU_PM_ENTER_FAILED || action == CPU_PM_EXIT) { | 1059 | } else if (action == CPU_PM_ENTER_FAILED || action == CPU_PM_EXIT) { |
1056 | arch_timer_set_cntkctl(__this_cpu_read(saved_cntkctl)); | 1060 | arch_timer_set_cntkctl(__this_cpu_read(saved_cntkctl)); |
1057 | 1061 | ||
1062 | #ifdef CONFIG_ARM64 | ||
1063 | if (cpu_have_named_feature(EVTSTRM)) | ||
1064 | #else | ||
1058 | if (elf_hwcap & HWCAP_EVTSTRM) | 1065 | if (elf_hwcap & HWCAP_EVTSTRM) |
1066 | #endif | ||
1059 | cpumask_set_cpu(smp_processor_id(), &evtstrm_available); | 1067 | cpumask_set_cpu(smp_processor_id(), &evtstrm_available); |
1060 | } | 1068 | } |
1061 | return NOTIFY_OK; | 1069 | return NOTIFY_OK; |