From patchwork Wed Dec 2 09:47:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 57541 Delivered-To: patches@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2753523lbb; Wed, 2 Dec 2015 01:47:47 -0800 (PST) X-Received: by 10.194.117.228 with SMTP id kh4mr3151495wjb.171.1449049667384; Wed, 02 Dec 2015 01:47:47 -0800 (PST) Return-Path: Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com. [2a00:1450:400c:c09::232]) by mx.google.com with ESMTPS id gy4si3180673wjc.133.2015.12.02.01.47.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Dec 2015 01:47:47 -0800 (PST) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:400c:c09::232 as permitted sender) client-ip=2a00:1450:400c:c09::232; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:400c:c09::232 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dkim=pass header.i=@linaro-org.20150623.gappssmtp.com Received: by wmuu63 with SMTP id u63so207089198wmu.0 for ; Wed, 02 Dec 2015 01:47:47 -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=SoBYC9jWrPF0qYLDN3l/Dzq4B8KxRKHk3SbDdfghQsA=; b=E2KNT+8BZz3DCJ3Kn7tP8WSs0eP0tbXX3K7Z/YrW+OQR7kDQEBY3JSS4kylAzaKPI3 +slSjtF6u8lBiRo/PmNfMLDSKCd0lHjZoVYvR5ltmAlVwo3YYyOBHHg33ZvsEwz0PhtE ykCra9c1ikiEGLBt0U89aFEYXDrEhgcKrzF15xU8F84Nb5QIF8iEGJHgfwbkmhIOujGn GBt1ohYQhQ86ujwRdDGzm7ZCAriARcbqk4eQAOxrRg/7BqmiFhc0TOIaqWbmf/+/V191 NXOMnSqHbXj6KLtZJckp1ZS2imUzFxxv2JvqvQYDdKzBGIZy2MroU/0nPuj5eRgXt2qy uo/g== 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=SoBYC9jWrPF0qYLDN3l/Dzq4B8KxRKHk3SbDdfghQsA=; b=KbAfQ4S5Q7572xaCc5ri6hQPAOjkX57kH7u2D4RlgNm0yaLhYkIfwFLBe8YP/K/t6A bC4xZ3S2DK8CMrQBdlRMhFBtv3llyvaFeVw5mLbmnB9807pW6Fy7OSf/Q3zUpnBqsj4m f3miLd7jkTeBtK+LRx9+SNqm1NKvMeCcngUR56zl2xGVpBS/5QpfiA95HfNjvP5uLMaD 31gCk1ASZrXkZsec+piYJiuCbDuqgyVb3txscv0hb+saqfhdWiRXCM2GtCMR1l5nIADm TMX3dffMlxEfwgdoluBZ588b5YwJ9sJpMtt6uUAvT909TmfxX9vTHj51u8tuCbeKf3jx jc8w== X-Gm-Message-State: ALoCoQn3crfrAytAA1AaK1RR6V7xmk/uHxeJIoIBgUlHsKZs8I7xP7M0CitIb2yOqYIbSs8+E4uf X-Received: by 10.28.54.165 with SMTP id y37mr4535769wmh.55.1449049667146; Wed, 02 Dec 2015 01:47:47 -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 bh6sm1987805wjb.0.2015.12.02.01.47.45 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 Dec 2015 01:47:45 -0800 (PST) From: Jens Wiklander To: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Mark Rutland , Will Deacon , Catalin Marinas , Russell King , Lorenzo Pieralisi Cc: Lars Persson , Jens Wiklander Subject: [PATCH v4 3/4] arm64: add implementation for arm-smccc Date: Wed, 2 Dec 2015 10:47:05 +0100 Message-Id: <1449049626-13991-4-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449049626-13991-1-git-send-email-jens.wiklander@linaro.org> References: <1449049626-13991-1-git-send-email-jens.wiklander@linaro.org> Adds implementation for arm-smccc and enables CONFIG_HAVE_SMCCC. Signed-off-by: Jens Wiklander Acked-by: Will Deacon --- 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)