From patchwork Wed Nov 11 10:04:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 56374 Delivered-To: patches@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp1269317lbb; Wed, 11 Nov 2015 02:04:58 -0800 (PST) X-Received: by 10.25.136.213 with SMTP id k204mr4025240lfd.101.1447236298350; Wed, 11 Nov 2015 02:04:58 -0800 (PST) Return-Path: Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com. [2a00:1450:4010:c07::231]) by mx.google.com with ESMTPS id 201si5556607lfb.102.2015.11.11.02.04.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2015 02:04:58 -0800 (PST) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:4010:c07::231 as permitted sender) client-ip=2a00:1450:4010:c07::231; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:4010:c07::231 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dkim=pass header.i=@linaro_org.20150623.gappssmtp.com Received: by lfs39 with SMTP id 39so13475674lfs.3 for ; Wed, 11 Nov 2015 02:04:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KNtLyEceavwHb07/PXEytX7sGeom5cRNsQbwIXSzxYQ=; b=m0YSA053WsWNdMxM+l3bWUqBX6snE8hd2x9msTIX14q05u2JjPv3DogiHtsPTGxoSp sfxqP5U2Sy58NqoAFNpaA/AS39xla1pPyoY2szsJAnAwgHPEP/0yxFsaQxUWq+vKPkjK jrm2URraNiFv7LcWK7qovOuhXh8SXxeN1FDzgY3PzLZSBwxTDg4cdQ2ZKZ+OOYHBpi0O lJC7RYqPpNdPhIkW3XGI0g+Bz6bprXuKiXVsvxS9al/lD2I3RYh7FE3CdGWe60NLyT2f t+u5NV4EVlPMMd3za2M7hPY2EWRovZSwN2oO7lTQpz4uIhCf3c84kc06hR8TdkCvniwA 9Pag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KNtLyEceavwHb07/PXEytX7sGeom5cRNsQbwIXSzxYQ=; b=mEstCfrv3UMykxehLlLRmcozorGK396KXw+0/aBHiJCKT+9sGvC0jiSYna2VWng/cs wnLefKGvtaag44hGczdh+67Tku7Ox40hpeB+W1NKzoR+aCnwW1chDjnpXvLHcEQGUuNx d+izQPnSug8QAi6MLLnaJWRNdLywPGTKoWINffv6NgpyJJwA2nPTbk7cvqb2CrzTe5Yl sr28FV+tQND+E8/vd5RFtMEK0D12XynzCScV7B4iDvCjut7axc4uVbMqUyX1dEGUMs1A SuNrwVi2Y4YoaN5Y3BsWCFDbT2xnahtG6IsrG0SXnvBAt59Tw5sOr28a7SCc6AeMwZ0/ fRqQ== X-Gm-Message-State: ALoCoQkMckC4k4e8oZi5Hn9KPDEzyZwkhUKf9Yf5XCj9G2meLO8/cHbnM8B1LVZUpXFWDrB79y3k X-Received: by 10.25.15.213 with SMTP id 82mr3973808lfp.98.1447236298102; Wed, 11 Nov 2015 02:04:58 -0800 (PST) Return-Path: Received: from ermac.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 102sm1344558lft.21.2015.11.11.02.04.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Nov 2015 02:04:56 -0800 (PST) From: Jens Wiklander To: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Mark Rutland , Will Deacon , Catalin Marinas , Russell King Cc: Lars Persson , Jens Wiklander Subject: [PATCH v2 4/4] drivers: psci: replace psci firmware calls Date: Wed, 11 Nov 2015 11:04:26 +0100 Message-Id: <1447236266-7491-5-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447236266-7491-1-git-send-email-jens.wiklander@linaro.org> References: <1447236266-7491-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 --- 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 | 23 +++++++++++++++++++++-- 5 files changed, 22 insertions(+), 63 deletions(-) delete mode 100644 arch/arm/kernel/psci-call.S delete mode 100644 arch/arm64/kernel/psci-call.S -- 1.9.1 diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index c89e6ab..e8afdc6 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 - */ - -#include - -#include -#include - -/* 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 c61d758..ff4b88a 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 - */ - -#include - -/* 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..9c55d11 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -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,26 @@ enum psci_function { static u32 psci_function_id[PSCI_FN_MAX]; +static unsigned long __invoke_psci_fn_hvc(unsigned long function_id, + unsigned long arg0, unsigned long arg1, + unsigned long arg2) +{ + struct arm_smccc_res res; + + arm_smccc_hvc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res); + return res.a0; +} + +static unsigned long __invoke_psci_fn_smc(unsigned long function_id, + unsigned long arg0, unsigned long arg1, + unsigned long arg2) +{ + struct arm_smccc_res res; + + arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res); + return res.a0; +} + static int psci_to_linux_errno(int errno) { switch (errno) {