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.4 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,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 2A3F9C433ED for ; Mon, 10 May 2021 15:58:42 +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 926F16161E for ; Mon, 10 May 2021 15:58:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 926F16161E 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=yOpu9CpNstZScTwklbEZSk5POcHfPW068gdeuKJWZfs=; b=P5uLVdAm3hHoQONQVSQUbPlDuR FM0gSw5vAL/Tl9UhUWGCMHx31TaitFljk3s/3k97rXmWzAS2gZ0lSGcjHFo/Tew2V1DB+YZlNJQCc vTsa4MS4DmgJfwWZWwqe7udTzCGhTfh3cOPVnzPP8SlSWXM0pjRfPf7cpOxvsWlqgfAuRVvxxf6iE NhBLkqZEtxmXoZKd1J3WKYB/NBxomRwByWHyIViHL8/T83uVbAf/mW45gQMpq3VbdUYSp+utOTvyN C7VtpTMg/nVKbGdQo4rQbpAOKkP68TuN6pUfwpTxPAVNxcuZHlF87yzc7Z9LJqmHFHWdYHcUpxIiG WKGIUc0w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg8HX-00EqVc-1q; Mon, 10 May 2021 15:57:19 +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 1lg8H9-00EqPq-Ml for linux-arm-kernel@desiato.infradead.org; Mon, 10 May 2021 15:56:55 +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=t9Voq7+s67K4JPJuXRWDo+IPXsDBov1yUL51f/GJyz4=; b=V1/E5aBmsWnJUHT0taPDV4Jhj0 rh4LZZNImyntLUpLd4zB4biyyYBAGbumxdi7j03WFM8SFNTmX4PPM1mLKZG6thjvOhxkQn7gLKfqr OG14emXcqNnEzMHvIa3ov4ZhJ9+tXLaxBfJKfUmt6ljlajVRKX9S/Y65rngbFwB8cASKqp7CbtFjf MWkmRKxIrDFL4KJvcEGZPI7eJrn3XAf8RqM8fCWexJWzEZLkVk1gU2WVXvX1u6ygBLeevNgWzEMMF CLce0++2jKC8W1Z6oRk9b7nvZ/dzNGYYR7V+LJNMmA0TQEybrE13jPljTYfegQwSDLYRPk/RyvSmi WEYZUhmQ==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg8H6-008tLu-NB for linux-arm-kernel@lists.infradead.org; Mon, 10 May 2021 15:56:54 +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 CEFC11692; Mon, 10 May 2021 08:56:51 -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 E2BC33F73B; Mon, 10 May 2021 08:56:50 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org, will@kernel.org, catalin.marinas@arm.com Cc: james.morse@arm.com, mark.rutland@arm.com, maz@kernel.org Subject: [PATCH 02/14] arm64: entry: unmask IRQ+FIQ after EL0 handling Date: Mon, 10 May 2021 16:56:09 +0100 Message-Id: <20210510155621.52811-3-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20210510155621.52811-1-mark.rutland@arm.com> References: <20210510155621.52811-1-mark.rutland@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_085652_827245_3357CCE5 X-CRM114-Status: GOOD ( 14.27 ) 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 For non-fatal exceptions taken from EL0, we expect that at some point during exception handling it is possible to return to a regular process context with all exceptions unmasked (e.g. as we do in do_notify_resume()), and we generally aim to unmask exceptions wherever possible. While handling SError and debug exceptions from EL0, we need to leave some exceptions masked during handling. Handling SError requires us to mask SError (which also requires masking IRQ+FIQ), and handing debug exceptions requires us to mask debug (which also requires masking SError+IRQ+FIQ). Once do_serror() or do_debug_exception() has returned, we no longer need to mask exceptions, and can unmask them all, which is what we did prior to commit: 9034f6251572a474 ("arm64: Do not enable IRQs for ct_user_exit") ... where we had to mask IRQs as for context_tracking_user_exit() expected IRQs to be masked. Since then, we realised that our context tracking wasn't entirely correct, and reworked the entry code to fix this. As of commit: 23529049c6842382 ("arm64: entry: fix non-NMI user<->kernel transitions") ... we consistently call context_tracking_user_exit() later as part of ret_to_user. Prior to this we can transiently unmask exceptions (e.g. as part of do_notify_resume), and we always mask all exceptions prior to calling context_tracking_user_exit(). Thus, there's no longer a reason to leave IRQs or FIQs masked at the end of el0_dbg() or el0_error(), so let's bring these into line with other EL0 exceptions handlers and unmask all exceptions after the handler is finished. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: James Morse Cc: Marc Zyngier Cc: Will Deacon --- arch/arm64/kernel/entry-common.c | 2 +- arch/arm64/kernel/entry.S | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 340d04e13617..02be1517e08f 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -398,7 +398,7 @@ static void noinstr el0_dbg(struct pt_regs *regs, unsigned long esr) enter_from_user_mode(); do_debug_exception(far, esr, regs); - local_daif_restore(DAIF_PROCCTX_NOIRQ); + local_daif_restore(DAIF_PROCCTX); } static void noinstr el0_svc(struct pt_regs *regs) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 3513984a88bd..6b2f6f5c5bb8 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -794,7 +794,7 @@ el0_error_naked: mov x0, sp mov x1, x25 bl do_serror - enable_da + enable_daif b ret_to_user SYM_CODE_END(el0_error) -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel