From patchwork Wed Nov 11 10:04:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 7594731 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 377EFBF90C for ; Wed, 11 Nov 2015 10:08:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3368A206FA for ; Wed, 11 Nov 2015 10:08:10 +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 3F9DF2055D for ; Wed, 11 Nov 2015 10:08:09 +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 1ZwSIC-0001cM-6u; Wed, 11 Nov 2015 10:06:16 +0000 Received: from mail-lf0-x235.google.com ([2a00:1450:4010:c07::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZwSHG-0008Ll-BJ for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2015 10:05:21 +0000 Received: by lfs39 with SMTP id 39so13475326lfs.3 for ; Wed, 11 Nov 2015 02:04:56 -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=pVnoitGUPomrFxf/exaKJu7dkGE6aOb5gaKtx7dkeEI=; b=Fe2fs/O7pOWYbzwjK0g+BVh9nrMYSqu5fsst5Hv2vD2mJ8l8s3c0ZYIMkGIQiufP5M 2AXtsqTUJ8Gg6hwBGmmwJT6t3MQAnohAnxN1drTZ8gBjJka46J/kISCNKjK5Znw6e0u6 d5iFuveeYh0ATOznV24XjA1HYYZRQD5/qnKrlIZ6kuyB7EVWAuVpINhH5gRzvPFcmzoO Ebtes4J300/FUEeZC9JHKd9Ud+Jtz0twk9e8cfIJlMFjU5qFlDjN9qKuHYYpCcW+Zz8v XPBWN7xiCkyuZZ11+otKZTFFVrYCku7nkAE0uW+64Nd6F22VXU9RoC9sH7nzdGhc7bQ3 ql/A== 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=pVnoitGUPomrFxf/exaKJu7dkGE6aOb5gaKtx7dkeEI=; b=hR0i2G9R1hoYq7CKMXt2DjRcP4kjsI6R/mI/Zp9CTKvh2/NXqmNfKryTJIBSfIHv/r i992LSr71qYLfEPpcTurvbcKRFw3V4PhIqRymYQ7w33dY8LwR5M18qQn356tIS9H1Us9 Kb3J9XQ7WjBQuhe2tNCy6m4EhJnANucEYypb3qsUsP9OqtLVe1OgLf6keoXtTJOAUrx4 +gv0/+49Sjq+5wFIrEChMJMD8qJx7ihtD545rybO8Mbo0m4yrd407HarG6iQIp+st6EX +6xdDGZVoAxYh0dKWtayahIb/vczcTxmndHqlHUwvGu2zz0KHNe9URGQOq6VeQ9cUB+x WYYQ== X-Gm-Message-State: ALoCoQmFQ2UsbD9dnyAkFGe3dzx2PdVFCAC4cDGVFAxv/Z6UropHMcgwmDzxece7ieD+lkgrMc17 X-Received: by 10.25.154.203 with SMTP id c194mr4163510lfe.32.1447236296438; Wed, 11 Nov 2015 02:04:56 -0800 (PST) Received: from ermac.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 102sm1344558lft.21.2015.11.11.02.04.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Nov 2015 02:04:55 -0800 (PST) From: Jens Wiklander To: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , Mark Rutland , Will Deacon , Catalin Marinas , Russell King Subject: [PATCH v2 3/4] arm64: add implementation for arm-smccc Date: Wed, 11 Nov 2015 11:04:25 +0100 Message-Id: <1447236266-7491-4-git-send-email-jens.wiklander@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1447236266-7491-1-git-send-email-jens.wiklander@linaro.org> References: <1447236266-7491-1-git-send-email-jens.wiklander@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151111_020519_044206_F508F37B X-CRM114-Status: GOOD ( 18.89 ) 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: Jens Wiklander , Lars Persson 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.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 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 | 43 +++++++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/smccc.c | 18 +++++++++++++++++ 5 files changed, 66 insertions(+) create mode 100644 arch/arm64/kernel/smccc-call.S create mode 100644 arch/arm64/kernel/smccc.c 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..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) 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);