From patchwork Tue Dec 8 13:28:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 57871 Delivered-To: patches@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp26975lbb; Tue, 8 Dec 2015 05:29:04 -0800 (PST) X-Received: by 10.28.229.65 with SMTP id c62mr4280523wmh.25.1449581340604; Tue, 08 Dec 2015 05:29:00 -0800 (PST) Return-Path: Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com. [2a00:1450:400c:c09::22c]) by mx.google.com with ESMTPS id db10si4246819wjc.200.2015.12.08.05.29.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Dec 2015 05:29:00 -0800 (PST) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:400c:c09::22c as permitted sender) client-ip=2a00:1450:400c:c09::22c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:400c:c09::22c as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dkim=pass header.i=@linaro-org.20150623.gappssmtp.com Received: by wmec201 with SMTP id c201so212401395wme.0 for ; Tue, 08 Dec 2015 05:29:00 -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=dQ3DaF2JTdpM9MNDIaA3+TYFK2aPmimle5/0ArPBBBE=; b=xkpogWQ/gmymHhxPuy97I2u0j651sOiPLD9EdpwY88wBFGgKflpq2wmWvKy7pqOw4G yNCPc/pIMWAEpjPgIrpzLLe6l28Q2dZ5960EsCks4wM8OhEJu13KsbWphcBEELpTMoxw l/1T5aml5qyZ7zaf8lsHlX5eTrrOsW9RbVbaoDaiEMsP78nNxST4Jn7elk77WaPTtb8H +Iu6sqCW9RLiRYf53JPfSKDGm8VzGIgQR5GwWttUGGRlulj+a/0Mo7gOhAf6jQP2CU8f 03vGVapK7uaxbMYRU5Clkx1OoxQabyCydpZLKuGs7S2grXp5RVwalq2GBmU9srpRGpDT pQWA== 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=dQ3DaF2JTdpM9MNDIaA3+TYFK2aPmimle5/0ArPBBBE=; b=E1mXsL7eijXW220hRpYMLBLMBVBE3kmN1p9LzdWrbIPtxG6TuYIK54xA9/wRX/LExx UNYWr9gb+zapRB6V/fsAXmB1s6eXxtHFzTu8UjbO2u/2uHZPrL9kPzO0+Jb0IQBm6Ql0 GeYikE7Vfib5aWpttmPQOtby9OKaq5dQLAQI6EeZOEEo7xQx2lfXHImea6l9w4kQrEXo ZIMR3xmeYK5efVYuCyihQ6NBksWOJBVr1nctE383wSKawZkPhcWj6mPtR5VCFr6PHd+W u52eSrCPOreBgNPrJREtzjIvUJWblOvTqfHPJmJRxNXNTKA9BUWQSFXUq0MGiYWAK2y+ xNgg== X-Gm-Message-State: ALoCoQljqTPeTSgCFMrRaZ5bnf17YSCErXaD9sOgFWAZoqltTr/9qbqcMZIAXPhi/+S+2uMWzfl5WYUgIusHoR6vecaX8MPUFg== X-Received: by 10.194.121.35 with SMTP id lh3mr3806943wjb.164.1449581340386; Tue, 08 Dec 2015 05:29:00 -0800 (PST) Return-Path: Received: from ermac.urgonet (h-84-45.a175.priv.bahnhof.se. [79.136.84.45]) by smtp.gmail.com with ESMTPSA id d2sm3035327wjy.16.2015.12.08.05.28.59 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Dec 2015 05:28:59 -0800 (PST) From: Jens Wiklander To: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Mark Rutland , Will Deacon , Catalin Marinas , Russell King , Lorenzo Pieralisi , Kevin Hilman Cc: Lars Persson , tyler.baker@linaro.org, Jens Wiklander Subject: [PATCH v5 4/4] drivers: psci: replace psci firmware calls Date: Tue, 8 Dec 2015 14:28:35 +0100 Message-Id: <1449581315-14519-5-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449581315-14519-1-git-send-email-jens.wiklander@linaro.org> References: <1449581315-14519-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. Acked-by: Will Deacon Reviewed-by: Mark Rutland Tested-by: Mark Rutland Acked-by: Lorenzo Pieralisi Tested-by: Lorenzo Pieralisi 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 d2d0042..80856de 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 0170bea..27bf1e5 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -14,7 +14,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 smccc-call.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 d24f35d..f25cd79 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -13,6 +13,7 @@ #define pr_fmt(fmt) "psci: " fmt +#include #include #include #include @@ -58,8 +59,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 { @@ -107,6 +106,26 @@ bool psci_power_state_is_valid(u32 state) return !(state & ~valid_mask); } +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) {