ARM: OMAP2+: Fix compile if CONFIG_HAVE_ARM_SMCCC is not set
Subsystems (3)
Tony Lindgren
maintainerPATCH 1/1 ARM: OMAP2+: Fix compile if CONFIG_HAVE_ARM_SMCCC is not set
Recent omap changes added runtime checks to use omap_smccc_smc() when optee is configured in dts. As the omap-secure code can be built for ARMv6 only without ARMv7 and use custom smc calls, we now get a build error:
omap-secure.c:(.text+0x94): undefined reference to `__arm_smccc_smc'
Let's just ifdef out omap_smccc_smc() unless the CPU has selected CONFIG_HAVE_ARM_SMCCC. The other option discussed was to add an inline function to arm-smccc.h, but we'd still also have to add ifdef around omap_smccc_smc() to avoid a warning for uninitialized value for struct arm_smccc_res in omap_smccc_smc(). And we probably should not start initializing values in arm-smccc.h if disabled.
Let's also warn on trying to use omap_smccc_smc() if disabled as suggested by Andrew F. Davis <[email protected]>.
--- arch/arm/mach-omap2/omap-secure.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/mach-omap2/omap-secure.c +7 -0
@@ -77,6 +77,7 @@ u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, u32 arg1, u32 arg2,return ret; } +#ifdef CONFIG_HAVE_ARM_SMCCC void omap_smccc_smc (u32 fn,u32 arg) {struct arm_smccc_res res;
@@ -85,6 +86,12 @@ void omap_smccc_smc(u32 fn, u32 arg) 0, 0, 0, 0, 0, 0, &res); WARN(res.a0, "Secure function call 0x%08x failed\n", fn); } +#else +void omap_smccc_smc (u32 fn,u32 arg) +{ +WARN_ONCE (1 ,"smccc is disabled\n" ); +} +#endif void omap_smc1 (u32 fn,u32 arg) {
Signature · 1 line
2.25.1
Quoted 29 lines · Tony Lindgren
Recent omap changes added runtime checks to use
omap_smccc_smc()when optee is configured in dts. As the omap-secure code can be built for ARMv6 only without ARMv7 and use custom smc calls, we now get a build error:omap-secure.c:(.text+0x94): undefined reference to `__arm_smccc_smc'
Let's just ifdef out
omap_smccc_smc()unless the CPU has selectedCONFIG_HAVE_ARM_SMCCC. The other option discussed was to add an inline function toarm-smccc.h, but we'd still also have to add ifdef aroundomap_smccc_smc()to avoid a warning for uninitialized value for structarm_smccc_resinomap_smccc_smc(). And we probably should not start initializing values inarm-smccc.hif disabled.Let's also warn on trying to use
omap_smccc_smc()if disabled as suggested by Andrew F. Davis <[email protected]>.Fixes 48840e16c299 ("ARM: OMAP2+: Use ARM SMC Calling Convention when OP-TEE is available")Reported-by kbuild test robot <[email protected]>Cc Aaro Koskinen <[email protected]>Cc Andrew F. Davis <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Catalin Marinas <[email protected]>Cc Marc Zyngier <[email protected]>Cc Rob Herring <[email protected]>Cc Russell King <[email protected]>Cc Steven Price <[email protected]>Cc Will Deacon <[email protected]>Signed-off-by Tony Lindgren <[email protected]>
Quoted 1 line
---
Looks good to me,
Quoted 28 lines
arch/arm/mach-omap2/omap-secure.c | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/mach-omap2/omap-secure.c +7
-0@@ -77,6 +77,7 @@ u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, u32 arg1, u32 arg2,return ret; } +#ifdef CONFIG_HAVE_ARM_SMCCC void omap_smccc_smc (u32 fn,u32 arg) {struct arm_smccc_res res;@@ -85,6 +86,12 @@ void omap_smccc_smc(u32 fn, u32 arg) 0, 0, 0, 0, 0, 0, &res); WARN(res.a0, "Secure function call 0x%08x failed\n", fn); } +#else +void omap_smccc_smc (u32 fn,u32 arg) +{ +WARN_ONCE (1 ,"smccc is disabled\n" ); +} +#endif void omap_smc1 (u32 fn,u32 arg) {
Quoted 23 lines · Tony Lindgren
Recent omap changes added runtime checks to use
omap_smccc_smc()when optee is configured in dts. As the omap-secure code can be built for ARMv6 only without ARMv7 and use custom smc calls, we now get a build error:omap-secure.c:(.text+0x94): undefined reference to `__arm_smccc_smc'
Let's just ifdef out
omap_smccc_smc()unless the CPU has selectedCONFIG_HAVE_ARM_SMCCC. The other option discussed was to add an inline function toarm-smccc.h, but we'd still also have to add ifdef aroundomap_smccc_smc()to avoid a warning for uninitialized value for structarm_smccc_resinomap_smccc_smc(). And we probably should not start initializing values inarm-smccc.hif disabled.Let's also warn on trying to use
omap_smccc_smc()if disabled as suggested by Andrew F. Davis <[email protected]>.arch/arm/mach-omap2/omap-secure.c +1
-0+#ifdef CONFIG_HAVE_ARM_SMCCC void omap_smccc_smc (u32 fn,u32 arg) {struct arm_smccc_res res;
arch/arm/mach-omap2/omap-secure.c void omap_smccc_smc(u32 fn, u32 arg) · line 89
Quoted 4 lines
arch/arm/mach-omap2/omap-secure.c +1
-0@@ -85,6 +86,12 @@ void omap_smccc_smc(u32 fn, u32 arg) 0, 0, 0, 0, 0, 0, &res); WARN(res.a0, "Secure function call 0x%08x failed\n", fn); } +#else
Looking through the callers again, this can and is only called for ARMv7 CPUs, so can't you just avoid the #else path and turn it into a link error if we ever get callers on ARMv6-only builds?
Arnd
Tony Lindgren
maintainerQuoted 19 lines · Arnd Bergmann
Quoted 18 lines · Tony Lindgren
Recent omap changes added runtime checks to use
omap_smccc_smc()when optee is configured in dts. As the omap-secure code can be built for ARMv6 only without ARMv7 and use custom smc calls, we now get a build error:omap-secure.c:(.text+0x94): undefined reference to `__arm_smccc_smc'
Let's just ifdef out
omap_smccc_smc()unless the CPU has selectedCONFIG_HAVE_ARM_SMCCC. The other option discussed was to add an inline function toarm-smccc.h, but we'd still also have to add ifdef aroundomap_smccc_smc()to avoid a warning for uninitialized value for structarm_smccc_resinomap_smccc_smc(). And we probably should not start initializing values inarm-smccc.hif disabled.Let's also warn on trying to use
omap_smccc_smc()if disabled as suggested by Andrew F. Davis <[email protected]>.
Quoted 13 lines
arch/arm/mach-omap2/omap-secure.c void omap_smccc_smc(u32 fn, u32 arg) · line 89
Quoted 9 lines
arch/arm/mach-omap2/omap-secure.c +2
-0+#ifdef CONFIG_HAVE_ARM_SMCCC void omap_smccc_smc (u32 fn,u32 arg) {struct arm_smccc_res res;@@ -85,6 +86,12 @@ void omap_smccc_smc(u32 fn, u32 arg) 0, 0, 0, 0, 0, 0, &res); WARN(res.a0, "Secure function call 0x%08x failed\n", fn); } +#else Looking through the callers again, this can and is only called for ARMv7 CPUs, so can't you just avoid the #else path and turn it into a link error if we ever get callers on ARMv6-only builds?
Hmm yeah maybe. If ARMv6 machines (basically n8x0) is not using omap-smc.S at all, it's unlike it would need omap-secure.c either.
Regards,
Tony
Tony Lindgren
maintainerQuoted 34 lines · Tony Lindgren
Quoted 19 lines · Arnd Bergmann
Quoted 18 lines · Tony Lindgren
Recent omap changes added runtime checks to use
omap_smccc_smc()when optee is configured in dts. As the omap-secure code can be built for ARMv6 only without ARMv7 and use custom smc calls, we now get a build error:omap-secure.c:(.text+0x94): undefined reference to `__arm_smccc_smc'
Let's just ifdef out
omap_smccc_smc()unless the CPU has selectedCONFIG_HAVE_ARM_SMCCC. The other option discussed was to add an inline function toarm-smccc.h, but we'd still also have to add ifdef aroundomap_smccc_smc()to avoid a warning for uninitialized value for structarm_smccc_resinomap_smccc_smc(). And we probably should not start initializing values inarm-smccc.hif disabled.Let's also warn on trying to use
omap_smccc_smc()if disabled as suggested by Andrew F. Davis <[email protected]>.Quoted 13 lines
arch/arm/mach-omap2/omap-secure.c void omap_smccc_smc(u32 fn, u32 arg) · line 89
Quoted 9 lines
arch/arm/mach-omap2/omap-secure.c +2
-0+#ifdef CONFIG_HAVE_ARM_SMCCC void omap_smccc_smc (u32 fn,u32 arg) {struct arm_smccc_res res;@@ -85,6 +86,12 @@ void omap_smccc_smc(u32 fn, u32 arg) 0, 0, 0, 0, 0, 0, &res); WARN(res.a0, "Secure function call 0x%08x failed\n", fn); } +#else Looking through the callers again, this can and is only called for ARMv7 CPUs, so can't you just avoid the #else path and turn it into a link error if we ever get callers on ARMv6-only builds?
Quoted 2 lines
Hmm yeah maybe. If ARMv6 machines (basically n8x0) is not using
omap-smc.Sat all, it's unlike it would needomap-secure.ceither.
Yeah we never built secure-common for omap2 earlier, this got recently added. My guess is that n8x0 only has a signed bootloader and no smc calls at all, or at least we don't use any smc calls for n8x0 in the kernel.
I'll send out v2 of the patch.
Regards,
Tony