Skip to content

Commit 3aff040

Browse files
prabhakarladdlezcano
authored andcommitted
clocksource/drivers/riscv: Get rid of clocksource_arch_init() callback
Having a clocksource_arch_init() callback always sets vdso_clock_mode to VDSO_CLOCKMODE_ARCHTIMER if GENERIC_GETTIMEOFDAY is enabled, this is required for the riscv-timer. This works for platforms where just riscv-timer clocksource is present. On platforms where other clock sources are available we want them to register with vdso_clock_mode set to VDSO_CLOCKMODE_NONE. On the Renesas RZ/Five SoC OSTM block can be used as clocksource [0], to avoid multiple clock sources being registered as VDSO_CLOCKMODE_ARCHTIMER move setting of vdso_clock_mode in the riscv-timer driver instead of doing this in clocksource_arch_init() callback as done similarly for ARM/64 architecture. [0] drivers/clocksource/renesas-ostm.c Signed-off-by: Lad Prabhakar <[email protected]> Tested-by: Samuel Holland <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent c3daa47 commit 3aff040

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

arch/riscv/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ config 32BIT
1212

1313
config RISCV
1414
def_bool y
15-
select ARCH_CLOCKSOURCE_INIT
1615
select ARCH_ENABLE_HUGEPAGE_MIGRATION if HUGETLB_PAGE && MIGRATION
1716
select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2
1817
select ARCH_HAS_BINFMT_FLAT

arch/riscv/kernel/time.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,3 @@ void __init time_init(void)
3333

3434
tick_setup_hrtimer_broadcast();
3535
}
36-
37-
void clocksource_arch_init(struct clocksource *cs)
38-
{
39-
#ifdef CONFIG_GENERIC_GETTIMEOFDAY
40-
cs->vdso_clock_mode = VDSO_CLOCKMODE_ARCHTIMER;
41-
#else
42-
cs->vdso_clock_mode = VDSO_CLOCKMODE_NONE;
43-
#endif
44-
}

drivers/clocksource/timer-riscv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ static struct clocksource riscv_clocksource = {
7878
.mask = CLOCKSOURCE_MASK(64),
7979
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
8080
.read = riscv_clocksource_rdtime,
81+
#if IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY)
82+
.vdso_clock_mode = VDSO_CLOCKMODE_ARCHTIMER,
83+
#else
84+
.vdso_clock_mode = VDSO_CLOCKMODE_NONE,
85+
#endif
8186
};
8287

8388
static int riscv_timer_starting_cpu(unsigned int cpu)

0 commit comments

Comments
 (0)