From patchwork Wed Nov 4 09:46:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 55969 Delivered-To: patches@linaro.org Received: by 10.112.61.134 with SMTP id p6csp2318794lbr; Wed, 4 Nov 2015 01:47:09 -0800 (PST) X-Received: by 10.112.199.231 with SMTP id jn7mr372470lbc.37.1446630429073; Wed, 04 Nov 2015 01:47:09 -0800 (PST) Return-Path: Received: from mail-lb0-x235.google.com (mail-lb0-x235.google.com. [2a00:1450:4010:c04::235]) by mx.google.com with ESMTPS id 63si383782lfv.69.2015.11.04.01.47.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Nov 2015 01:47:09 -0800 (PST) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:4010:c04::235 as permitted sender) client-ip=2a00:1450:4010:c04::235; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 2a00:1450:4010:c04::235 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dkim=pass header.i=@linaro_org.20150623.gappssmtp.com Received: by lbbkw15 with SMTP id kw15so6034028lbb.0 for ; Wed, 04 Nov 2015 01:47:08 -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=dTWZEzJHehCIqBmC5saL2jtMOt75NI8hKQR+Oy1CB9A=; b=S6kL1v0LkDJ3vsNr8XIUrUhLKp6QfT+lF/0h66LZPH0/ue8wbInmWE3Oo9ENpBCliS yL1DqBg9g6M0ETErhu1DwZLpFfqgPRMwBsklD+uk3LGimqf0F/Jq1TP13/VQOv5xIJxk oHBD71k+1asDs0fy2xLbSQvfIGVF5JWykpxrFIcy49JGQvdSsvj+5l4sOxZc0pVgyPzP 2zIfLbxDS+s9DoSulZjeA9+zXBtRiQU41rDsXtLEKUv4HmbsxGcphdd6vpyyMnPle4mQ JKVoeNoi4MsW9sXB350HPzYh3Us5Y2gEINB65qAOkqKFskvWQiDqsjppuqqvPMFAIF34 EWSg== 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=dTWZEzJHehCIqBmC5saL2jtMOt75NI8hKQR+Oy1CB9A=; b=LHt4jQfLcBdb8vnQMHpZTmpJ5dDRz/JDHFS0aChVScIFxD7O1UIsFtnOQCKsboBZcv ljw7ZMgokDWb3sxcAcE9pVxJhiuFThXEQ7XhoymWz4cekKoSlwb/NXNLdTbOOCkNjv1h s+12BKGSe+UBDPVsvOtx2bfMrxSoyUQlLKfkvXj9GqOIkrom9Bd6CSYCTve2hejOjfIr i5u6LAyMouC0KOrSrV0EB6Til3jGUD6fpa0hkOGdZXcYA2KMHjK7obrR5SHcK7J1qeJR 9kqI6YelSO7gZYlsiDoQLsyDK2jkIj6TPooiY/Q0tKaDU7JnoEXivX+nntD9rDffwyEj Ahng== X-Gm-Message-State: ALoCoQmiCX2094u3geqUlV7/A+pmNh4h/LfsF8wYX4snEfDrdfbNiZy1F99ug7CliqWy5IiPke1W X-Received: by 10.112.77.10 with SMTP id o10mr418969lbw.28.1446630428895; Wed, 04 Nov 2015 01:47:08 -0800 (PST) Return-Path: Received: from ermac.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id qh2sm74250lbb.42.2015.11.04.01.47.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Nov 2015 01:47:07 -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 3/4] arm64: add implementation for arm-smccc Date: Wed, 4 Nov 2015 10:46:11 +0100 Message-Id: <1446630372-1598-4-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446630372-1598-1-git-send-email-jens.wiklander@linaro.org> References: <1446630372-1598-1-git-send-email-jens.wiklander@linaro.org> Adds implementation for arm-smccc and enables CONFIG_HAVE_SMCCC. Signed-off-by: Jens Wiklander --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/Makefile | 1 + arch/arm64/kernel/asm-offsets.c | 3 +++ arch/arm64/kernel/smccc-call.S | 41 +++++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/smccc.c | 18 ++++++++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 arch/arm64/kernel/smccc-call.S create mode 100644 arch/arm64/kernel/smccc.c -- 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..c61d758 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -36,6 +36,7 @@ arm64-obj-$(CONFIG_EFI) += efi.o efi-stub.o efi-entry.o arm64-obj-$(CONFIG_PCI) += pci.o arm64-obj-$(CONFIG_ARMV8_DEPRECATED) += armv8_deprecated.o arm64-obj-$(CONFIG_ACPI) += acpi.o +arm64-obj-$(CONFIG_HAVE_ARM_SMCCC) += smccc-call.o smccc.o obj-y += $(arm64-obj-y) vdso/ obj-m += $(arm64-obj-m) 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..2a45d99 --- /dev/null +++ b/arch/arm64/kernel/smccc-call.S @@ -0,0 +1,41 @@ +/* + * 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 + \instr #0 + ldr x4, [sp] + stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS] + stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS] + ret + .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) diff --git a/arch/arm64/kernel/smccc.c b/arch/arm64/kernel/smccc.c new file mode 100644 index 0000000..7941210 --- /dev/null +++ b/arch/arm64/kernel/smccc.c @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2015, Linaro Limited + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * 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 + +EXPORT_SYMBOL_GPL(arm_smccc_smc); +EXPORT_SYMBOL_GPL(arm_smccc_hvc);