Skip to content

Commit 1edb7e7

Browse files
Marc Zyngierdlezcano
authored andcommitted
clocksource/drivers/arm_arch_timer: Force inlining of erratum_set_next_event_generic()
With some specific kernel configuration and Clang, the kernel fails to like with something like: ld.lld: error: undefined symbol: __compiletime_assert_200 >>> referenced by arch_timer.h:156 (./arch/arm64/include/asm/arch_timer.h:156) >>> clocksource/arm_arch_timer.o:(erratum_set_next_event_generic) in archive drivers/built-in.a ld.lld: error: undefined symbol: __compiletime_assert_197 >>> referenced by arch_timer.h:133 (./arch/arm64/include/asm/arch_timer.h:133) >>> clocksource/arm_arch_timer.o:(erratum_set_next_event_generic) in archive drivers/built-in.a make: *** [Makefile:1161: vmlinux] Error 1 These are due to the BUILD_BUG() macros contained in the low-level accessors (arch_timer_reg_{write,read}_cp15) being emitted, as the access type wasn't known at compile time. Fix this by making erratum_set_next_event_generic() __force_inline, resulting in the 'access' parameter to be resolved at compile time, similarly to what is already done for set_next_event(). Fixes: 4775bc6 ("Add build-time guards for unhandled register accesses") Reported-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Daniel Lezcano <[email protected]> Cc: Sami Tolvanen <[email protected]> Cc: Nick Desaulniers <[email protected]> Tested-by: Sami Tolvanen <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent a663bd1 commit 1edb7e7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/clocksource/arm_arch_timer.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,13 @@ EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
394394

395395
static atomic_t timer_unstable_counter_workaround_in_use = ATOMIC_INIT(0);
396396

397-
static void erratum_set_next_event_generic(const int access, unsigned long evt,
398-
struct clock_event_device *clk)
397+
/*
398+
* Force the inlining of this function so that the register accesses
399+
* can be themselves correctly inlined.
400+
*/
401+
static __always_inline
402+
void erratum_set_next_event_generic(const int access, unsigned long evt,
403+
struct clock_event_device *clk)
399404
{
400405
unsigned long ctrl;
401406
u64 cval;

0 commit comments

Comments
 (0)