From patchwork Thu Oct 29 08:21:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 7517131 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 83C81BEEA4 for ; Thu, 29 Oct 2015 08:24:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 79BFA209FC for ; Thu, 29 Oct 2015 08:24:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B2FD209D7 for ; Thu, 29 Oct 2015 08:24:23 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZriTz-00018V-UG; Thu, 29 Oct 2015 08:22:51 +0000 Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZriTR-0000v8-F9 for linux-arm-kernel@lists.infradead.org; Thu, 29 Oct 2015 08:22:19 +0000 Received: by lbbec13 with SMTP id ec13so23246675lbb.0 for ; Thu, 29 Oct 2015 01:21:55 -0700 (PDT) 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=6JCBVhb3J+8NojUWqp+X96RRwjfLS+O7pZtsuvow5+w=; b=jkDmOyzyaioXXv0QK6H2OxWLxmld5/3RmbtSrik35h+bSbNG3t/VvbTHBWgRcRX8tJ F5QRGpURU3QeVdp1UK/V7+9dTaTlxJ4cSCcJiF+0ZGpRDuJEBG/x/qDqTlv6K+VklWgt 4qK1UjcJATWOsCPuhElM6xzJi1hHDNETSfg3q+HtEXtCWF0mfohawzpJo6swNUK19FWZ /v0AK53yEjUYGThrq/Id76IjOcYf1UV9tRZwjuCpUjwC5MWnfiCdIP0/J9MHjKxgKM9f bp8k3UPIRa5pelpkqZjeMPoBIJUBb03aAN3x6w19mF4g0NID/rtddM9bCEkHju0dzLEY 3URQ== 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=6JCBVhb3J+8NojUWqp+X96RRwjfLS+O7pZtsuvow5+w=; b=OaSwRKMhf3H+eGS6uwcpIPQJf0twXr1lZ1n/Dx614s1N/daTOM7hq4kODNNb0f1izi pA3T9PdXNsV5eQNu2mybIPpIl33MYAXBPYuNN0xY0QTJnizhnH+t7EHWUdsq0Tyw7UJ3 a/KNS65NJLtBuQ96f1cnJhJHd12IUr4uQFdiv8BFowtKv78MFiZnguUCofcSB78VQwO0 yJ+gmGASSrFVwXT8qbV55w647riS/mpnV9KXR8Q2wY2wSH+xRKwJta0eCMPczQMIJdbI zhNeLknQlmALa2D4+iOFN0uYilZfjIczD02iZJLsSWeLqVFY84pgDTw4VyVH+n2tHssx FtfQ== X-Gm-Message-State: ALoCoQlejHInXb7/HVLC+QpDukQANXTTwhobBpo757M4SKdVU+sn+iSh2f83y+hk/7ByyA69t8HN X-Received: by 10.112.146.2 with SMTP id sy2mr256040lbb.104.1446106914651; Thu, 29 Oct 2015 01:21:54 -0700 (PDT) Received: from ermac.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id q201sm73103lfe.43.2015.10.29.01.21.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Oct 2015 01:21:53 -0700 (PDT) From: Jens Wiklander To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Arnd Bergmann , Greg Kroah-Hartman , Kees Cook Subject: [PATCH v6 2/6] drivers: psci: replace psci firmware calls Date: Thu, 29 Oct 2015 09:21:24 +0100 Message-Id: <1446106888-8983-3-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446106888-8983-1-git-send-email-jens.wiklander@linaro.org> References: <1446106888-8983-1-git-send-email-jens.wiklander@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151029_012217_853180_AAFDEDA1 X-CRM114-Status: GOOD ( 17.23 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: valentin.manea@huawei.com, Mark Rutland , javier@javigon.com, emmanuel.michel@st.com, Will Deacon , Michal Simek , jean-michel.delorme@st.com, Jason Gunthorpe , Rob Herring , Jens Wiklander MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 | 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 - */ - -#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 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 - */ - -#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..53c9606 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,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) {