Timer driver module support
Subsystems (6)
Daniel Lezcano
maintainercover Timer driver module support
Converting the timer driver modules requires a particular care because, depending on the platform, that may be not supported.
A previous study showed we are safe regarding how the module refcount is held and if THIS_MODULE is set for the clockevent and the clocksource when they are registered.
It won't be possible to unload a module if a clockevent is registered.
It will be possible to unload a module if only a clocksource is registered and it is not the current one.
However platforms without architected timers may need the timer driver to be initialized very early and others can be initialized later. The former can not be a module and the init function receives a device_node pointer, there is no device associated and devres is not used. That results in a lot of rollbacking code where usually it is where we find bug and resource leaks. The latter can be converted to a module and uses a module_platform_driver(), thus the init function is a probe function receiving a struct platform_device pointer parameter.
We end up with two approaches and duplicate code for the init functions. This is not optimal.
Finally, we have the driver having to be initialized very early on some platforms and be built as a module on other platforms, resulting on having two init functions co-existing in the same driver.
This series provides what is needed to move to the same probe function for early init, builtin and module timers.
A new macro is introduced: TIMER_PDEV_DECLARE() and a new Kconfig option is added CONFIG_EARLY_TIMER. TIMER_PDEV_DECLARE() will have different behavior depending on the context:
- The driver is a module and CONFIG_EARLY_TIMER=no --> the driver is a module
- The driver is builtin and CONFIG_EARLY_TIMER=no --> the driver is loaded later
- The driver is builtin or a module but CONFIG_EARLY_TIMER=yes --> the driver is initialized through the timer-probe function
The different timer driver framework functions have their __init sections removed and the symbols exported in order to be compatible with the drivers converted into modules.
The series provides a couple of drivers changed. The Mediatek as a recent requested target which is only compiled-tested. The Rockchip timer which was tested on a rk3588 in the three different configurations.
Daniel Lezcano (7):
clocksource/drivers/timer-probe: Create a platform_device before the
framework is initialized
drivers/clocksource/rockchip: Use the TIMER_PDEV_DECLARE() macro clocksource/drivers/mmio: Make the code compatible with modules clocksource/drivers/timer-of: Make the code compatible with modules clocksource/drivers/timer-probe: Add the module support for the
TIMER_PDEV_DECLARE() macro
clocksource/drivers/rockchip: Add rockchip timer module support clocksource/drivers/mediatek: Convert to module support
drivers/clocksource/Kconfig | 7 +- drivers/clocksource/mmio.c | 11 ++- drivers/clocksource/timer-mediatek.c | 29 ++++++-- drivers/clocksource/timer-of.c | 24 ++++--- drivers/clocksource/timer-of.h | 5 +- drivers/clocksource/timer-probe.c | 69 ++++++++++++++++-- drivers/clocksource/timer-rockchip.c | 101 ++++++++++----------------- include/asm-generic/vmlinux.lds.h | 10 +++ include/linux/clocksource.h | 31 ++++++++ 9 files changed, 194 insertions(+), 93 deletions(-)
Signature · 1 line
2.43.0
Daniel Lezcano
maintainerPATCH RESEND 1/7 clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized
From: Daniel Lezcano <[email protected]>
In the context of the time keeping and the timers, some platforms have timers which need to be initialized very early. It is the case of the ARM platform which do not have the architected timers.
The macro TIMER_OF_DECLARE adds an entry in the timer init functions array at compile time and the function timer_probe is called from the timer_init() function in kernel/time.c
This array contains a tuple with the init function and the compatible string.
The init function has a device node pointer parameter.
The timer_probe() function browses the of nodes and find the ones matching the compatible string given when using the TIMER_OF_DECLARE macro. It then calls the init function with the device node as a pointer.
But there are some platforms where there are multiple timers like the ARM64 with the architected timers. Those are always initialized very early and the other timers can be initialized later.
For this reason we find timer drivers with the platform_driver incarnation. Consequently their init functions are different, they have a platform_device pointer parameter and rely on the devm_ function for rollbacking.
To summarize, we have:
- TIMER_OF_DECLARE with init function prototype:
int (*init)(struct device_node *np);
- module_platform_driver (and variant) with the probe function prototype:
int (*init)(struct platform_device *pdev);
The current situation with the timers is the following:
- Two platforms can have the same timer hardware, hence the same driver but one without alternate timers and the other with multiple timers. For example, the Exynos platform has only the Exynos MCT on ARM but has the architeched timers in addition on the ARM64.
- The timer drivers can be modules now which was not the case until recently. TIMER_OF_DECLARE do not allow the build as a module.
It results in duplicate init functions (one with rollback and one with devm_) and different way to declare the driver (TIMER_OF_DECLARE and module_platform_driver).
This proposed change is to unify the prototyping of the init functions to receive a platform_device pointer as parameter. Consequently, it will allow a smoother and nicer module conversion and a huge cleanup of the init functions by removing all the rollback code from all the timer drivers. It introduces a TIMER_PDEV_DECLARE() macro.
If the macro is used a platform_device is manually allocated and initialized with the needed information for the probe function. Otherwise module_platform_driver can be use instead with the same probe function without the timer_probe() initialization.
The plan is to have all timers to use TIMER_PDEV_DECLARE with all the init functions optimized and then remove the TIMER_OF_DECLARE macro.
--- drivers/clocksource/timer-probe.c | 66 +++++++++++++++++++++++++++++-- include/asm-generic/vmlinux.lds.h | 10 +++++ include/linux/clocksource.h | 21 ++++++++++ 3 files changed, 93 insertions(+), 4 deletions(-)
drivers/clocksource/timer-probe.c +62 -4
@@ -7,13 +7,11 @@#include <linux/init.h> #include <linux/of.h> #include <linux/clocksource.h> +#include <linux/platform_device.h> extern struct of_device_id __timer_of_table[]; -static const struct of_device_id __timer_of_table_sentinel -__used __section ("__timer_of_table_end" ); - -void __init timer_probe (void ) +static int __init timer_of_probe (void ) {struct device_node *np;const struct of_device_id *match;
@@ -38,6 +36,66 @@ void __init timer_probe(void) timers++; } +return timers; +} + +static int __init __timer_pdev_probe (struct platform_driver *drv) +{ +struct device_node *np; +struct platform_device *pdev; +const struct of_device_id *match; +unsigned int timers =0 ; +int ret; + +for_each_matching_node_and_match (np, drv->driver.of_match_table, &match) { +if (!of_device_is_available (np)) +continue ; + + pdev =platform_device_alloc (of_node_full_name (np),-1 ); +if (!pdev) +continue ; + + ret =device_add_of_node (&pdev->dev, np); +if (ret) { +platform_device_put (pdev); +continue ; + } + +dev_set_name (&pdev->dev, pdev->name); + + ret = drv->probe (pdev); +if (!ret) { + timers++; +continue ; + } + +if (ret != -EPROBE_DEFER ) +pr_err ("Failed to initialize '%pOF': %d\n" , np, ret); + +device_remove_of_node (&pdev->dev); + +platform_device_put (pdev); + } + +return timers; +} + +static int __init timer_pdev_probe (void ) +{ +struct platform_driver **drv; + +for_each_pdev_timer_table (drv) +__timer_pdev_probe (*drv); + +return 0 ; +} + +void __init timer_probe (void ) +{ +unsigned timers =0 ; + + timers +=timer_of_probe (); + timers +=timer_pdev_probe (); timers +=acpi_probe_device_table (timer);if (!timers)
include/asm-generic/vmlinux.lds.h +10 -0
@@ -359,6 +359,15 @@#define THERMAL_TABLE (name)#endif +#ifdef CONFIG_TIMER_OF +#define TIMER_TABLE (name) \ + . = ALIGN(8); \ + BOUNDED_SECTION_POST_LABEL(__##name##_timer_table, \ + __##name##_timer_table,, _end) +#else +#define TIMER_TABLE (name) +#endif +#define KERNEL_DTB () \ STRUCT_ALIGN(); \ __dtb_start = .; \
@@ -738,6 +747,7 @@ ACPI_PROBE_TABLE(irqchip) \ ACPI_PROBE_TABLE(timer) \ THERMAL_TABLE(governor) \ + TIMER_TABLE(pdev) \ EARLYCON_TABLE() \ LSM_TABLE() \ EARLY_LSM_TABLE() \
include/linux/clocksource.h +21 -0
@@ -18,6 +18,7 @@#include <linux/init.h> #include <linux/of.h> #include <linux/clocksource_ids.h> +#include <linux/platform_device.h> #include <asm/div64.h> #include <asm/io.h>
@@ -295,6 +296,26 @@ extern void timer_probe(void);static inline void timer_probe (void ) {}#endif +extern struct platform_driver *__pdev_timer_table[]; +extern struct platform_driver *__pdev_timer_table_end[]; + +#define TIMER_PDEV_DECLARE (__name, __probe, __remove, __match) \ + static struct platform_driver __pdev_timer_table_entry_##__name = { \ + .probe = __probe, \ + .remove = __remove, \ + .driver = { \ + .name = #__name, \ + .of_match_table = __match \ + }, \ + }; \ + static struct platform_driver *___pdev_timer_table_entry_##__name \ + __used __section("__pdev_timer_table") = &__pdev_timer_table_entry_##__name + +#define for_each_pdev_timer_table (__pdev) \ + for (__pdev = __pdev_timer_table; \ + __pdev < __pdev_timer_table_end; \ + __pdev++) +#define TIMER_ACPI_DECLARE (name, table_id, fn) \ ACPI_DECLARE_PROBE_ENTRY(timer, name, table_id, 0, NULL, 0, fn)
Signature · 1 line
2.43.0
kernel test robot
build botRe: [PATCH resend v1 1/7] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized
kernel test robot noticed the following build warnings:
Hi Daniel,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/timers/core]
[also build test WARNING on rockchip/for-next arnd-asm-generic/master linus/master v7.0-rc5 next-20260327] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Daniel-Lezcano/clocksource-drivers-timer-probe-Create-a-platform_device-before-the-framework-is-initialized/20260328-080154 base: tip/timers/core patch link: https://lore.kernel.org/r/20260327180600.8150-2-daniel.lezcano%40kernel.org patch subject: [PATCH resend v1 1/7] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized config: x86_64-randconfig-013-20260328 (https://download.01.org/0day-ci/archive/20260328/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260328/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from arch/x86/include/asm/current.h:11,
from arch/x86/include/asm/processor.h:17,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from arch/x86/entry/vdso/vdso32/../common/vclock_gettime.c:11,
from arch/x86/entry/vdso/vdso32/vclock_gettime.c:1:
arch/x86/include/asm/tlbflush.h: In function 'cpu_tlbstate_update_lam':
>> arch/x86/include/asm/tlbflush.h:468:46: warning: right shift count >= width of type [-Wshift-count-overflow]
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~
arch/x86/include/asm/percpu.h:145:69: note: in definition of macro '__raw_cpu_write'
145 | *(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val); \
| ^~~
include/linux/percpu-defs.h:369:25: note: in expansion of macro 'this_cpu_write_1'
369 | case 1: stem##1(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:500:41: note: in expansion of macro '__pcpu_size_call'
500 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:9: note: in expansion of macro 'this_cpu_write'
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~~~~~~~~~~~~~
>> arch/x86/include/asm/tlbflush.h:468:46: warning: right shift count >= width of type [-Wshift-count-overflow]
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~
arch/x86/include/asm/percpu.h:145:69: note: in definition of macro '__raw_cpu_write'
145 | *(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val); \
| ^~~
include/linux/percpu-defs.h:370:25: note: in expansion of macro 'this_cpu_write_2'
370 | case 2: stem##2(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:500:41: note: in expansion of macro '__pcpu_size_call'
500 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:9: note: in expansion of macro 'this_cpu_write'
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~~~~~~~~~~~~~
>> arch/x86/include/asm/tlbflush.h:468:46: warning: right shift count >= width of type [-Wshift-count-overflow]
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~
arch/x86/include/asm/percpu.h:145:69: note: in definition of macro '__raw_cpu_write'
145 | *(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val); \
| ^~~
include/linux/percpu-defs.h:371:25: note: in expansion of macro 'this_cpu_write_4'
371 | case 4: stem##4(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:500:41: note: in expansion of macro '__pcpu_size_call'
500 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:9: note: in expansion of macro 'this_cpu_write'
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~~~~~~~~~~~~~
In file included from arch/x86/include/asm/percpu.h:598:
>> arch/x86/include/asm/tlbflush.h:468:46: warning: right shift count >= width of type [-Wshift-count-overflow]
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~
include/asm-generic/percpu.h:87:33: note: in definition of macro 'raw_cpu_generic_to_op'
87 | *raw_cpu_ptr(&(pcp)) op val; \
| ^~~
include/asm-generic/percpu.h:412:41: note: in expansion of macro 'this_cpu_generic_to_op'
412 | #define this_cpu_write_8(pcp, val) this_cpu_generic_to_op(pcp, val, =)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:372:25: note: in expansion of macro 'this_cpu_write_8'
372 | case 8: stem##8(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:500:41: note: in expansion of macro '__pcpu_size_call'
500 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:9: note: in expansion of macro 'this_cpu_write'
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~~~~~~~~~~~~~
In file included from include/linux/kasan.h:38,
from include/linux/slab.h:264,
from include/linux/fs.h:45,
from include/linux/compat.h:17,
from arch/x86/include/asm/ia32.h:7,
from arch/x86/include/asm/elf.h:10,
from include/linux/elf.h:6,
from include/linux/module.h:20,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from include/linux/platform_device.h:13,
from include/linux/clocksource.h:21,
from include/clocksource/hyperv_timer.h:16,
from arch/x86/include/asm/vdso/gettimeofday.h:20,
from include/vdso/datapage.h:196,
from arch/x86/include/uapi/../../../../lib/vdso/gettimeofday.c:6,
from arch/x86/entry/vdso/vdso32/../common/vclock_gettime.c:16:
include/linux/pgtable.h: At top level:
include/linux/pgtable.h:2204:2: error: #error Missing MAX_POSSIBLE_PHYSMEM_BITS definition
2204 | #error Missing MAX_POSSIBLE_PHYSMEM_BITS definition
| ^~~~~
arch/x86/include/asm/ia32.h:28:8: error: redefinition of 'struct stat64'
28 | struct stat64 {
| ^~~~~~
In file included from include/linux/stat.h:6,
from include/linux/sysfs.h:22,
from include/linux/kobject.h:20,
from include/linux/of.h:18,
from include/linux/clocksource.h:19:
arch/x86/include/uapi/asm/stat.h:42:8: note: originally defined here
42 | struct stat64 {
| ^~~~~~vim +468 arch/x86/include/asm/tlbflush.h
82721d8b25d76c Kiryl Shutsemau 2023-03-12 465
ec225f8c255fd0 Yosry Ahmed 2024-07-02 466 static inline void cpu_tlbstate_update_lam(unsigned long lam, u64 untag_mask)
82721d8b25d76c Kiryl Shutsemau 2023-03-12 467 {
ec225f8c255fd0 Yosry Ahmed 2024-07-02 @468 this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
ec225f8c255fd0 Yosry Ahmed 2024-07-02 469 this_cpu_write(tlbstate_untag_mask, untag_mask);
82721d8b25d76c Kiryl Shutsemau 2023-03-12 470 }82721d8b25d76c Kiryl Shutsemau 2023-03-12 471
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH resend v1 1/7] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized
In reply to Daniel Lezcanokernel test robot noticed the following build errors:
Hi Daniel,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on rockchip/for-next arnd-asm-generic/master linus/master v7.0-rc5 next-20260327] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Daniel-Lezcano/clocksource-drivers-timer-probe-Create-a-platform_device-before-the-framework-is-initialized/20260328-080154 base: tip/timers/core patch link: https://lore.kernel.org/r/20260327180600.8150-2-daniel.lezcano%40kernel.org patch subject: [PATCH resend v1 1/7] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20260328/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260328/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
In file included from arch/x86/include/asm/processor.h:21,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from arch/x86/entry/vdso/vdso32/../common/vclock_gettime.c:11,
from arch/x86/entry/vdso/vdso32/vclock_gettime.c:1:
arch/x86/include/asm/pgtable.h: In function 'pte_flags_pkey':
>> arch/x86/include/asm/pgtable_types.h:69:43: warning: left shift count >= width of type [-Wshift-count-overflow]
69 | #define _PAGE_PKEY_BIT0 (_AT(pteval_t, 1) << _PAGE_BIT_PKEY_BIT0)
| ^~
arch/x86/include/asm/pgtable_types.h:80:26: note: in expansion of macro '_PAGE_PKEY_BIT0'
80 | #define _PAGE_PKEY_MASK (_PAGE_PKEY_BIT0 | \
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable.h:1598:29: note: in expansion of macro '_PAGE_PKEY_MASK'
1598 | return (pte_flags & _PAGE_PKEY_MASK) >> _PAGE_BIT_PKEY_BIT0;
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable_types.h:70:43: warning: left shift count >= width of type [-Wshift-count-overflow]
70 | #define _PAGE_PKEY_BIT1 (_AT(pteval_t, 1) << _PAGE_BIT_PKEY_BIT1)
| ^~
arch/x86/include/asm/pgtable_types.h:81:26: note: in expansion of macro '_PAGE_PKEY_BIT1'
81 | _PAGE_PKEY_BIT1 | \
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable.h:1598:29: note: in expansion of macro '_PAGE_PKEY_MASK'
1598 | return (pte_flags & _PAGE_PKEY_MASK) >> _PAGE_BIT_PKEY_BIT0;
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable_types.h:71:43: warning: left shift count >= width of type [-Wshift-count-overflow]
71 | #define _PAGE_PKEY_BIT2 (_AT(pteval_t, 1) << _PAGE_BIT_PKEY_BIT2)
| ^~
arch/x86/include/asm/pgtable_types.h:82:26: note: in expansion of macro '_PAGE_PKEY_BIT2'
82 | _PAGE_PKEY_BIT2 | \
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable.h:1598:29: note: in expansion of macro '_PAGE_PKEY_MASK'
1598 | return (pte_flags & _PAGE_PKEY_MASK) >> _PAGE_BIT_PKEY_BIT0;
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable_types.h:72:43: warning: left shift count >= width of type [-Wshift-count-overflow]
72 | #define _PAGE_PKEY_BIT3 (_AT(pteval_t, 1) << _PAGE_BIT_PKEY_BIT3)
| ^~
arch/x86/include/asm/pgtable_types.h:83:26: note: in expansion of macro '_PAGE_PKEY_BIT3'
83 | _PAGE_PKEY_BIT3)
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable.h:1598:29: note: in expansion of macro '_PAGE_PKEY_MASK'
1598 | return (pte_flags & _PAGE_PKEY_MASK) >> _PAGE_BIT_PKEY_BIT0;
| ^~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/tlbflush.h:17,
from arch/x86/include/asm/uaccess.h:17,
from include/linux/uaccess.h:13,
from include/linux/sched/task.h:13,
from include/linux/sched/signal.h:9,
from include/linux/rcuwait.h:6,
from include/linux/percpu-rwsem.h:7,
from include/linux/fs/super_types.h:13,
from include/linux/fs/super.h:5,
from include/linux/fs.h:5,
from include/linux/compat.h:17,
from arch/x86/include/asm/ia32.h:7,
from arch/x86/include/asm/elf.h:10,
from include/linux/elf.h:6,
from include/linux/module.h:20,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from include/linux/platform_device.h:13,
from include/linux/clocksource.h:21,
from include/clocksource/hyperv_timer.h:16,
from arch/x86/include/asm/vdso/gettimeofday.h:20,
from include/vdso/datapage.h:196,
from arch/x86/include/uapi/../../../../lib/vdso/gettimeofday.c:6,
from arch/x86/entry/vdso/vdso32/../common/vclock_gettime.c:16:
>> arch/x86/include/asm/pgtable.h:1598:46: warning: right shift count >= width of type [-Wshift-count-overflow]
1598 | return (pte_flags & _PAGE_PKEY_MASK) >> _PAGE_BIT_PKEY_BIT0;
| ^~
arch/x86/include/asm/tlbflush.h: In function 'pte_flags_need_flush':
>> arch/x86/include/asm/pgtable_types.h:69:43: warning: left shift count >= width of type [-Wshift-count-overflow]
69 | #define _PAGE_PKEY_BIT0 (_AT(pteval_t, 1) << _PAGE_BIT_PKEY_BIT0)
| ^~
arch/x86/include/asm/tlbflush.h:377:45: note: in expansion of macro '_PAGE_PKEY_BIT0'
377 | _PAGE_PAT_LARGE | _PAGE_PKEY_BIT0 | _PAGE_PKEY_BIT1 |
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable_types.h:70:43: warning: left shift count >= width of type [-Wshift-count-overflow]
70 | #define _PAGE_PKEY_BIT1 (_AT(pteval_t, 1) << _PAGE_BIT_PKEY_BIT1)
| ^~
arch/x86/include/asm/tlbflush.h:377:63: note: in expansion of macro '_PAGE_PKEY_BIT1'
377 | _PAGE_PAT_LARGE | _PAGE_PKEY_BIT0 | _PAGE_PKEY_BIT1 |
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable_types.h:71:43: warning: left shift count >= width of type [-Wshift-count-overflow]
71 | #define _PAGE_PKEY_BIT2 (_AT(pteval_t, 1) << _PAGE_BIT_PKEY_BIT2)
| ^~
arch/x86/include/asm/tlbflush.h:378:27: note: in expansion of macro '_PAGE_PKEY_BIT2'
378 | _PAGE_PKEY_BIT2 | _PAGE_PKEY_BIT3 | _PAGE_NX;
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/pgtable_types.h:72:43: warning: left shift count >= width of type [-Wshift-count-overflow]
72 | #define _PAGE_PKEY_BIT3 (_AT(pteval_t, 1) << _PAGE_BIT_PKEY_BIT3)
| ^~
arch/x86/include/asm/tlbflush.h:378:45: note: in expansion of macro '_PAGE_PKEY_BIT3'
378 | _PAGE_PKEY_BIT2 | _PAGE_PKEY_BIT3 | _PAGE_NX;
| ^~~~~~~~~~~~~~~
arch/x86/include/asm/ia32.h: At top level:
>> arch/x86/include/asm/ia32.h:28:8: error: redefinition of 'struct stat64'
28 | struct stat64 {
| ^~~~~~
In file included from include/linux/stat.h:6,
from include/linux/sysfs.h:22,
from include/linux/kobject.h:20,
from include/linux/of.h:18,
from include/linux/clocksource.h:19:
arch/x86/include/uapi/asm/stat.h:42:8: note: originally defined here
42 | struct stat64 {
| ^~~~~~vim +28 arch/x86/include/asm/ia32.h
^1da177e4c3f415 include/asm-x86_64/ia32.h Linus Torvalds 2005-04-16 24
^1da177e4c3f415 include/asm-x86_64/ia32.h Linus Torvalds 2005-04-16 25 /* This matches struct stat64 in glibc2.2, hence the absolutely
^1da177e4c3f415 include/asm-x86_64/ia32.h Linus Torvalds 2005-04-16 26 * insane amounts of padding around dev_t's.
^1da177e4c3f415 include/asm-x86_64/ia32.h Linus Torvalds 2005-04-16 27 */
^1da177e4c3f415 include/asm-x86_64/ia32.h Linus Torvalds 2005-04-16 @28 struct stat64 {
^1da177e4c3f415 include/asm-x86_64/ia32.h Linus Torvalds 2005-04-16 29 unsigned long long st_dev;
^1da177e4c3f415 include/asm-x86_64/ia32.h Linus Torvalds 2005-04-16 30 unsigned char __pad0[4];^1da177e4c3f415 include/asm-x86_64/ia32.h Linus Torvalds 2005-04-16 31
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH resend v1 1/7] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized
In reply to Daniel Lezcanokernel test robot noticed the following build errors:
Hi Daniel,
kernel test robot noticed the following build errors:
[auto build test ERROR on tip/timers/core]
[also build test ERROR on rockchip/for-next arnd-asm-generic/master linus/master v7.0-rc5 next-20260327] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Daniel-Lezcano/clocksource-drivers-timer-probe-Create-a-platform_device-before-the-framework-is-initialized/20260328-080154 base: tip/timers/core patch link: https://lore.kernel.org/r/20260327180600.8150-2-daniel.lezcano%40kernel.org patch subject: [PATCH resend v1 1/7] clocksource/drivers/timer-probe: Create a platform_device before the framework is initialized config: x86_64-randconfig-013-20260328 (https://download.01.org/0day-ci/archive/20260328/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260328/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from arch/x86/include/asm/current.h:11,
from arch/x86/include/asm/processor.h:17,
from arch/x86/include/asm/timex.h:5,
from include/linux/timex.h:67,
from include/linux/time32.h:13,
from include/linux/time.h:60,
from arch/x86/entry/vdso/vdso32/../common/vclock_gettime.c:11,
from arch/x86/entry/vdso/vdso32/vclock_gettime.c:1:
arch/x86/include/asm/tlbflush.h: In function 'cpu_tlbstate_update_lam':
arch/x86/include/asm/tlbflush.h:468:46: warning: right shift count >= width of type [-Wshift-count-overflow]
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~
arch/x86/include/asm/percpu.h:145:69: note: in definition of macro '__raw_cpu_write'
145 | *(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val); \
| ^~~
include/linux/percpu-defs.h:369:25: note: in expansion of macro 'this_cpu_write_1'
369 | case 1: stem##1(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:500:41: note: in expansion of macro '__pcpu_size_call'
500 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:9: note: in expansion of macro 'this_cpu_write'
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:46: warning: right shift count >= width of type [-Wshift-count-overflow]
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~
arch/x86/include/asm/percpu.h:145:69: note: in definition of macro '__raw_cpu_write'
145 | *(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val); \
| ^~~
include/linux/percpu-defs.h:370:25: note: in expansion of macro 'this_cpu_write_2'
370 | case 2: stem##2(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:500:41: note: in expansion of macro '__pcpu_size_call'
500 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:9: note: in expansion of macro 'this_cpu_write'
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:46: warning: right shift count >= width of type [-Wshift-count-overflow]
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~
arch/x86/include/asm/percpu.h:145:69: note: in definition of macro '__raw_cpu_write'
145 | *(qual __my_cpu_type(pcp) * __force)__my_cpu_ptr(&(pcp)) = (val); \
| ^~~
include/linux/percpu-defs.h:371:25: note: in expansion of macro 'this_cpu_write_4'
371 | case 4: stem##4(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:500:41: note: in expansion of macro '__pcpu_size_call'
500 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:9: note: in expansion of macro 'this_cpu_write'
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~~~~~~~~~~~~~
In file included from arch/x86/include/asm/percpu.h:598:
arch/x86/include/asm/tlbflush.h:468:46: warning: right shift count >= width of type [-Wshift-count-overflow]
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~
include/asm-generic/percpu.h:87:33: note: in definition of macro 'raw_cpu_generic_to_op'
87 | *raw_cpu_ptr(&(pcp)) op val; \
| ^~~
include/asm-generic/percpu.h:412:41: note: in expansion of macro 'this_cpu_generic_to_op'
412 | #define this_cpu_write_8(pcp, val) this_cpu_generic_to_op(pcp, val, =)
| ^~~~~~~~~~~~~~~~~~~~~~
include/linux/percpu-defs.h:372:25: note: in expansion of macro 'this_cpu_write_8'
372 | case 8: stem##8(variable, __VA_ARGS__);break; \
| ^~~~
include/linux/percpu-defs.h:500:41: note: in expansion of macro '__pcpu_size_call'
500 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, pcp, val)
| ^~~~~~~~~~~~~~~~
arch/x86/include/asm/tlbflush.h:468:9: note: in expansion of macro 'this_cpu_write'
468 | this_cpu_write(cpu_tlbstate.lam, lam >> X86_CR3_LAM_U57_BIT);
| ^~~~~~~~~~~~~~
In file included from include/linux/kasan.h:38,
from include/linux/slab.h:264,
from include/linux/fs.h:45,
from include/linux/compat.h:17,
from arch/x86/include/asm/ia32.h:7,
from arch/x86/include/asm/elf.h:10,
from include/linux/elf.h:6,
from include/linux/module.h:20,
from include/linux/device/driver.h:21,
from include/linux/device.h:32,
from include/linux/platform_device.h:13,
from include/linux/clocksource.h:21,
from include/clocksource/hyperv_timer.h:16,
from arch/x86/include/asm/vdso/gettimeofday.h:20,
from include/vdso/datapage.h:196,
from arch/x86/include/uapi/../../../../lib/vdso/gettimeofday.c:6,
from arch/x86/entry/vdso/vdso32/../common/vclock_gettime.c:16:
include/linux/pgtable.h: At top level:
>> include/linux/pgtable.h:2204:2: error: #error Missing MAX_POSSIBLE_PHYSMEM_BITS definition
2204 | #error Missing MAX_POSSIBLE_PHYSMEM_BITS definition
| ^~~~~
arch/x86/include/asm/ia32.h:28:8: error: redefinition of 'struct stat64'
28 | struct stat64 {
| ^~~~~~
In file included from include/linux/stat.h:6,
from include/linux/sysfs.h:22,
from include/linux/kobject.h:20,
from include/linux/of.h:18,
from include/linux/clocksource.h:19:
arch/x86/include/uapi/asm/stat.h:42:8: note: originally defined here
42 | struct stat64 {
| ^~~~~~vim +2204 include/linux/pgtable.h
^1da177e4c3f41 include/asm-generic/pgtable.h Linus Torvalds 2005-04-16 2196 cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2197 #if !defined(MAX_POSSIBLE_PHYSMEM_BITS) && !defined(CONFIG_64BIT) cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2198 #ifdef CONFIG_PHYS_ADDR_T_64BIT cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2199 /* cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2200 * ZSMALLOC needs to know the highest PFN on 32-bit architectures cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2201 * with physical address space extension, but falls back to cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2202 * BITS_PER_LONG otherwise. cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2203 */ cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 @2204 #error Missing MAX_POSSIBLE_PHYSMEM_BITS definition cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2205 #else cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2206 #define MAX_POSSIBLE_PHYSMEM_BITS 32 cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2207 #endif cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2208 #endif cef397038167ac include/linux/pgtable.h Arnd Bergmann 2020-11-11 2209
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Daniel Lezcano
maintainerPATCH RESEND 2/7 clocksource/drivers/mmio: Make the code compatible with modules
In reply to Daniel LezcanoThe next changes will bring the module support on the timer drivers. Those use the API exported by the mmio clocksource which are not exporting their symbols. Fix that by adding EXPORT_SYMBOL_GPL().
--- drivers/clocksource/mmio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/clocksource/mmio.c +8 -3
@@ -21,21 +21,25 @@ u64 clocksource_mmio_readl_up(struct clocksource *c) {return (u64 )readl_relaxed (to_mmio_clksrc (c)->reg); } +EXPORT_SYMBOL_GPL (clocksource_mmio_readl_up);u64 clocksource_mmio_readl_down (struct clocksource *c) {return ~(u64 )readl_relaxed (to_mmio_clksrc (c)->reg) & c->mask; } +EXPORT_SYMBOL_GPL (clocksource_mmio_readl_down);u64 clocksource_mmio_readw_up (struct clocksource *c) {return (u64 )readw_relaxed (to_mmio_clksrc (c)->reg); } +EXPORT_SYMBOL_GPL (clocksource_mmio_readw_up);u64 clocksource_mmio_readw_down (struct clocksource *c) {return ~(u64 )readw_relaxed (to_mmio_clksrc (c)->reg) & c->mask; } +EXPORT_SYMBOL_GPL (clocksource_mmio_readw_down);/** * clocksource_mmio_init - Initialize a simple mmio based clocksource
@@ -46,9 +50,9 @@ u64 clocksource_mmio_readw_down(struct clocksource *c)* @bits: Number of valid bits * @read: One of clocksource_mmio_read*() above */ -int __init clocksource_mmio_init (void __iomem *base,const char *name, -unsigned long hz,int rating,unsigned bits, -u64 (*read)(struct clocksource *)) +int clocksource_mmio_init (void __iomem *base,const char *name, +unsigned long hz,int rating,unsigned bits, +u64 (*read)(struct clocksource *)) {struct clocksource_mmio *cs;
@@ -68,3 +72,4 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name,return clocksource_register_hz (&cs->clksrc, hz); } +EXPORT_SYMBOL_GPL (clocksource_mmio_init);
Signature · 1 line
2.43.0
Re: [PATCH resend v1 2/7] clocksource/drivers/mmio: Make the code compatible with modules
Quoted 6 lines · Daniel Lezcano
The next changes will bring the module support on the timer drivers. Those use the API exported by the mmio clocksource which are not exporting their symbols. Fix that by adding
EXPORT_SYMBOL_GPL().Signed-off-by Daniel Lezcano <[email protected]>
[tip: timers/clocksource] clocksource/drivers/mmio: Make the code compatible with modules
In reply to Daniel LezcanoThe following commit has been merged into the timers/clocksource branch of tip:
The following commit has been merged into the timers/clocksource branch of tip:
Commit-ID: 2423405880c2cd5473c8c4e937e8253b7444f532 Gitweb: https://git.kernel.org/tip/2423405880c2cd5473c8c4e937e8253b7444f532 Author: Daniel Lezcano <[email protected]> AuthorDate: Fri, 27 Mar 2026 19:05:54 +01:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Fri, 03 Apr 2026 10:52:05 +02:00
clocksource/drivers/mmio: Make the code compatible with modules
The next changes will bring the module support on the timer drivers. Those use the API exported by the mmio clocksource which are not exporting their symbols. Fix that by adding EXPORT_SYMBOL_GPL().
--- drivers/clocksource/mmio.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/clocksource/mmio.c +8 -3
@@ -21,21 +21,25 @@ u64 clocksource_mmio_readl_up(struct clocksource *c) {return (u64 )readl_relaxed (to_mmio_clksrc (c)->reg); } +EXPORT_SYMBOL_GPL (clocksource_mmio_readl_up);u64 clocksource_mmio_readl_down (struct clocksource *c) {return ~(u64 )readl_relaxed (to_mmio_clksrc (c)->reg) & c->mask; } +EXPORT_SYMBOL_GPL (clocksource_mmio_readl_down);u64 clocksource_mmio_readw_up (struct clocksource *c) {return (u64 )readw_relaxed (to_mmio_clksrc (c)->reg); } +EXPORT_SYMBOL_GPL (clocksource_mmio_readw_up);u64 clocksource_mmio_readw_down (struct clocksource *c) {return ~(u64 )readw_relaxed (to_mmio_clksrc (c)->reg) & c->mask; } +EXPORT_SYMBOL_GPL (clocksource_mmio_readw_down);/** * clocksource_mmio_init - Initialize a simple mmio based clocksource
@@ -46,9 +50,9 @@ u64 clocksource_mmio_readw_down(struct clocksource *c)* @bits: Number of valid bits * @read: One of clocksource_mmio_read*() above */ -int __init clocksource_mmio_init (void __iomem *base,const char *name, -unsigned long hz,int rating,unsigned bits, -u64 (*read)(struct clocksource *)) +int clocksource_mmio_init (void __iomem *base,const char *name, +unsigned long hz,int rating,unsigned bits, +u64 (*read)(struct clocksource *)) {struct clocksource_mmio *cs;
@@ -68,3 +72,4 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name,return clocksource_register_hz (&cs->clksrc, hz); } +EXPORT_SYMBOL_GPL (clocksource_mmio_init);
Daniel Lezcano
maintainerPATCH RESEND 3/7 clocksource/drivers/timer-of: Make the code compatible with modules
In reply to Daniel Lezcano--- drivers/clocksource/timer-of.c | 24 +++++++++++++----------- drivers/clocksource/timer-of.h | 5 ++--- 2 files changed, 15 insertions(+), 14 deletions(-)
drivers/clocksource/timer-of.c +13 -11
@@ -19,7 +19,7 @@* * Free the irq resource */ -static __init void timer_of_irq_exit (struct of_timer_irq *of_irq) +static void timer_of_irq_exit (struct of_timer_irq *of_irq) { struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -41,8 +41,8 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)* * Returns 0 on success, < 0 otherwise */ -static __init int timer_of_irq_init (struct device_node *np, -struct of_timer_irq *of_irq) +static int timer_of_irq_init (struct device_node *np, +struct of_timer_irq *of_irq) {int ret; struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -82,7 +82,7 @@ static __init int timer_of_irq_init(struct device_node *np,* * Disables and releases the refcount on the clk */ -static __init void timer_of_clk_exit (struct of_timer_clk *of_clk) +static void timer_of_clk_exit (struct of_timer_clk *of_clk) { of_clk->rate =0 ;clk_disable_unprepare (of_clk->clk);
@@ -98,8 +98,8 @@ static __init void timer_of_clk_exit(struct of_timer_clk *of_clk)* * Returns 0 on success, < 0 otherwise */ -static __init int timer_of_clk_init (struct device_node *np, -struct of_timer_clk *of_clk) +static int timer_of_clk_init (struct device_node *np, +struct of_timer_clk *of_clk) {int ret;
@@ -137,13 +137,13 @@ static __init int timer_of_clk_init(struct device_node *np, goto out; } -static __init void timer_of_base_exit (struct of_timer_base *of_base) +static void timer_of_base_exit (struct of_timer_base *of_base) {iounmap (of_base->base); } -static __init int timer_of_base_init (struct device_node *np, -struct of_timer_base *of_base) +static int timer_of_base_init (struct device_node *np, +struct of_timer_base *of_base) { of_base->base = of_base->name ? of_io_request_and_map(np, of_base->index, of_base->name) :
@@ -156,7 +156,7 @@ static __init int timer_of_base_init(struct device_node *np,return 0 ; } -int __init timer_of_init (struct device_node *np,struct timer_of *to) +int timer_of_init (struct device_node *np,struct timer_of *to) {int ret = -EINVAL ;int flags =0 ;
@@ -200,6 +200,7 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)timer_of_base_exit (&to->of_base);return ret; } +EXPORT_SYMBOL_GPL (timer_of_init);/** * timer_of_cleanup - release timer_of resources
@@ -208,7 +209,7 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)* Release the resources that has been used in timer_of_init(). * This function should be called in init error cases */ -void __init timer_of_cleanup (struct timer_of *to) +void timer_of_cleanup (struct timer_of *to) {if (to->flags &TIMER_OF_IRQ )timer_of_irq_exit (&to->of_irq);
@@ -219,3 +220,4 @@ void __init timer_of_cleanup(struct timer_of *to)if (to->flags &TIMER_OF_BASE )timer_of_base_exit (&to->of_base); } +EXPORT_SYMBOL_GPL (timer_of_cleanup);
drivers/clocksource/timer-of.h +2 -3
@@ -65,9 +65,8 @@ static inline unsigned long timer_of_period(struct timer_of *to) return to->of_clk.period; } -extern int __init timer_of_init (struct device_node *np, -struct timer_of *to); +int timer_of_init (struct device_node *np,struct timer_of *to); -extern void __init timer_of_cleanup (struct timer_of *to); +void timer_of_cleanup (struct timer_of *to);#endif
Signature · 1 line
2.43.0
[tip: timers/clocksource] clocksource/drivers/timer-of: Make the code compatible with modules
The following commit has been merged into the timers/clocksource branch of tip:
The following commit has been merged into the timers/clocksource branch of tip:
Commit-ID: 68ed094971b09ba530baf6f75cf1902df880a8d1 Gitweb: https://git.kernel.org/tip/68ed094971b09ba530baf6f75cf1902df880a8d1 Author: Daniel Lezcano <[email protected]> AuthorDate: Fri, 27 Mar 2026 19:05:55 +01:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Fri, 03 Apr 2026 10:53:29 +02:00
clocksource/drivers/timer-of: Make the code compatible with modules
The next changes will bring the module support on the timer drivers. Those use the API exported by the timer-of which are not exporting their symbols. Fix that by adding EXPORT_SYMBOL_GPL().
--- drivers/clocksource/timer-of.c | 24 +++++++++++++----------- drivers/clocksource/timer-of.h | 5 ++--- 2 files changed, 15 insertions(+), 14 deletions(-)
drivers/clocksource/timer-of.c +13 -11
@@ -19,7 +19,7 @@* * Free the irq resource */ -static __init void timer_of_irq_exit (struct of_timer_irq *of_irq) +static void timer_of_irq_exit (struct of_timer_irq *of_irq) { struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -41,8 +41,8 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)* * Returns 0 on success, < 0 otherwise */ -static __init int timer_of_irq_init (struct device_node *np, -struct of_timer_irq *of_irq) +static int timer_of_irq_init (struct device_node *np, +struct of_timer_irq *of_irq) {int ret; struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -82,7 +82,7 @@ static __init int timer_of_irq_init(struct device_node *np,* * Disables and releases the refcount on the clk */ -static __init void timer_of_clk_exit (struct of_timer_clk *of_clk) +static void timer_of_clk_exit (struct of_timer_clk *of_clk) { of_clk->rate =0 ;clk_disable_unprepare (of_clk->clk);
@@ -98,8 +98,8 @@ static __init void timer_of_clk_exit(struct of_timer_clk *of_clk)* * Returns 0 on success, < 0 otherwise */ -static __init int timer_of_clk_init (struct device_node *np, -struct of_timer_clk *of_clk) +static int timer_of_clk_init (struct device_node *np, +struct of_timer_clk *of_clk) {int ret;
@@ -137,13 +137,13 @@ out_clk_put: goto out; } -static __init void timer_of_base_exit (struct of_timer_base *of_base) +static void timer_of_base_exit (struct of_timer_base *of_base) {iounmap (of_base->base); } -static __init int timer_of_base_init (struct device_node *np, -struct of_timer_base *of_base) +static int timer_of_base_init (struct device_node *np, +struct of_timer_base *of_base) { of_base->base = of_base->name ? of_io_request_and_map(np, of_base->index, of_base->name) :
@@ -156,7 +156,7 @@ static __init int timer_of_base_init(struct device_node *np,return 0 ; } -int __init timer_of_init (struct device_node *np,struct timer_of *to) +int timer_of_init (struct device_node *np,struct timer_of *to) {int ret = -EINVAL ;int flags =0 ;
@@ -200,6 +200,7 @@ out_fail:timer_of_base_exit (&to->of_base);return ret; } +EXPORT_SYMBOL_GPL (timer_of_init);/** * timer_of_cleanup - release timer_of resources
@@ -208,7 +209,7 @@ out_fail:* Release the resources that has been used in timer_of_init(). * This function should be called in init error cases */ -void __init timer_of_cleanup (struct timer_of *to) +void timer_of_cleanup (struct timer_of *to) {if (to->flags &TIMER_OF_IRQ )timer_of_irq_exit (&to->of_irq);
@@ -219,3 +220,4 @@ void __init timer_of_cleanup(struct timer_of *to)if (to->flags &TIMER_OF_BASE )timer_of_base_exit (&to->of_base); } +EXPORT_SYMBOL_GPL (timer_of_cleanup);
drivers/clocksource/timer-of.h +2 -3
@@ -65,9 +65,8 @@ static inline unsigned long timer_of_period(struct timer_of *to) return to->of_clk.period; } -extern int __init timer_of_init (struct device_node *np, -struct timer_of *to); +int timer_of_init (struct device_node *np,struct timer_of *to); -extern void __init timer_of_cleanup (struct timer_of *to); +void timer_of_cleanup (struct timer_of *to);#endif
Daniel Lezcano
maintainerPATCH RESEND 4/7 clocksource/drivers/timer-probe: Add the module support for the TIMER_PDEV_DECLARE() macro
In reply to Daniel LezcanoA driver using the macro TIMER_PDEV_DECLARE can now be compiled as a module. When it is the case the TIMER_PDEV_DECLARE() macro will add module_platform_driver() and MODULE_DEVICE_TABLE() automatically.
However if the early timer initialization is needed in place of the module init section like what we have now, we should enable CONFIG_EARLY_TIMER.
When all drivers will be converted to TIMER_PDEV_DECLARE(), the TIMER_OF_DECLARE() can be removed and we will end up with the following configuration:
* On ARM architecture, we enable automatically CONFIG_EARLY_TIMER, no timer can be compiled as a module
* On ARM64 architecture, we can enable as a module, otherwise it will be compiled-in. The CONFIG_EARLY_TIMER is not needed on this arch because the architected timers are always present
* On other architecture, that needs to be defined but I suspect we have the same scheme
--- drivers/clocksource/Kconfig | 7 ++++++- drivers/clocksource/timer-probe.c | 3 +++ include/linux/clocksource.h | 12 +++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-)
drivers/clocksource/Kconfig +6 -1
@@ -2,6 +2,11 @@ menu "Clock Source drivers" depends on GENERIC_CLOCKEVENTS +config EARLY_TIMER + bool "Early driver initialization" + help + Enables early timer driver loading + config TIMER_OF bool select TIMER_PROBE
@@ -100,7 +105,7 @@ config IXP4XX_TIMER Enables support for the Intel XScale IXP4xx SoC timer. config ROCKCHIP_TIMER - bool "Rockchip timer driver" if COMPILE_TEST + bool "Rockchip timer driver" if COMPILE_TEST depends on ARM || ARM64 select TIMER_OF select CLKSRC_MMIO
drivers/clocksource/timer-probe.c +3 -0
@@ -84,6 +84,9 @@ static int __init timer_pdev_probe(void) {struct platform_driver **drv; +if (!IS_ENABLED (CONFIG_EARLY_TIMER )) +return 0 ; +for_each_pdev_timer_table (drv)__timer_pdev_probe (*drv);
include/linux/clocksource.h +11 -1
@@ -299,7 +299,7 @@ static inline void timer_probe(void) {}extern struct platform_driver *__pdev_timer_table[];extern struct platform_driver *__pdev_timer_table_end[]; -#define TIMER_PDEV_DECLARE (__name, __probe, __remove, __match) \ +#define __TIMER_PDEV_DECLARE (__name, __probe, __remove, __match) \ static struct platform_driver __pdev_timer_table_entry_##__name = { \ .probe = __probe, \ .remove = __remove, \
@@ -311,6 +311,16 @@ extern struct platform_driver *__pdev_timer_table_end[]; static struct platform_driver *___pdev_timer_table_entry_##__name \ __used __section("__pdev_timer_table") = &__pdev_timer_table_entry_##__name +#if !defined(CONFIG_EARLY_TIMER ) || defined(MODULE ) +#define TIMER_PDEV_DECLARE (__name, __probe, __remove, __match) \ + MODULE_DEVICE_TABLE(of, __match); \ + __TIMER_PDEV_DECLARE(__name, __probe, __remove, __match); \ + module_platform_driver(__pdev_timer_table_entry_##__name); +#else +#define TIMER_PDEV_DECLARE (__name, __probe, __remove, __match) \ + __TIMER_PDEV_DECLARE(__name, __probe, __remove, __match) +#endif +#define for_each_pdev_timer_table (__pdev) \ for (__pdev = __pdev_timer_table; \ __pdev < __pdev_timer_table_end; \
Signature · 1 line
2.43.0
Daniel Lezcano
maintainerPATCH RESEND 5/7 clocksource/drivers/rockchip: Use the TIMER_PDEV_DECLARE() macro
In reply to Daniel LezcanoThe previous changes introduced the TIMER_PDEV_DECLARE() macro which allows to use the platform driver to initialize a timer driver with the benefit of having the devres to rollback automatically in case of error.
Use this macro and change the function to rely on the devm_ variants, allowing to cleanup the code.
--- drivers/clocksource/timer-rockchip.c | 99 ++++++++++------------------ 1 file changed, 34 insertions(+), 65 deletions(-)
drivers/clocksource/timer-rockchip.c +34 -65
@@ -124,18 +124,18 @@ static u64 notrace rk_timer_sched_read(void)return ~readl_relaxed (rk_clksrc->base +TIMER_CURRENT_VALUE0 ); } -static int __init -rk_timer_probe (struct rk_timer *timer,struct device_node *np) +static int rk_timer_init (struct rk_timer *timer,struct device *dev) { +struct device_node *np = dev->of_node;struct clk *timer_clk;struct clk *pclk; -int ret = -EINVAL , irq; +int irq;u32 ctrl_reg =TIMER_CONTROL_REG3288 ; - timer->base =of_iomap (np,0 ); -if (!timer->base) { + timer->base =devm_of_iomap (dev, np,0 ,NULL ); +if (IS_ERR (timer->base)) {pr_err ("Failed to get base address for '%s'\n" ,TIMER_NAME ); -return -ENXIO ; +return PTR_ERR (timer->base); }if (of_device_is_compatible (np,"rockchip,rk3399-timer" ))
@@ -143,31 +143,17 @@ rk_timer_probe(struct rk_timer *timer, struct device_node *np) timer->ctrl = timer->base + ctrl_reg; - pclk =of_clk_get_by_name (np,"pclk" ); + pclk =devm_clk_get_enabled (dev,"pclk" );if (IS_ERR (pclk)) { - ret =PTR_ERR (pclk);pr_err ("Failed to get pclk for '%s'\n" ,TIMER_NAME ); - goto out_unmap; - } - - ret =clk_prepare_enable (pclk); -if (ret) { -pr_err ("Failed to enable pclk for '%s'\n" ,TIMER_NAME ); - goto out_unmap; +return PTR_ERR (pclk); } timer->pclk = pclk; - timer_clk =of_clk_get_by_name (np,"timer" ); + timer_clk =devm_clk_get_enabled (dev,"timer" );if (IS_ERR (timer_clk)) { - ret =PTR_ERR (timer_clk);pr_err ("Failed to get timer clock for '%s'\n" ,TIMER_NAME ); - goto out_timer_clk; - } - - ret =clk_prepare_enable (timer_clk); -if (ret) { -pr_err ("Failed to enable timer clock\n" ); - goto out_timer_clk; +return PTR_ERR (timer_clk); } timer->clk = timer_clk;
@@ -175,47 +161,32 @@ rk_timer_probe(struct rk_timer *timer, struct device_node *np) irq =irq_of_parse_and_map (np,0 );if (!irq) { - ret = -EINVAL ;pr_err ("Failed to map interrupts for '%s'\n" ,TIMER_NAME ); - goto out_irq; +return -EINVAL ; } timer->irq = irq;rk_timer_interrupt_clear (timer);rk_timer_disable (timer); -return 0 ; - -out_irq: -clk_disable_unprepare (timer_clk); -out_timer_clk: -clk_disable_unprepare (pclk); -out_unmap: -iounmap (timer->base); - -return ret; -} -static void __init rk_timer_cleanup (struct rk_timer *timer) -{ -clk_disable_unprepare (timer->clk); -clk_disable_unprepare (timer->pclk); -iounmap (timer->base); +return 0 ; } -static int __init rk_clkevt_init (struct device_node *np) +static int rk_clkevt_init (struct platform_device *pdev) { +struct device *dev = &pdev->dev;struct clock_event_device *ce;int ret = -EINVAL ; - rk_clkevt = kzalloc_obj(struct rk_clkevt); + rk_clkevt =devm_kzalloc (dev,sizeof (*rk_clkevt),GFP_KERNEL );if (!rk_clkevt) { ret = -ENOMEM ; goto out; } - ret =rk_timer_probe (&rk_clkevt->timer, np); + ret =rk_timer_init (&rk_clkevt->timer, dev);if (ret) - goto out_probe; + goto out; ce = &rk_clkevt->ce; ce->name =TIMER_NAME ;
@@ -233,36 +204,33 @@ static int __init rk_clkevt_init(struct device_node *np)if (ret) {pr_err ("Failed to initialize '%s': %d\n" ,TIMER_NAME , ret); - goto out_irq; + goto out; }clockevents_config_and_register (&rk_clkevt->ce, rk_clkevt->timer.freq,1 ,UINT_MAX );return 0 ; -out_irq: -rk_timer_cleanup (&rk_clkevt->timer); -out_probe: -kfree (rk_clkevt); out:/* Leave rk_clkevt not NULL to prevent future init */ rk_clkevt =ERR_PTR (ret);return ret; } -static int __init rk_clksrc_init (struct device_node *np) +static int rk_clksrc_init (struct platform_device *pdev) { +struct device *dev = &pdev->dev;int ret = -EINVAL ; - rk_clksrc = kzalloc_obj(struct rk_timer); + rk_clksrc =devm_kzalloc (dev,sizeof (*rk_clksrc),GFP_KERNEL );if (!rk_clksrc) { ret = -ENOMEM ; goto out; } - ret =rk_timer_probe (rk_clksrc, np); + ret =rk_timer_init (rk_clksrc, dev);if (ret) - goto out_probe; + goto out;rk_timer_update_counter (UINT_MAX , rk_clksrc);rk_timer_enable (rk_clksrc,0 );
@@ -272,33 +240,34 @@ static int __init rk_clksrc_init(struct device_node *np) clocksource_mmio_readl_down);if (ret) {pr_err ("Failed to register clocksource\n" ); - goto out_clocksource; + goto out; }sched_clock_register (rk_timer_sched_read,32 , rk_clksrc->freq);return 0 ; -out_clocksource: -rk_timer_cleanup (rk_clksrc); -out_probe: -kfree (rk_clksrc); out:/* Leave rk_clksrc not NULL to prevent future init */ rk_clksrc =ERR_PTR (ret);return ret; } -static int __init rk_timer_init (struct device_node *np) +static int rk_timer_probe (struct platform_device *pdev) {if (!rk_clkevt) -return rk_clkevt_init (np); +return rk_clkevt_init (pdev);if (!rk_clksrc) -return rk_clksrc_init (np); +return rk_clksrc_init (pdev);pr_err ("Too many timer definitions for '%s'\n" ,TIMER_NAME );return -EINVAL ; } -TIMER_OF_DECLARE (rk3288_timer,"rockchip,rk3288-timer" , rk_timer_init); -TIMER_OF_DECLARE (rk3399_timer,"rockchip,rk3399-timer" , rk_timer_init); +static const struct of_device_id rk_timer_match_table[] = { + { .compatible ="rockchip,rk3288-timer" }, + { .compatible ="rockchip,rk3399-timer" }, + {/* sentinel */ } +}; + +TIMER_PDEV_DECLARE (rk_timer, rk_timer_probe,NULL , rk_timer_match_table);
Signature · 1 line
2.43.0
Daniel Lezcano
maintainerPATCH RESEND 6/7 clocksource/drivers/rockchip: Add rockchip timer module support
In reply to Daniel LezcanoNow the TIMER_PDEV_DECLARE() allows the driver to be compiled as a module. Add the MODULE_DESCRIPTION and the MODULE_LICENSE left for the one converting the driver as a module.
--- drivers/clocksource/timer-rockchip.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clocksource/timer-rockchip.c +2 -0
@@ -271,3 +271,5 @@ static const struct of_device_id rk_timer_match_table[] = { };TIMER_PDEV_DECLARE (rk_timer, rk_timer_probe,NULL , rk_timer_match_table); +MODULE_DESCRIPTION ("Rockchip timer driver" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
2.43.0
Daniel Lezcano
maintainerPATCH RESEND 7/7 clocksource/drivers/mediatek: Convert to module support
In reply to Daniel LezcanoNow the TIMER_PDEV_DECLARE() allows the driver to be compiled as a module. Add the MODULE_DESCRIPTION and the MODULE_LICENSE left for the one converting the driver as a module.
--- drivers/clocksource/timer-mediatek.c | 29 ++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)
drivers/clocksource/timer-mediatek.c +23 -6
@@ -215,8 +215,7 @@ static irqreturn_t mtk_gpt_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -static void -__init mtk_gpt_setup (struct timer_of *to,u8 timer,u8 option) +static void mtk_gpt_setup (struct timer_of *to,u8 timer,u8 option) {writel (GPT_CTRL_CLEAR |GPT_CTRL_DISABLE ,timer_of_base (to) +GPT_CTRL_REG (timer));
@@ -281,7 +280,7 @@ static struct timer_of to = { }, }; -static int __init mtk_syst_init (struct device_node *node) +static int mtk_syst_init (struct device_node *node) {int ret;
@@ -302,7 +301,7 @@ static int __init mtk_syst_init(struct device_node *node)return 0 ; } -static int __init mtk_gpt_init (struct device_node *node) +static int mtk_gpt_init (struct device_node *node) {int ret;
@@ -337,5 +336,23 @@ static int __init mtk_gpt_init(struct device_node *node)return 0 ; } -TIMER_OF_DECLARE (mtk_mt6577,"mediatek,mt6577-timer" , mtk_gpt_init); -TIMER_OF_DECLARE (mtk_mt6765,"mediatek,mt6765-timer" , mtk_syst_init); + +static int mtk_timer_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +int (*probe_func)(struct device_node *node); + + probe_func =of_device_get_match_data (&pdev->dev); + +return probe_func (np); +} + +static const struct of_device_id mtk_timer_match_table[] = { + { .compatible ="mediatek,mt6577-timer" , .data = mtk_gpt_init }, + { .compatible ="mediatek,mt6765-timer" , .data = mtk_syst_init }, + {/* sentinel */ } +}; + +TIMER_PDEV_DECLARE (mtk_timer, mtk_timer_probe,NULL , mtk_timer_match_table); +MODULE_DESCRIPTION ("Mediatek timer driver" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
2.43.0
Quoted 95 lines
-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: 2026年3月28日 2:06
To: [email protected]; [email protected]; Zhipeng Wang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Matthias Brugger <[email protected]>; AngeloGioacchino Del Regno <[email protected]>; moderated list:ARM/Mediatek SoC support <[email protected]>; moderated list:ARM/Mediatek SoC support <[email protected]>
Subject: [EXT] [PATCH v1 resend 0/7] Timer driver module support[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
Converting the timer driver modules requires a particular care because, depending on the platform, that may be not supported.
A previous study showed we are safe regarding how the module refcount is held and if
THIS_MODULEis set for the clockevent and the clocksource when they are registered.It won't be possible to unload a module if a clockevent is registered.
It will be possible to unload a module if only a clocksource is registered and it is not the current one.
However platforms without architected timers may need the timer driver to be initialized very early and others can be initialized later. The former can not be a module and the init function receives a
device_nodepointer, there is no device associated and devres is not used. That results in a lot of rollbacking code where usually it is where we find bug and resource leaks. The latter can be converted to a module and uses amodule_platform_driver(), thus the init function is a probe function receiving a structplatform_devicepointer parameter.We end up with two approaches and duplicate code for the init functions. This is not optimal.
Finally, we have the driver having to be initialized very early on some platforms and be built as a module on other platforms, resulting on having two init functions co-existing in the same driver.
This series provides what is needed to move to the same probe function for early init, builtin and module timers.
A new macro is introduced:
TIMER_PDEV_DECLARE()and a newKconfigoption is addedCONFIG_EARLY_TIMER.TIMER_PDEV_DECLARE()will have different behavior depending on the context:- The driver is a module and
CONFIG_EARLY_TIMER=no--> the driver is a module- The driver is builtin and
CONFIG_EARLY_TIMER=no--> the driver is loaded later- The driver is builtin or a module but
CONFIG_EARLY_TIMER=yes--> the driver is initialized through the timer-probe functionThe different timer driver framework functions have their
__initsections removed and the symbols exported in order to be compatible with the drivers converted into modules.The series provides a couple of drivers changed. The Mediatek as a recent requested target which is only compiled-tested. The Rockchip timer which was tested on a rk3588 in the three different configurations.
Daniel Lezcano (7):
clocksource/drivers/timer-probe: Create aplatform_devicebefore the
framework is initialized
drivers/clocksource/rockchip: Use theTIMER_PDEV_DECLARE()macro clocksource/drivers/mmio: Make the code compatible with modules clocksource/drivers/timer-of: Make the code compatible with modules clocksource/drivers/timer-probe: Add the module support for the
TIMER_PDEV_DECLARE()macro
clocksource/drivers/rockchip: Add rockchip timer module support clocksource/drivers/mediatek: Convert to module supportdrivers/clocksource/Kconfig | 7 +- drivers/clocksource/mmio.c | 11 ++- drivers/clocksource/timer-mediatek.c | 29 ++++++-- drivers/clocksource/timer-of.c | 24 ++++--- drivers/clocksource/timer-of.h | 5 +- drivers/clocksource/timer-probe.c | 69 ++++++++++++++++-- drivers/clocksource/timer-rockchip.c | 101 ++++++++++----------------- include/asm-generic/vmlinux.lds.h | 10 +++ include/linux/clocksource.h | 31 ++++++++ 9 files changed, 194 insertions(+), 93 deletions(-)
Quoted 2 lines
--
2.43.0
Hi Daniel,
Apologies for the delayed response. Thank you for working on the timer driver module support series. I've tested your patches on i.MX platforms and they work well with the TPM
timer driver.
Based on your framework, I've converted the i.MX TPM timer driver to use TIMER_PDEV_DECLARE. The driver has been tested on:
- i.MX7ULP (ARM, no alternative timer): built-in with CONFIG_EARLY_TIMER=y
- i.MX8ULP (ARM64, has ARM Generic Timer): built-in, module, and CONFIG_EARLY_TIMER=y configurations
All test cases passed without issues.
I'm attaching the patch below:
Author: Zhipeng Wang <[email protected]> Date: Thu Apr 2 15:46:53 2026 +0900
clocksource/drivers/imx-tpm: Convert to TIMER_PDEV_DECLARE and improve resource management
Convert the i.MX TPM timer driver from TIMER_OF_DECLARE to TIMER_PDEV_DECLARE to support both early initialization and platform device probing, aligning with the timer driver modernization effort.
This driver is used on two different platforms with the same hardware:
- ARM platforms (i.MX7ULP) without alternative timers require early initialization for delay_timer and sched_clock
- ARM64 platforms (i.MX8ULP) with ARM Generic Timer can use TPM as a backup timer with deferred initialization
Key changes:
1. Replace TIMER_OF_DECLARE with TIMER_PDEV_DECLARE to enable flexible initialization based on platform requirements
2. Convert tpm_timer_init() to tpm_timer_probe() with platform device parameter for proper device model integration
3. Use devm_clk_get_enabled() for ipg clock management instead of manual clk_prepare_enable/clk_put, fixing potential resource leaks in error paths
4. Remove __init annotations from tpm_clocksource_init() and tpm_clockevent_init() to support deferred probing
5. Add proper of_device_id table for device matching
Tested on i.MX7ULP (ARM) and i.MX8ULP (ARM64) platforms.
drivers/clocksource/Kconfig +2 -1
@@ -618,8 +618,9 @@ config CLKSRC_IMX_GPT select CLKSRC_MMIO config CLKSRC_IMX_TPM - bool "Clocksource using i.MX TPM" if COMPILE_TEST + tristate "Clocksource using i.MX TPM" depends on (ARM || ARM64) && HAVE_CLK + default ARCH_MXC select CLKSRC_MMIO select TIMER_OF help
drivers/clocksource/timer-imx-tpm.c +25 -16
72 lines not on this page · raw message
BRs,
Zhipeng
Hi Zhipeng,
Quoted 1 line · Zhipeng Wang
[ ... ]
Quoted 7 lines
Quoted 1 line
2.43.0
Hi Daniel,
Apologies for the delayed response. Thank you for working on the timer driver module support series. I've tested your patches on i.MX platforms and they work well with the TPM
timer driver.
Quoted 7 lines
Based on your framework, I've converted the i.MX TPM timer driver to use
TIMER_PDEV_DECLARE. The driver has been tested on:
- i.MX7ULP (ARM, no alternative timer): built-in withCONFIG_EARLY_TIMER=y
- i.MX8ULP (ARM64, has ARM Generic Timer): built-in, module, andCONFIG_EARLY_TIMER=yconfigurationsAll test cases passed without issues.
thanks for testing
I'll apply patch 2 and 3 and send a v2 for the next release and wait for more comments.
-- Daniel
[ ... ]