Re: [PATCH v2 4/4] clocksource/drivers/timer-mediatek: Make timer-mediatek become loadable module

From: Walter Chang (張維哲)
Date: Mon Apr 10 2023 - 02:58:20 EST


On Wed, 2023-03-29 at 14:22 +0800, Walter.Chang wrote:
> First, I'd like to thank Angelo for assisting us in spliting out the
> CPUX driver [1], allowing this driver to become a module that can be
> loaded when needed.
>
> In response to Matthias's concern about whether SYST/GPT on the old
> MediaTek platforms can boot properly with the loadable module, I
> recently conducted a few tests and found that both hardwares are
> capable of booting normally with this loadable module.
>
> For my experiments, I used MT6768 with this patch:
>
> 1. When the module was not loaded or load the module but the
> corresponding compatible property was not specified in the dts, the
> following results were obtained:
>
> # cat /proc/timer_list | grep "Broadcast device" -A 15
> Broadcast device
> Clock Event Device: bc_hrtimer
> max_delta_ns: 9223372036854775807
> min_delta_ns: 1
> mult: 1
> shift: 0
> mode: 3
> next_event: 490204000000 nsecs
> set_next_event: <0000000000000000>
> shutdown: bc_shutdown.cfi_jt
> event_handler: tick_handle_oneshot_broadcast.cfi_jt
> retries: 0
>
> tick_broadcast_mask: ff
> tick_broadcast_oneshot_mask: 7e
>
> The built-in `bc_hrtimer` was used as the broadcast device, whereby
> one
> CPU was kept awake to wake up the other CPUs. As a result, one CPU
> could not enter the idle state.
>
> 2. When the module was loaded and the GPT compatible property was
> specified in the dts:
>
> # cat /proc/timer_list | grep "Broadcast device" -A 17
> Broadcast device
> Clock Event Device: mtk-clkevt
> max_delta_ns: 330382104634
> min_delta_ns: 1000
> mult: 27917287
> shift: 31
> mode: 3
> next_event: 1483221016462 nsecs
> set_next_event: mtk_gpt_clkevt_next_event.cfi_jt
> shutdown: mtk_gpt_clkevt_shutdown.cfi_jt
> periodic: mtk_gpt_clkevt_set_periodic.cfi_jt
> oneshot: mtk_gpt_clkevt_shutdown.cfi_jt
> resume: mtk_gpt_clkevt_shutdown.cfi_jt
> event_handler: tick_handle_oneshot_broadcast.cfi_jt
> retries: 17
>
> tick_broadcast_mask: ff
> tick_broadcast_oneshot_mask: bf
>
> 3. When the module was loaded and the SYST compatible property was
> specified in the dts:
>
> # cat /proc/timer_list | grep "Broadcast device" -A 17
> Broadcast device
> Clock Event Device: mtk-clkevt
> max_delta_ns: 330382104634
> min_delta_ns: 1000
> mult: 27917287
> shift: 31
> mode: 3
> next_event: 132252000000 nsecs
> set_next_event: mtk_syst_clkevt_next_event.cfi_jt
> shutdown: mtk_syst_clkevt_shutdown.cfi_jt
> oneshot: mtk_syst_clkevt_oneshot.cfi_jt
> resume: mtk_syst_clkevt_resume.cfi_jt
> event_handler: tick_handle_oneshot_broadcast.cfi_jt
> retries: 8
>
> tick_broadcast_mask: ff
> tick_broadcast_oneshot_mask: 3f
>
> These two experiments show that SYST/GPT on the old MediaTek
> platforms
> can also work properly with the loadable module, and will not cause
> any
> booting issues. Therefore, making timer-mediatek.c driver into a
> loadable module is feasible.
>
> Thanks,
> Walter Chang
>
> [1]
>
https://lore.kernel.org/lkml/20230309103913.116775-1-angelogioacchino.delregno@xxxxxxxxxxxxx/

Gentle ping.

Thanks,
Walter Chang