Commit 1edb7e74 authored by Marc Zyngier's avatar Marc Zyngier Committed by Daniel Lezcano
Browse files

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: 4775bc63 ("Add build-time guards for unhandled register accesses")
Reported-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: default avatarSami Tolvanen <samitolvanen@google.com>
Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20211117113532.3895208-1-maz@kernel.org


Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent a663bd19
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -394,7 +394,12 @@ EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);


static atomic_t timer_unstable_counter_workaround_in_use = ATOMIC_INIT(0);
static atomic_t timer_unstable_counter_workaround_in_use = ATOMIC_INIT(0);


static void erratum_set_next_event_generic(const int access, unsigned long evt,
/*
 * Force the inlining of this function so that the register accesses
 * can be themselves correctly inlined.
 */
static __always_inline
void erratum_set_next_event_generic(const int access, unsigned long evt,
				    struct clock_event_device *clk)
				    struct clock_event_device *clk)
{
{
	unsigned long ctrl;
	unsigned long ctrl;