From patchwork Mon Jan 4 12:54:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 59132 Delivered-To: patches@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp5340533lbb; Mon, 4 Jan 2016 04:55:22 -0800 (PST) X-Received: by 10.194.235.137 with SMTP id um9mr31882015wjc.146.1451912119662; Mon, 04 Jan 2016 04:55:19 -0800 (PST) Return-Path: Received: from mail-wm0-x22f.google.com (mail-wm0-x22f.google.com. [2a00:1450:400c:c09::22f]) by mx.google.com with ESMTPS id cr4si75883wjb.184.2016.01.04.04.55.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jan 2016 04:55:19 -0800 (PST) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:400c:c09::22f as permitted sender) client-ip=2a00:1450:400c:c09::22f; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:400c:c09::22f as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-wm0-x22f.google.com with SMTP id l65so161648863wmf.1 for ; Mon, 04 Jan 2016 04:55:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+Lehsp+Ymnu70HOVJFyX8cqdwv/Lee4DO17wG0Azhw8=; b=YX02Djnw+ko6WRxMb+JqY61XbK+5VLe1wdnV7j7cDKRsW46f31+f4u+okTdUxgdN+F IKyhsEeFJySUYn5ZCscGxg/vUrfrK4IHXGhMmA/ORdghxFtdTj8neGhacciu5dqE8Xf/ wi+akMm5IkDsJThkjuNKBTGha4JYVLw1wY+rA= 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=+Lehsp+Ymnu70HOVJFyX8cqdwv/Lee4DO17wG0Azhw8=; b=mM92H2JFMwDsMsAtRMKBQ6DdOfnZuO+uITncX/HAwEk61PZFgJPsyplU6ZiTC9UmTa 1+1rCyjU0l3iKtvupq2JGgcGxNd6Q8qE1D6Pv2PLBFnt1qcpfXTNvELmOaYVfV0jWm5u k8TGO9LbjYBGtQIxXSUuVROGvxw1Fz3VMondfi5O7gBCgo+gcvdc6V0vgRSQx/XOcfUd KKUJIddphqsiEG8dL9BawKquncAibT6fXcI1ibHsfJXVceadSqdjfpcw3Hq7OQKg6jdc /JsHPjPo/DwAxkZ4luPeKMRJvjx+MkIUFiJbDCfdAyS4J8AdpPnFaiafLw10gLSuzA5H JLow== X-Gm-Message-State: ALoCoQn8e+9D+5LndiToTnTGszbM5MpnFhlbIpKA+aKXzNfOkMGv+1vGTAYllTpT6qiUbuynHmxqVMH8P1XVGqiQdgMsVXsT0Q== X-Received: by 10.28.54.78 with SMTP id d75mr47338397wma.6.1451912119373; Mon, 04 Jan 2016 04:55:19 -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 j3sm62408812wmj.19.2016.01.04.04.55.17 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 04 Jan 2016 04:55:18 -0800 (PST) From: Jens Wiklander To: linux-arm-kernel@lists.infradead.org, Russell King Cc: Arnd Bergmann , Mark Rutland , Will Deacon , Catalin Marinas , Lorenzo Pieralisi , Kevin Hilman , Lars Persson , tyler.baker@linaro.org, Jens Wiklander Subject: [PATCH v8 3/4] arm64: add implementation for arm-smccc Date: Mon, 4 Jan 2016 13:54:38 +0100 Message-Id: <1451912079-29258-4-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451912079-29258-1-git-send-email-jens.wiklander@linaro.org> References: <1451912079-29258-1-git-send-email-jens.wiklander@linaro.org> Adds implementation for arm-smccc and enables CONFIG_HAVE_SMCCC. Acked-by: Will Deacon Signed-off-by: Jens Wiklander --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/Makefile | 2 +- arch/arm64/kernel/arm64ksyms.c | 5 +++++ arch/arm64/kernel/asm-offsets.c | 3 +++ arch/arm64/kernel/smccc-call.S | 43 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/kernel/smccc-call.S -- 1.9.1 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 871f217..96513d0 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -92,6 +92,7 @@ config ARM64 select SPARSE_IRQ select SYSCTL_EXCEPTION_TRACE select HAVE_CONTEXT_TRACKING + select HAVE_ARM_SMCCC help ARM 64-bit (AArch64) Linux support. diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 474691f..0170bea 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -17,7 +17,7 @@ arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ hyp-stub.o psci.o psci-call.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 + smp.o smp_spin_table.o topology.o smccc-call.o extra-$(CONFIG_EFI) := efi-entry.o diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c index 3b6d8cc..678f30b0 100644 --- a/arch/arm64/kernel/arm64ksyms.c +++ b/arch/arm64/kernel/arm64ksyms.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -68,3 +69,7 @@ EXPORT_SYMBOL(test_and_change_bit); #ifdef CONFIG_FUNCTION_TRACER EXPORT_SYMBOL(_mcount); #endif + + /* arm-smccc */ +EXPORT_SYMBOL(arm_smccc_smc); +EXPORT_SYMBOL(arm_smccc_hvc); diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 25de8b2..bb493d4 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -28,6 +28,7 @@ #include #include #include +#include int main(void) { @@ -161,5 +162,7 @@ int main(void) DEFINE(SLEEP_SAVE_SP_PHYS, offsetof(struct sleep_save_sp, save_ptr_stash_phys)); DEFINE(SLEEP_SAVE_SP_VIRT, offsetof(struct sleep_save_sp, save_ptr_stash)); #endif + DEFINE(ARM_SMCCC_RES_X0_OFFS, offsetof(struct arm_smccc_res, a0)); + DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2)); return 0; } diff --git a/arch/arm64/kernel/smccc-call.S b/arch/arm64/kernel/smccc-call.S new file mode 100644 index 0000000..ae0496f --- /dev/null +++ b/arch/arm64/kernel/smccc-call.S @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2015, Linaro Limited + * + * 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. + * + */ +#include +#include + + .macro SMCCC instr + .cfi_startproc + \instr #0 + ldr x4, [sp] + stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS] + stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS] + ret + .cfi_endproc + .endm + +/* + * void arm_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2, + * unsigned long a3, unsigned long a4, unsigned long a5, + * unsigned long a6, unsigned long a7, struct arm_smccc_res *res) + */ +ENTRY(arm_smccc_smc) + SMCCC smc +ENDPROC(arm_smccc_smc) + +/* + * void arm_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2, + * unsigned long a3, unsigned long a4, unsigned long a5, + * unsigned long a6, unsigned long a7, struct arm_smccc_res *res) + */ +ENTRY(arm_smccc_hvc) + SMCCC hvc +ENDPROC(arm_smccc_hvc)