Skip to contentSkip to conversation

arm: Add generic smc wrapper

PATCH New Lars Persson 1 participant 2 messages Oct 9, 2015 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover arm: Add generic smc wrapper

This is intended for new machines that call secure monitors compliant with ARM DEN 0028A.

Changes since RFC:
* Build only for V6 and V7 CPUs.

Lars Persson (1):
arm: Add generic smc wrapper

 arch/arm/include/asm/smc-call.h | 12 ++++++++++++
 arch/arm/kernel/Makefile        |  3 +++
 arch/arm/kernel/smc-call.S      | 22 ++++++++++++++++++++++
 3 files changed, 37 insertions(+)
 create mode 100644 arch/arm/include/asm/smc-call.h
 create mode 100644 arch/arm/kernel/smc-call.S
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 arm: Add generic smc wrapper

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

---
 arch/arm/include/asm/smc-call.h | 12 ++++++++++++
 arch/arm/kernel/Makefile        |  3 +++
 arch/arm/kernel/smc-call.S      | 22 ++++++++++++++++++++++
 3 files changed, 37 insertions(+)
 create mode 100644 arch/arm/include/asm/smc-call.h
 create mode 100644 arch/arm/kernel/smc-call.S
arch/arm/include/asm/smc-call.h new file +12 -0
new file mode 100644
index 0000000..88a83d4
@@ -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
arch/arm/kernel/Makefile +3 -0
index af9e59b..73c95e0 100644
@@ -92,4 +92,7 @@ obj-y				+= psci-call.o
 obj-$(CONFIG_SMP)		+= psci_smp.o
 endif
 
+obj-$(CONFIG_CPU_V6)		+= smc-call.o
+obj-$(CONFIG_CPU_V7)		+= smc-call.o
+
 extra-y := $(head-y) vmlinux.lds
arch/arm/kernel/smc-call.S new file +22 -0
new file mode 100644
index 0000000..a07ebf9
@@ -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)
Signature · 1 line
2.1.4