clocksource/arm_arch_timer: extract elf_hwcap use to arch-helper
PATCH v2 1/1 clocksource/arm_arch_timer: extract elf_hwcap use to arch-helper
Different mechanisms are used to test and set elf_hwcaps between ARM and ARM64, this results in the use of ifdeferry in this file when setting/testing for the EVTSTRM hwcap.
Let's improve readability by extracting this to an arch helper.
--- arch/arm/include/asm/arch_timer.h | 10 ++++++++++ arch/arm64/include/asm/arch_timer.h | 13 +++++++++++++ drivers/clocksource/arm_arch_timer.c | 15 ++------------- 3 files changed, 25 insertions(+), 13 deletions(-)
arch/arm/include/asm/arch_timer.h +10 -0
@@ -4,6 +4,7 @@#include <asm/barrier.h> #include <asm/errno.h> +#include <asm/hwcap.h> #include <linux/clocksource.h> #include <linux/init.h> #include <linux/types.h>
@@ -124,6 +125,15 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)isb (); } +static inline bool arch_timer_set_evtstrm_feature (void ) +{ + elf_hwcap |=HWCAP_EVTSTRM ; +} + +static inline bool arch_timer_have_evtstrm_feature (void ) +{ +return elf_hwcap &HWCAP_EVTSTRM ; +}#endif #endif
arch/arm64/include/asm/arch_timer.h +13 -0
@@ -20,6 +20,7 @@#define __ASM_ARCH_TIMER_H#include <asm/barrier.h> +#include <asm/hwcap.h> #include <asm/sysreg.h> #include <linux/bug.h>
@@ -240,4 +241,16 @@ static inline int arch_timer_arch_init(void) return 0; } +static inline void arch_timer_set_evtstrm_feature (void ) +{ +cpu_set_named_feature (EVTSTRM ); +#ifdef CONFIG_COMPAT + compat_elf_hwcap |=COMPAT_HWCAP_EVTSTRM ; +#endif +} + +static inline bool arch_timer_have_evtstrm_feature (void ) +{ +return cpu_have_named_feature (EVTSTRM ); +}#endif
drivers/clocksource/arm_arch_timer.c +2 -13
@@ -804,14 +804,7 @@ static void arch_timer_evtstrm_enable(int divider) cntkctl |= (divider <<ARCH_TIMER_EVT_TRIGGER_SHIFT ) |ARCH_TIMER_VIRT_EVT_EN ;arch_timer_set_cntkctl (cntkctl); -#ifdef CONFIG_ARM64 -cpu_set_named_feature (EVTSTRM ); -#else - elf_hwcap |=HWCAP_EVTSTRM ; -#endif -#ifdef CONFIG_COMPAT - compat_elf_hwcap |=COMPAT_HWCAP_EVTSTRM ; -#endif +arch_timer_set_evtstrm_feature ();cpumask_set_cpu (smp_processor_id (), &evtstrm_available); }
@@ -1040,11 +1033,7 @@ static int arch_timer_cpu_pm_notify(struct notifier_block *self, }else if (action ==CPU_PM_ENTER_FAILED || action ==CPU_PM_EXIT ) {arch_timer_set_cntkctl (__this_cpu_read (saved_cntkctl)); -#ifdef CONFIG_ARM64 -if (cpu_have_named_feature (EVTSTRM )) -#else - if (elf_hwcap & HWCAP_EVTSTRM) -#endif +if (arch_timer_have_evtstrm_feature ())cpumask_set_cpu (smp_processor_id (), &evtstrm_available); }return NOTIFY_OK ;
Signature · 7 lines
2.21.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
+ Daniel
Quoted 10 lines · Andrew Murray
Different mechanisms are used to test and set
elf_hwcapsbetween ARM and ARM64, this results in the use of ifdeferry in this file when setting/testing for the EVTSTRM hwcap.Let's improve readability by extracting this to an arch helper.
Signed-off-by Andrew Murray <[email protected]>Acked-by Mark Rutland <[email protected]>Acked-by Will Deacon <[email protected]>
Daniel, can you please take this though the clocksource tree?
Thanks,
M.
Quoted 99 lines
--- arch/arm/include/asm/arch_timer.h | 10 ++++++++++ arch/arm64/include/asm/arch_timer.h | 13 +++++++++++++ drivers/clocksource/arm_arch_timer.c | 15 ++------------- 3 files changed, 25 insertions(+), 13 deletions(-)arch/arm/include/asm/arch_timer.h +10
-0@@ -4,6 +4,7 @@#include <asm/barrier.h> #include <asm/errno.h> +#include <asm/hwcap.h> #include <linux/clocksource.h> #include <linux/init.h> #include <linux/types.h> @@ -124,6 +125,15 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)isb (); } +static inline bool arch_timer_set_evtstrm_feature (void ) +{ + elf_hwcap |=HWCAP_EVTSTRM ; +} + +static inline bool arch_timer_have_evtstrm_feature (void ) +{ +return elf_hwcap &HWCAP_EVTSTRM ; +}#endif #endif arch/arm64/include/asm/arch_timer.h +13
-0@@ -20,6 +20,7 @@#define __ASM_ARCH_TIMER_H#include <asm/barrier.h> +#include <asm/hwcap.h> #include <asm/sysreg.h> #include <linux/bug.h> @@ -240,4 +241,16 @@ static inline int arch_timer_arch_init(void) return 0; } +static inline void arch_timer_set_evtstrm_feature (void ) +{ +cpu_set_named_feature (EVTSTRM ); +#ifdef CONFIG_COMPAT + compat_elf_hwcap |=COMPAT_HWCAP_EVTSTRM ; +#endif +} + +static inline bool arch_timer_have_evtstrm_feature (void ) +{ +return cpu_have_named_feature (EVTSTRM ); +}#endif drivers/clocksource/arm_arch_timer.c +2
-13@@ -804,14 +804,7 @@ static void arch_timer_evtstrm_enable(int divider) cntkctl |= (divider <<ARCH_TIMER_EVT_TRIGGER_SHIFT ) |ARCH_TIMER_VIRT_EVT_EN ;arch_timer_set_cntkctl (cntkctl); -#ifdef CONFIG_ARM64 -cpu_set_named_feature (EVTSTRM ); -#else - elf_hwcap |=HWCAP_EVTSTRM ; -#endif -#ifdef CONFIG_COMPAT - compat_elf_hwcap |=COMPAT_HWCAP_EVTSTRM ; -#endif +arch_timer_set_evtstrm_feature ();cpumask_set_cpu (smp_processor_id (), &evtstrm_available); }@@ -1040,11 +1033,7 @@ static int arch_timer_cpu_pm_notify(struct notifier_block *self, }else if (action ==CPU_PM_ENTER_FAILED || action ==CPU_PM_EXIT ) {arch_timer_set_cntkctl (__this_cpu_read (saved_cntkctl)); -#ifdef CONFIG_ARM64 -if (cpu_have_named_feature (EVTSTRM )) -#else - if (elf_hwcap & HWCAP_EVTSTRM) -#endif +if (arch_timer_have_evtstrm_feature ())cpumask_set_cpu (smp_processor_id (), &evtstrm_available); }return NOTIFY_OK ;Signature · 1 line
2.21.0
Signature · 6 lines
Jazz is not dead, it just smells funny. _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Daniel Lezcano
AppliedQuoted 11 lines · Marc Zyngier
+ Daniel
Quoted 7 lines · Andrew Murray
Different mechanisms are used to test and set
elf_hwcapsbetween ARM and ARM64, this results in the use of ifdeferry in this file when setting/testing for the EVTSTRM hwcap.Let's improve readability by extracting this to an arch helper.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Andrew Murray <[email protected]>Acked-by Mark Rutland <[email protected]>Acked-by Will Deacon <[email protected]>Acked-by Marc Zyngier <[email protected]>Daniel, can you please take this though the clocksource tree?
Applied, thanks
-- Daniel
Quoted 100 lines
Quoted 99 lines
--- arch/arm/include/asm/arch_timer.h | 10 ++++++++++ arch/arm64/include/asm/arch_timer.h | 13 +++++++++++++ drivers/clocksource/arm_arch_timer.c | 15 ++------------- 3 files changed, 25 insertions(+), 13 deletions(-)arch/arm/include/asm/arch_timer.h +10
-0@@ -4,6 +4,7 @@#include <asm/barrier.h> #include <asm/errno.h> +#include <asm/hwcap.h> #include <linux/clocksource.h> #include <linux/init.h> #include <linux/types.h> @@ -124,6 +125,15 @@ static inline void arch_timer_set_cntkctl(u32 cntkctl)isb (); } +static inline bool arch_timer_set_evtstrm_feature (void ) +{ + elf_hwcap |=HWCAP_EVTSTRM ; +} + +static inline bool arch_timer_have_evtstrm_feature (void ) +{ +return elf_hwcap &HWCAP_EVTSTRM ; +}#endif #endif arch/arm64/include/asm/arch_timer.h +13
-0@@ -20,6 +20,7 @@#define __ASM_ARCH_TIMER_H#include <asm/barrier.h> +#include <asm/hwcap.h> #include <asm/sysreg.h> #include <linux/bug.h> @@ -240,4 +241,16 @@ static inline int arch_timer_arch_init(void) return 0; } +static inline void arch_timer_set_evtstrm_feature (void ) +{ +cpu_set_named_feature (EVTSTRM ); +#ifdef CONFIG_COMPAT + compat_elf_hwcap |=COMPAT_HWCAP_EVTSTRM ; +#endif +} + +static inline bool arch_timer_have_evtstrm_feature (void ) +{ +return cpu_have_named_feature (EVTSTRM ); +}#endif drivers/clocksource/arm_arch_timer.c +2
-13@@ -804,14 +804,7 @@ static void arch_timer_evtstrm_enable(int divider) cntkctl |= (divider <<ARCH_TIMER_EVT_TRIGGER_SHIFT ) |ARCH_TIMER_VIRT_EVT_EN ;arch_timer_set_cntkctl (cntkctl); -#ifdef CONFIG_ARM64 -cpu_set_named_feature (EVTSTRM ); -#else - elf_hwcap |=HWCAP_EVTSTRM ; -#endif -#ifdef CONFIG_COMPAT - compat_elf_hwcap |=COMPAT_HWCAP_EVTSTRM ; -#endif +arch_timer_set_evtstrm_feature ();cpumask_set_cpu (smp_processor_id (), &evtstrm_available); }@@ -1040,11 +1033,7 @@ static int arch_timer_cpu_pm_notify(struct notifier_block *self, }else if (action ==CPU_PM_ENTER_FAILED || action ==CPU_PM_EXIT ) {arch_timer_set_cntkctl (__this_cpu_read (saved_cntkctl)); -#ifdef CONFIG_ARM64 -if (cpu_have_named_feature (EVTSTRM )) -#else - if (elf_hwcap & HWCAP_EVTSTRM) -#endif +if (arch_timer_have_evtstrm_feature ())cpumask_set_cpu (smp_processor_id (), &evtstrm_available); }return NOTIFY_OK ;Signature · 1 line
2.21.0
Signature · 11 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel