From patchwork Wed Nov 25 11:04:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 57293 Delivered-To: patches@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2665481lbb; Wed, 25 Nov 2015 03:04:39 -0800 (PST) X-Received: by 10.112.202.168 with SMTP id kj8mr14951494lbc.12.1448449479282; Wed, 25 Nov 2015 03:04:39 -0800 (PST) Return-Path: Received: from mail-lf0-x22e.google.com (mail-lf0-x22e.google.com. [2a00:1450:4010:c07::22e]) by mx.google.com with ESMTPS id ue3si8757312lbb.25.2015.11.25.03.04.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Nov 2015 03:04:39 -0800 (PST) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:4010:c07::22e as permitted sender) client-ip=2a00:1450:4010:c07::22e; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:4010:c07::22e as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dkim=pass header.i=@linaro-org.20150623.gappssmtp.com Received: by lfaz4 with SMTP id z4so55920079lfa.0 for ; Wed, 25 Nov 2015 03:04:39 -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=BH90Ggn/1AatQzfYCs6RisAywxic3moL2RnqvohMdGs=; b=PMPtY7n9oUmKcJVp4+dwzHajOjdPbnNKj+CbNfnMRnmi1Me6GG9k/XqBNoGdhzIuPp uH28HMqVYlaynKf8DH7+lv9mTHFQC1/ntG2Atp6Sl19W4wyz0tX+kkuaZqydkpBshzho H19ElWL+lvU/euYQ7ElZt2/MRfc1a2HAe+3mkr8ed3ZfB28eBuj+HEZrfy05oNU35HtC iZ0WgRF1LZqrNg9tdwhLjKeorRVhBMTU8OBQB4cpkGm9CyBvjg6KOqh3qpA4avg47/c2 6qt9PmETSvC+IxlXWoW1gXILDCcsFV/g4ydmSfTzQTL5VFs4zMeOVP6JtpdCAi1p5ZN5 AyrQ== 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=BH90Ggn/1AatQzfYCs6RisAywxic3moL2RnqvohMdGs=; b=QdhphKM/W6oJSupVv9uPj4dS5CFAY0aQLb2t/bJbMuzkkEBokWvkZdvNWyO+V2a5nd /GAxMW4KbT+3m5RFKnLyLE0Rpgsy22MoLIaUWo7uwFI4UwLTJr1qteF1vR4wcc4TQyQG NA1ZX+i/mQtsa0DXqOrTaufkiKU3Vx+ykQcF+SFFNHyHoOdUBzjCT7Pk3ZjxI9TjlTx6 IfDZlulugzZ97PNZLy51xUQJIR7DzTPEVZjqdtD5nR9Myrb25UZzeon5bqEuAYn5zjZM htFkphbk1FJiCwot6FwZ2YpM9OBk9Gyw2rFUytv0f9i2HABYpDuIzDRVMCoRt2mNRgcM ed0g== X-Gm-Message-State: ALoCoQmw0u5SH3B0xXjUlwLyRgZaCS/oKtAOxdpzsQHwRSRGE/5MEMjX25U0DwKIHGdVr8p3EEdF X-Received: by 10.25.170.210 with SMTP id t201mr16184869lfe.16.1448449479105; Wed, 25 Nov 2015 03:04:39 -0800 (PST) Return-Path: Received: from ermac.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id lc3sm3222630lbc.3.2015.11.25.03.04.37 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Nov 2015 03:04:37 -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 v3 3/4] arm64: add implementation for arm-smccc Date: Wed, 25 Nov 2015 12:04:20 +0100 Message-Id: <1448449461-5043-4-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448449461-5043-1-git-send-email-jens.wiklander@linaro.org> References: <1448449461-5043-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 07d1811..a7332ca 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -89,6 +89,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 22dc9bc..16d24a4 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -18,7 +18,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 arm64-obj-$(CONFIG_COMPAT) += sys32.o kuser32.o signal32.o \ sys_compat.o entry32.o \ diff --git a/arch/arm64/kernel/arm64ksyms.c b/arch/arm64/kernel/arm64ksyms.c index a85843d..b3c072b 100644 --- a/arch/arm64/kernel/arm64ksyms.c +++ b/arch/arm64/kernel/arm64ksyms.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -65,3 +66,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 8d89cf8..cfa0885 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)