From patchwork Fri Nov 8 18:49:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 178926 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3122774ilf; Fri, 8 Nov 2019 10:53:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxFKC8ZllF7H8mI9Gqniqe+GL1sfAT/W3KH1Tlo8e/jrMosvT7KGh9tsbGYkJzuYScp1IOs X-Received: by 2002:a17:906:e82:: with SMTP id p2mr10125550ejf.237.1573239194148; Fri, 08 Nov 2019 10:53:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573239194; cv=none; d=google.com; s=arc-20160816; b=YHmytWDK4PGreT+1X2/xaF8IPh5YblDti7Rn2Sye8C3H/trLsUpQyG/BxbG0cjEMMN F+DdaV7QgRQgK4EdLi2sGYzCROf01/+A6Z24Fgn/SZ6Cxp3xqz+mQ0hO5Qj8ReA4VKAd g6quYedu5G3RFV+G3YFYwbNTyjA99Iv5fneMCtCWS0209H2cNfH1MM5erkqHt7Xj8+LU rJEwYVy9VSIRJk1ZwVzBOusII7/L/AU7azFn4CGOkOVLPl38H5rj21AxYweKwz3Fn0nW M2kQpOIEXDUHaQW27Y3l5PXLYV+rcJbTgXSeHlpwxbXGi3b+uDjmmuoC4aFXC9/S/zwd IqDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qG36bQp5nYiB2OcC2lEgSuFJulAB/Da7R1nzYax5qn8=; b=cBCdMWyA46HIPa7ZcDxPV/ZcscMDaewNY++W1UnuCZ0NHQ7ZSUXui3ec2ISvz4wdSq PnBuRdDF17EXfgLAry+QLFJq2K74N5QVuHmq4jufXpwGJ3i4lwHSHXt/Qxbl0U/JRETO j/0tHZgD8yrGHotLX8rJ0C3m5KTNNZQOMBpcZtfsoMtJKFmscgXKpQPcdnXddwNXEYXc Mc7MaboS7zS1CYbNevvoRjwKSnEcJBz6yZ5GqlIC55JE9bA642Xtr8g/zkq7paAM8VoI DldAchbgIanf0otbfM5Cv9s1SvzNGUrwXxAMASCaBgQ3fbolEoaU7VxoRT1wpOr3jf/C e+ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zXb5zw2P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14si4370605eju.84.2019.11.08.10.53.13; Fri, 08 Nov 2019 10:53:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zXb5zw2P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732138AbfKHSxG (ORCPT + 26 others); Fri, 8 Nov 2019 13:53:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:49526 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732062AbfKHSxD (ORCPT ); Fri, 8 Nov 2019 13:53:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8AE272178F; Fri, 8 Nov 2019 18:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573239182; bh=okz7moNdWPsmJ7K4RPpIrtFBDE6a6Bdn6WehFWWNr2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zXb5zw2PxSpVgEFh3Ky2OLpMycobHhCREQiC0jI5QlpIK8zOfac9qfFO4Q+E4QZDj fmmLj1nwXDWOSElE8vYzGI+LfeCqfdoYFCbR74Te+jbfVKLb4AcmOZxO9qceb8GL2M LGyZV2CaUiCchflJuxxouqyQKhuRYxoo8kAO+7vk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Will Deacon , Jens Wiklander , Russell King , Ard Biesheuvel Subject: [PATCH 4.4 27/75] ARM: 8480/2: arm64: add implementation for arm-smccc Date: Fri, 8 Nov 2019 19:49:44 +0100 Message-Id: <20191108174734.422472400@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191108174708.135680837@linuxfoundation.org> References: <20191108174708.135680837@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jens Wiklander Commit 14457459f9ca2ff8521686168ea179edc3a56a44 upstream. Adds implementation for arm-smccc and enables CONFIG_HAVE_SMCCC. Acked-by: Will Deacon Signed-off-by: Jens Wiklander Signed-off-by: Russell King Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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. --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -17,7 +17,7 @@ arm64-obj-y := debug-monitors.o entry.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 --- 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); --- 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) { @@ -162,5 +163,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; } --- /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)