linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] arm: Add generic smc wrapper
@ 2015-10-01 12:04 Lars Persson
  2015-10-02  5:13 ` kbuild test robot
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Persson @ 2015-10-01 12:04 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel; +Cc: Lars Persson

This adds an smc wrapper according to the ARM standard for secure
monitor calling conventions (ARM DEN 0028A).

Signed-off-by: Lars Persson <larper@axis.com>
---
 arch/arm/include/asm/smc-call.h | 12 ++++++++++++
 arch/arm/kernel/Makefile        |  2 ++
 arch/arm/kernel/smc-call.S      | 22 ++++++++++++++++++++++
 3 files changed, 36 insertions(+)
 create mode 100644 arch/arm/include/asm/smc-call.h
 create mode 100644 arch/arm/kernel/smc-call.S

diff --git a/arch/arm/include/asm/smc-call.h b/arch/arm/include/asm/smc-call.h
new file mode 100644
index 0000000..88a83d4
--- /dev/null
+++ b/arch/arm/include/asm/smc-call.h
@@ -0,0 +1,12 @@
+/*
+ * Wrapper for secure monitor calls using the ARM SMC calling
+ * convention.
+ */
+#ifndef __ASM_SMC_CALL_H
+#define __ASM_SMC_CALL_H
+
+#include <linux/types.h>
+
+extern int invoke_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2);
+
+#endif
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index af9e59b..f09d2d6 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -92,4 +92,6 @@ obj-y				+= psci-call.o
 obj-$(CONFIG_SMP)		+= psci_smp.o
 endif
 
+obj-y		+= smc-call.o
+
 extra-y := $(head-y) vmlinux.lds
diff --git a/arch/arm/kernel/smc-call.S b/arch/arm/kernel/smc-call.S
new file mode 100644
index 0000000..a07ebf9
--- /dev/null
+++ b/arch/arm/kernel/smc-call.S
@@ -0,0 +1,22 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Copied from: psci-call.S.
+ */
+
+#include <linux/linkage.h>
+
+#include <asm/opcodes-sec.h>
+
+/* int invoke_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */
+ENTRY(invoke_smc)
+	__SMC(0)
+	bx	lr
+ENDPROC(invoke_smc)
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC] arm: Add generic smc wrapper
  2015-10-01 12:04 [RFC] arm: Add generic smc wrapper Lars Persson
@ 2015-10-02  5:13 ` kbuild test robot
  2015-10-02 22:16   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2015-10-02  5:13 UTC (permalink / raw)
  To: Lars Persson; +Cc: kbuild-all, linux-arm-kernel, linux-kernel, Lars Persson

[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

Hi Lars,

[auto build test results on v4.3-rc3 -- if it's inappropriate base, please ignore]

config: arm-rpc_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

   arch/arm/kernel/smc-call.S: Assembler messages:
>> arch/arm/kernel/smc-call.S:21: Error: selected processor does not support ARM mode `bx lr'

vim +21 arch/arm/kernel/smc-call.S

    15	
    16	#include <asm/opcodes-sec.h>
    17	
    18	/* int invoke_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */
    19	ENTRY(invoke_smc)
    20		__SMC(0)
  > 21		bx	lr
    22	ENDPROC(invoke_smc)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 12414 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC] arm: Add generic smc wrapper
  2015-10-02  5:13 ` kbuild test robot
@ 2015-10-02 22:16   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2015-10-02 22:16 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: kbuild test robot, Lars Persson, Lars Persson, kbuild-all, linux-kernel

On Friday 02 October 2015 13:13:24 kbuild test robot wrote:
> 
>     15  
>     16  #include <asm/opcodes-sec.h>
>     17  
>     18  /* int invoke_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */
>     19  ENTRY(invoke_smc)
>     20          __SMC(0)
>   > 21          bx      lr
>     22  ENDPROC(invoke_smc)
> 
> 

Maybe compile this only for ARMv6 and ARMv7? The error was for an ARMv3/v4 build,
which has neither SMC nor bx.

	Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-02 22:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 12:04 [RFC] arm: Add generic smc wrapper Lars Persson
2015-10-02  5:13 ` kbuild test robot
2015-10-02 22:16   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).