Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1237343 > unrolled thread

[RFC] arm: Add generic smc wrapper

Started byLars Persson <lars.persson@axis.com>
First post2015-10-01 14:10 +0200
Last post2015-10-03 00:20 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [RFC] arm: Add generic smc wrapper Lars Persson <lars.persson@axis.com> - 2015-10-01 14:10 +0200
    Re: [RFC] arm: Add generic smc wrapper kbuild test robot <lkp@intel.com> - 2015-10-02 07:20 +0200
      Re: [RFC] arm: Add generic smc wrapper Arnd Bergmann <arnd@arndb.de> - 2015-10-03 00:20 +0200

#1237343 — [RFC] arm: Add generic smc wrapper

FromLars Persson <lars.persson@axis.com>
Date2015-10-01 14:10 +0200
Subject[RFC] arm: Add generic smc wrapper
Message-ID<qeKQr-3yE-37@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1237906

Fromkbuild test robot <lkp@intel.com>
Date2015-10-02 07:20 +0200
Message-ID<qf0Vb-26P-3@gated-at.bofh.it>
In reply to#1237343

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [prev] | [next] | [standalone]


#1238653

FromArnd Bergmann <arnd@arndb.de>
Date2015-10-03 00:20 +0200
Message-ID<qfgQi-87k-7@gated-at.bofh.it>
In reply to#1237906
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web