[PATCH] ARM: OMAP2+: Fix compile if CONFIG_HAVE_ARM_SMCCC is not set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <afd@xxxxxx>.

Fixes: 48840e16c299 ("ARM: OMAP2+: Use ARM SMC Calling Convention when OP-TEE is available")
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
Cc: Aaro Koskinen <aaro.koskinen@xxxxxx>
Cc: Andrew F. Davis <afd@xxxxxx>
Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: Marc Zyngier <maz@xxxxxxxxxx>
Cc: Rob Herring <robh@xxxxxxxxxx>
Cc: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx>
Cc: Steven Price <steven.price@xxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>
---
 arch/arm/mach-omap2/omap-secure.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c
--- a/arch/arm/mach-omap2/omap-secure.c
+++ b/arch/arm/mach-omap2/omap-secure.c
@@ -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)
 {
-- 
2.25.1



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux