From: Jens Wiklander <jens.wiklander@linaro.org>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Kees Cook <keescook@chromium.org>
Cc: valentin.manea@huawei.com, Mark Rutland <mark.rutland@arm.com>,
javier@javigon.com, emmanuel.michel@st.com,
Will Deacon <will.deacon@arm.com>,
Michal Simek <michal.simek@xilinx.com>,
jean-michel.delorme@st.com,
Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
Rob Herring <robh+dt@kernel.org>,
Jens Wiklander <jens.wiklander@linaro.org>
Subject: [PATCH v6 2/6] drivers: psci: replace psci firmware calls
Date: Thu, 29 Oct 2015 09:21:24 +0100 [thread overview]
Message-ID: <1446106888-8983-3-git-send-email-jens.wiklander@linaro.org> (raw)
In-Reply-To: <1446106888-8983-1-git-send-email-jens.wiklander@linaro.org>
Switch to use a generic interface for issuing SMC/HVC based on ARM SMC
Calling Convention. Removes now the now unused psci-call.S.
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
---
arch/arm/kernel/Makefile | 1 -
arch/arm/kernel/psci-call.S | 31 -------------------------------
arch/arm64/kernel/Makefile | 2 +-
arch/arm64/kernel/psci-call.S | 28 ----------------------------
drivers/firmware/psci.c | 21 +++++++++++++++++++--
5 files changed, 20 insertions(+), 63 deletions(-)
delete mode 100644 arch/arm/kernel/psci-call.S
delete mode 100644 arch/arm64/kernel/psci-call.S
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index a98867d..190fa74 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -88,7 +88,6 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o
ifeq ($(CONFIG_ARM_PSCI),y)
-obj-y += psci-call.o
obj-$(CONFIG_SMP) += psci_smp.o
endif
diff --git a/arch/arm/kernel/psci-call.S b/arch/arm/kernel/psci-call.S
deleted file mode 100644
index a78e9e1..0000000
--- a/arch/arm/kernel/psci-call.S
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- *
- * Copyright (C) 2015 ARM Limited
- *
- * Author: Mark Rutland <mark.rutland@arm.com>
- */
-
-#include <linux/linkage.h>
-
-#include <asm/opcodes-sec.h>
-#include <asm/opcodes-virt.h>
-
-/* int __invoke_psci_fn_hvc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */
-ENTRY(__invoke_psci_fn_hvc)
- __HVC(0)
- bx lr
-ENDPROC(__invoke_psci_fn_hvc)
-
-/* int __invoke_psci_fn_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */
-ENTRY(__invoke_psci_fn_smc)
- __SMC(0)
- bx lr
-ENDPROC(__invoke_psci_fn_smc)
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 250948e..748e595 100644
--- a/arch/arm64/kernel/Makefile
+++ b/arch/arm64/kernel/Makefile
@@ -15,7 +15,7 @@ CFLAGS_REMOVE_return_address.o = -pg
arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \
entry-fpsimd.o process.o ptrace.o setup.o signal.o \
sys.o stacktrace.o time.o traps.o io.o vdso.o \
- hyp-stub.o psci.o psci-call.o cpu_ops.o insn.o \
+ hyp-stub.o psci.o cpu_ops.o insn.o \
return_address.o cpuinfo.o cpu_errata.o \
cpufeature.o alternative.o cacheinfo.o \
smp.o smp_spin_table.o topology.o
diff --git a/arch/arm64/kernel/psci-call.S b/arch/arm64/kernel/psci-call.S
deleted file mode 100644
index cf83e61..0000000
--- a/arch/arm64/kernel/psci-call.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- *
- * Copyright (C) 2015 ARM Limited
- *
- * Author: Will Deacon <will.deacon@arm.com>
- */
-
-#include <linux/linkage.h>
-
-/* int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */
-ENTRY(__invoke_psci_fn_hvc)
- hvc #0
- ret
-ENDPROC(__invoke_psci_fn_hvc)
-
-/* int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */
-ENTRY(__invoke_psci_fn_smc)
- smc #0
- ret
-ENDPROC(__invoke_psci_fn_smc)
diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index 42700f0..53c9606 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -19,6 +19,7 @@
#include <linux/pm.h>
#include <linux/printk.h>
#include <linux/psci.h>
+#include <linux/arm-smccc.h>
#include <linux/reboot.h>
#include <uapi/linux/psci.h>
@@ -56,8 +57,6 @@ struct psci_operations psci_ops;
typedef unsigned long (psci_fn)(unsigned long, unsigned long,
unsigned long, unsigned long);
-asmlinkage psci_fn __invoke_psci_fn_hvc;
-asmlinkage psci_fn __invoke_psci_fn_smc;
static psci_fn *invoke_psci_fn;
enum psci_function {
@@ -70,6 +69,24 @@ enum psci_function {
static u32 psci_function_id[PSCI_FN_MAX];
+static unsigned long __invoke_psci_fn_hvc(unsigned long a0, unsigned long a1,
+ unsigned long a2, unsigned long a3)
+{
+ struct smccc_res res;
+
+ smccc_hvc(a0, a1, a2, a3, 0, 0, 0, 0, &res);
+ return res.a0;
+}
+
+static unsigned long __invoke_psci_fn_smc(unsigned long a0, unsigned long a1,
+ unsigned long a2, unsigned long a3)
+{
+ struct smccc_res res;
+
+ smccc_smc(a0, a1, a2, a3, 0, 0, 0, 0, &res);
+ return res.a0;
+}
+
static int psci_to_linux_errno(int errno)
{
switch (errno) {
--
1.9.1
next prev parent reply other threads:[~2015-10-29 8:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-29 8:21 [PATCH v6 0/6] generic TEE subsystem Jens Wiklander
2015-10-29 8:21 ` [PATCH v6 1/6] arm/arm64: add smccc Jens Wiklander
[not found] ` <1446106888-8983-2-git-send-email-jens.wiklander-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-02 11:51 ` Will Deacon
2015-11-02 13:56 ` Jens Wiklander
2015-11-02 14:03 ` Mark Rutland
2015-11-02 14:45 ` Will Deacon
2015-10-29 8:21 ` Jens Wiklander [this message]
[not found] ` <1446106888-8983-3-git-send-email-jens.wiklander-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-02 11:55 ` [PATCH v6 2/6] drivers: psci: replace psci firmware calls Will Deacon
[not found] ` <20151102115539.GC29657-5wv7dgnIgG8@public.gmane.org>
2015-11-02 13:08 ` Jens Wiklander
2015-11-02 13:46 ` Will Deacon
2015-10-29 8:21 ` [PATCH v6 3/6] dt/bindings: add bindings for optee Jens Wiklander
2015-11-16 17:01 ` Rob Herring
2015-11-19 9:18 ` Jens Wiklander
2015-11-19 14:30 ` Rob Herring
2015-10-29 8:21 ` [PATCH v6 4/6] tee: generic TEE subsystem Jens Wiklander
2015-10-29 8:21 ` [PATCH v6 5/6] tee: add OP-TEE driver Jens Wiklander
2015-10-29 8:21 ` [PATCH v6 6/6] Documentation: tee subsystem and op-tee driver Jens Wiklander
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446106888-8983-3-git-send-email-jens.wiklander@linaro.org \
--to=jens.wiklander@linaro.org \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=emmanuel.michel@st.com \
--cc=gregkh@linuxfoundation.org \
--cc=javier@javigon.com \
--cc=jean-michel.delorme@st.com \
--cc=jgunthorpe@obsidianresearch.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=michal.simek@xilinx.com \
--cc=robh+dt@kernel.org \
--cc=valentin.manea@huawei.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).