Skip to contentSkip to conversation

arm: cntvoff: Add a function definition when !SMP

PATCH New Maxime Ripard 3 participants 5 messages May 28, 2018 – Jun 6, 2018 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: cntvoff: Add a function definition when !SMP

The secure_cntvoff_init function is only compiled if CONFIG_SMP is set to true. However, that will lead to linking errors if one uses this function without an ifdef CONFIG_SMP guard, which isn't ideal.

Provide a dumb implementation when CONFIG_SMP is false so that we don't end up with a compilation error on our hands.

Cc Olof Johansson <[email protected]>
Cc Myl?ne Josserand <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
Fixes cad160ed0a94 ("ARM: shmobile: Convert file to use cntvoff")
---
 arch/arm/include/asm/secure_cntvoff.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/include/asm/secure_cntvoff.h +4 -0
index 1f93aee1f630..ce96cd781838 100644
@@ -3,6 +3,10 @@
 #ifndef __ASMARM_ARCH_CNTVOFF_H
 #define __ASMARM_ARCH_CNTVOFF_H
 
+#ifdef CONFIG_SMP
 extern void secure_cntvoff_init(void);
+#else
+static inline void secure_cntvoff_init(void) {};
+#endif
 
 #endif
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/1 arm: cntvoff: Add a function definition when !SMP

Quoted 7 lines · Maxime Ripard

The secure_cntvoff_init function is only compiled if CONFIG_SMP is set to true. However, that will lead to linking errors if one uses this function without an ifdef CONFIG_SMP guard, which isn't ideal.

Provide a dumb implementation when CONFIG_SMP is false so that we don't end up with a compilation error on our hands.

Quoted 6 lines
Cc Olof Johansson <[email protected]>
Cc Myl?ne Josserand <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
Fixes cad160ed0a94 ("ARM: shmobile: Convert file to use cntvoff")

Ping?

Maxime

Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180604/43cdc1b2/attachment.sig>
#2 lore raw

PATCH 1/1 arm: cntvoff: Add a function definition when !SMP

Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Maxime Ripard

The secure_cntvoff_init function is only compiled if CONFIG_SMP is set to true. However, that will lead to linking errors if one uses this function without an ifdef CONFIG_SMP guard, which isn't ideal.

Provide a dumb implementation when CONFIG_SMP is false so that we don't end up with a compilation error on our hands.

What are the errors that this patch fixes?

Quoted 16 lines
Quoted 7 lines
Cc Olof Johansson <[email protected]>
Cc Myl?ne Josserand <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
Fixes cad160ed0a94 ("ARM: shmobile: Convert file to use cntvoff")

Ping?

Maxime

Signature · 3 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 arm: cntvoff: Add a function definition when !SMP

Quoted 10 lines · Simon Horman
Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Maxime Ripard

The secure_cntvoff_init function is only compiled if CONFIG_SMP is set to true. However, that will lead to linking errors if one uses this function without an ifdef CONFIG_SMP guard, which isn't ideal.

Provide a dumb implementation when CONFIG_SMP is false so that we don't end up with a compilation error on our hands.

What are the errors that this patch fixes?

There's a linking error when CONFIG_SMP is not enabled since the function will not be implemented anywhere.

Maxime

Signature · 10 lines
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180605/716b6265/attachment-0001.sig>
#4 lore raw

PATCH 1/1 arm: cntvoff: Add a function definition when !SMP

In reply to Maxime Ripard

Hi Maxime,

Quoted 7 lines · Maxime Ripard

The secure_cntvoff_init function is only compiled if CONFIG_SMP is set to true. However, that will lead to linking errors if one uses this function without an ifdef CONFIG_SMP guard, which isn't ideal.

Provide a dumb implementation when CONFIG_SMP is false so that we don't end up with a compilation error on our hands.

Quoted 6 lines
Cc Olof Johansson <[email protected]>
Cc Myl?ne Josserand <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
Fixes cad160ed0a94 ("ARM: shmobile: Convert file to use cntvoff")

cfr. for Arnd's similar fix (https://patchwork.kernel.org/patch/10427931/)

At least R-Car E2 also needs it for the boot CPU, cfr. commit 9ce3fa6816c2fb59 ("ARM: shmobile: rcar-gen2: Add CA7 arch_timer initialization for r8a7794").

The proper fix is to build arch/arm/common/secure_cntvoff.o unconditionally.

arch/arm/include/asm/secure_cntvoff.h line 12

Quoted 13 lines
arch/arm/include/asm/secure_cntvoff.h +4 -0
@@ -3,6 +3,10 @@
 #ifndef __ASMARM_ARCH_CNTVOFF_H
 #define __ASMARM_ARCH_CNTVOFF_H
 
+#ifdef CONFIG_SMP
 extern void secure_cntvoff_init(void);
+#else
+static inline void secure_cntvoff_init(void) {};
+#endif
 
 #endif

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds