[tip: timers/vdso] MIPS: csrc-r4k: Only use VDSO_CLOCKMODE_R4K when it is a available

tip-bot2 for Thomas Weißschuh posted 1 patch 3 days, 15 hours ago
arch/mips/kernel/csrc-r4k.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[tip: timers/vdso] MIPS: csrc-r4k: Only use VDSO_CLOCKMODE_R4K when it is a available
Posted by tip-bot2 for Thomas Weißschuh 3 days, 15 hours ago
The following commit has been merged into the timers/vdso branch of tip:

Commit-ID:     0ebac10c9f1020963dd803f871a9b413979c76b8
Gitweb:        https://git.kernel.org/tip/0ebac10c9f1020963dd803f871a9b413979c76b8
Author:        Thomas Weißschuh <thomas.weissschuh@linutronix.de>
AuthorDate:    Thu, 21 May 2026 08:53:19 +02:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Thu, 04 Jun 2026 18:22:46 +02:00

MIPS: csrc-r4k: Only use VDSO_CLOCKMODE_R4K when it is a available

VDSO_CLOCKMODE_R4K is only defined if CONFIG_GENERIC_GETTIMEOFDAY is
enabled. Right now this is always the case, but it will change soon.

Prepare for the potential unavailability of VDSO_CLOCKMODE_R4K.

[ tglx: Replace #ifdeffery ]

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-5-2f79dcd6c78f@linutronix.de
---
 arch/mips/kernel/csrc-r4k.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
index 59eca39..5ce95e1 100644
--- a/arch/mips/kernel/csrc-r4k.c
+++ b/arch/mips/kernel/csrc-r4k.c
@@ -130,7 +130,8 @@ int __init init_r4k_clocksource(void)
 	 * R2 onwards makes the count accessible to user mode so it can be used
 	 * by the VDSO (HWREna is configured by configure_hwrena()).
 	 */
-	if (cpu_has_mips_r2_r6 && rdhwr_count_usable())
+	if (IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) &&
+	    cpu_has_mips_r2_r6 && rdhwr_count_usable())
 		clocksource_mips.vdso_clock_mode = VDSO_CLOCKMODE_R4K;
 
 	clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
Re: [tip: timers/vdso] MIPS: csrc-r4k: Only use VDSO_CLOCKMODE_R4K when it is a available
Posted by Thomas Weißschuh 2 days, 23 hours ago
On Thu, Jun 04, 2026 at 04:24:53PM +0000, tip-bot2 for Thomas Weißschuh wrote:
> The following commit has been merged into the timers/vdso branch of tip:
> 
> Commit-ID:     0ebac10c9f1020963dd803f871a9b413979c76b8
> Gitweb:        https://git.kernel.org/tip/0ebac10c9f1020963dd803f871a9b413979c76b8
> Author:        Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> AuthorDate:    Thu, 21 May 2026 08:53:19 +02:00
> Committer:     Thomas Gleixner <tglx@kernel.org>
> CommitterDate: Thu, 04 Jun 2026 18:22:46 +02:00
> 
> MIPS: csrc-r4k: Only use VDSO_CLOCKMODE_R4K when it is a available
> 
> VDSO_CLOCKMODE_R4K is only defined if CONFIG_GENERIC_GETTIMEOFDAY is
> enabled. Right now this is always the case, but it will change soon.
> 
> Prepare for the potential unavailability of VDSO_CLOCKMODE_R4K.
> 
> [ tglx: Replace #ifdeffery ]

Right now the #ifdeffery is necessary:

arch/mips/kernel/csrc-r4k.c:135:38: error: use of undeclared identifier 'VDSO_CLOCKMODE_R4K'; did you mean 'VDSO_CLOCKMODE_MAX'?
  135 |                 clocksource_mips.vdso_clock_mode = VDSO_CLOCKMODE_R4K;
      |                                                    ^~~~~~~~~~~~~~~~~~
      |                                                    VDSO_CLOCKMODE_MAX
include/vdso/clocksource.h:16:2: note: 'VDSO_CLOCKMODE_MAX' declared here
   16 |         VDSO_CLOCKMODE_MAX,
      |         ^


We could do something like this to avoid it:

+++ b/include/asm-generic/Kbuild
@@ -61,6 +61,7 @@ mandatory-y += topology.h
 mandatory-y += trace_clock.h
 mandatory-y += uaccess.h
 mandatory-y += unwind_user.h
+mandatory-y += vdso/clocksource.h
 mandatory-y += vermagic.h
 mandatory-y += vga.h
 mandatory-y += video.h
diff --git a/include/asm-generic/vdso/clocksource.h b/include/asm-generic/vdso/clocksource.h
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/include/vdso/clocksource.h b/include/vdso/clocksource.h
index c682e7c60273..830ca619261e 100644
--- a/include/vdso/clocksource.h
+++ b/include/vdso/clocksource.h
@@ -4,9 +4,11 @@
 
 #include <vdso/limits.h>
 
-#ifdef CONFIG_GENERIC_GETTIMEOFDAY
 #include <asm/vdso/clocksource.h>
-#endif /* CONFIG_GENERIC_GETTIMEOFDAY */
+
+#ifdef VDSO_ARCH_CLOCKMODES
+extern int VDSO_ARCH_CLOCKMODES;
+#endif
 
 enum vdso_clock_mode {
        VDSO_CLOCKMODE_NONE,

> 
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> Signed-off-by: Thomas Gleixner <tglx@kernel.org>
> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> Link: https://patch.msgid.link/20260521-vdso-mips-kconfig-v1-5-2f79dcd6c78f@linutronix.de
> ---
>  arch/mips/kernel/csrc-r4k.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c
> index 59eca39..5ce95e1 100644
> --- a/arch/mips/kernel/csrc-r4k.c
> +++ b/arch/mips/kernel/csrc-r4k.c
> @@ -130,7 +130,8 @@ int __init init_r4k_clocksource(void)
>  	 * R2 onwards makes the count accessible to user mode so it can be used
>  	 * by the VDSO (HWREna is configured by configure_hwrena()).
>  	 */
> -	if (cpu_has_mips_r2_r6 && rdhwr_count_usable())
> +	if (IS_ENABLED(CONFIG_GENERIC_GETTIMEOFDAY) &&
> +	    cpu_has_mips_r2_r6 && rdhwr_count_usable())
>  		clocksource_mips.vdso_clock_mode = VDSO_CLOCKMODE_R4K;
>  
>  	clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);