From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B615C433ED for ; Wed, 19 May 2021 13:10:31 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA6296135F for ; Wed, 19 May 2021 13:10:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA6296135F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tRzz9tunZvKt1L4EEUarn1Gvn1h+c/28Qw5DRxGQEZc=; b=QK46ewS0+Xkndb29r5FYd//X3u RdHE0WNWZoCJ8JXvA6CA7c2eaIexsF6hjkeyU7FbKr2sGxeFKW6pf3tH7G9RyiqG88YooGi0GRlpW tsUHGRzn/f4Hr5DILT1JJKT3L5X1N4tq+jTKR7t6ad/51oUdAW/SKYQE0KKglNNN5C4aLc33Krp+7 J06wADQ619BlQ1p0JpujmUwk2c2x1MhbiMauXpU7aonLHGpIz+2/hNxc7DA3bpjXwzdOsXa3GYL98 jFPoDtfbA3pMP4GzZBZ/dM/R1YvfgnzJrOc0QBbVNx4FSmMt4ciTt3v2ytaD3T4X+RGIageIn3JRT e+85kV9Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljLw9-0042T9-7C; Wed, 19 May 2021 13:08:33 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljLVx-003wWL-AC for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 12:41:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description; bh=TcRyWRhkX3o976xkKzyB5hIgbTW4WaBADqaw8SAQna4=; b=vipnSi9f9x7OHw3pY3uqxRurX3 DVQU/MpsAKlqpYKrwlmhvucEF1KYICecyZ8qiEv2J/oDnAFfA4E/JMmzDmLq8heGNiDjGdh3VqvjE dA+f1KkdtO3/ePl79Mbmqodq4549GKNSaC4MJd3zPvgOrRsnIwT9jXmU3XagJmyMxo7156JSUFNML 7U8g7VBAVjoJ0pt5uPv/QS1U6Z6YKvA7eOrwrI7nq4OijMhv7GQjTgNBPbT8VK0y+uGOAmyymR7mO R1wVwIDta52AsQCczMkv2Dv+gjNQItTRZFgX2qzDVjAbljq9WB471STpYoTX1A9nT1u5zwd+Zxqjk kAih5vxg==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljLVu-00FSpF-AR for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 12:41:27 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B3444101E; Wed, 19 May 2021 05:41:25 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B27C43F73B; Wed, 19 May 2021 05:41:24 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, james.morse@arm.com, mark.rutland@arm.com, maz@kernel.org, will@kernel.org, joey.gouly@arm.com Subject: [PATCH v2 13/19] arm64: entry: template the entry asm functions Date: Wed, 19 May 2021 13:38:56 +0100 Message-Id: <20210519123902.2452-14-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210519123902.2452-1-mark.rutland@arm.com> References: <20210519123902.2452-1-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_054126_471747_4E42F8DF X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that the majority of the exception triage logic has been converted to C, the entry assembly functions all have a uniform structure. Let's generate them all with an assembly macro to reduce the amount of code and to ensure they all remain in sync if we make changes in future. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: James Morse Cc: Marc Zyngier Cc: Will Deacon --- arch/arm64/kernel/entry.S | 124 ++++++++++------------------------------------ 1 file changed, 27 insertions(+), 97 deletions(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 9b662d4c09d8..d4f80b9df621 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -610,114 +610,44 @@ SYM_CODE_START_LOCAL(el1_error_invalid) inv_entry 1, BAD_ERROR SYM_CODE_END(el1_error_invalid) -/* - * EL1 mode handlers. - */ - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el1_sync) - kernel_entry 1 - mov x0, sp - bl el1_sync_handler - b ret_to_kernel -SYM_CODE_END(el1_sync) - - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el1_irq) - kernel_entry 1 - mov x0, sp - bl el1_irq_handler - b ret_to_kernel -SYM_CODE_END(el1_irq) - - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el1_fiq) - kernel_entry 1 - mov x0, sp - bl el1_fiq_handler - b ret_to_kernel -SYM_CODE_END(el1_fiq) - + .macro entry_handler el:req, regsize:req, label:req .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el1_error) - kernel_entry 1 +SYM_CODE_START_LOCAL_NOALIGN(el\el\()_\label) + kernel_entry \el, \regsize mov x0, sp - bl el1_error_handler + bl el\el\()_\label\()_handler + .if \el == 0 + b ret_to_user + .else b ret_to_kernel -SYM_CODE_END(el1_error) - -SYM_CODE_START_LOCAL(ret_to_kernel) - kernel_exit 1 -SYM_CODE_END(ret_to_kernel) + .endif +SYM_CODE_END(el\el\()_\label) + .endm /* - * EL0 mode handlers. + * Early exception handlers */ - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el0_sync) - kernel_entry 0 - mov x0, sp - bl el0_sync_handler - b ret_to_user -SYM_CODE_END(el0_sync) + entry_handler 1, 64, sync + entry_handler 1, 64, irq + entry_handler 1, 64, fiq + entry_handler 1, 64, error - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el0_irq) - kernel_entry 0 - mov x0, sp - bl el0_irq_handler - b ret_to_user -SYM_CODE_END(el0_irq) - - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el0_fiq) - kernel_entry 0 - mov x0, sp - bl el0_fiq_handler - b ret_to_user -SYM_CODE_END(el0_fiq) - - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el0_error) - kernel_entry 0 - mov x0, sp - bl el0_error_handler - b ret_to_user -SYM_CODE_END(el0_error) + entry_handler 0, 64, sync + entry_handler 0, 64, irq + entry_handler 0, 64, fiq + entry_handler 0, 64, error #ifdef CONFIG_COMPAT - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el0_sync_compat) - kernel_entry 0, 32 - mov x0, sp - bl el0_sync_compat_handler - b ret_to_user -SYM_CODE_END(el0_sync_compat) - - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el0_irq_compat) - kernel_entry 0, 32 - mov x0, sp - bl el0_irq_compat_handler - b ret_to_user -SYM_CODE_END(el0_irq_compat) - - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el0_fiq_compat) - kernel_entry 0, 32 - mov x0, sp - bl el0_fiq_compat_handler - b ret_to_user -SYM_CODE_END(el0_fiq_compat) - - .align 6 -SYM_CODE_START_LOCAL_NOALIGN(el0_error_compat) - kernel_entry 0, 32 - mov x0, sp - bl el0_error_compat_handler - b ret_to_user -SYM_CODE_END(el0_error_compat) + entry_handler 0, 32, sync_compat + entry_handler 0, 32, irq_compat + entry_handler 0, 32, fiq_compat + entry_handler 0, 32, error_compat #endif +SYM_CODE_START_LOCAL(ret_to_kernel) + kernel_exit 1 +SYM_CODE_END(ret_to_kernel) + /* * "slow" syscall return path. */ -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel