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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47E69C27C77 for ; Mon, 17 Jun 2024 09:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=h3saKnHW+zlUerVddO/T45QFoTS1SwCXUtz1NOEbpIE=; b=RmAiZXx8GMz/Xd/RTmx4l9W4Yk Cil4JGS+raFsI7+thVCCDYQMDSFY/Fq/uPyBWk0sh6XsqtZvrgSQsgjWo3zgxDlihpnJKdrZHxSlf 22vrIq/mjgS6eGY0nmcE6HhAHU/PkHEr59LmN5HH21J+o7WmUAXmocvXRCiJVbyvfSjRZOz98L6Hl df/yyI6LThLo0TnwvPbsYGgS8gTrazT32JN1Kp5BZgRRujYwd+ka2WC40JcoBcwrgHUeWGIqvCixs 2D7My0zaWcbbcCVVyGZ7RLphOWAvYATWhim/dGoAO7WeoKC5hjbR1GDipQHCyhmBMQOCOXTf7Fe96 4g48EV4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJ8kk-0000000A3Xi-2CwE; Mon, 17 Jun 2024 09:34:18 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJ8kg-0000000A3VC-3wZ8 for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2024 09:34:16 +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 1BDDFDA7; Mon, 17 Jun 2024 02:34:36 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 49A5E3F64C; Mon, 17 Jun 2024 02:34:10 -0700 (PDT) Date: Mon, 17 Jun 2024 10:34:01 +0100 From: Mark Rutland To: Anshuman Khandual Cc: Marc Zyngier , linux-arm-kernel@lists.infradead.org, ryan.roberts@arm.com, Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/mm: Drop ESR_ELx_FSC_TYPE Message-ID: References: <20240613094538.3263536-1-anshuman.khandual@arm.com> <86y179jdbx.wl-maz@kernel.org> <87cyoj3j44.wl-maz@kernel.org> <45ace175-9b59-4ba2-91b8-b96151c03c05@arm.com> <86iky8j9ow.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240617_023415_082770_E4730517 X-CRM114-Status: GOOD ( 19.11 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 17, 2024 at 02:09:27PM +0530, Anshuman Khandual wrote: > On 6/17/24 13:13, Marc Zyngier wrote: > > On Mon, 17 Jun 2024 04:15:40 +0100, > > Anshuman Khandual wrote: > >> > >> Does the following re-worked patch looks okay ? Earlier set_thread_esr() changes > >> can be dropped from arch/arm64/mm/fault.c and also the original commit message > >> still makes sense. > >> > >> diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h > >> index 7abf09df7033..6cd13ac61005 100644 > >> --- a/arch/arm64/include/asm/esr.h > >> +++ b/arch/arm64/include/asm/esr.h > >> @@ -121,6 +121,13 @@ > >> #define ESR_ELx_FSC_SECC (0x18) > >> #define ESR_ELx_FSC_SECC_TTW(n) (0x1c + (n)) > >> > >> +/* Status codes for individual page table levels */ > >> +#define ESR_ELx_FSC_ACCESS_L(n) (ESR_ELx_FSC_ACCESS + n) > >> +#define ESR_ELx_FSC_FAULT_nL (0x2C) > >> +#define ESR_ELx_FSC_FAULT_L(n) (((n) < 0 ? ESR_ELx_FSC_FAULT_nL : \ > >> + ESR_ELx_FSC_FAULT) + (n)) > >> +#define ESR_ELx_FSC_PERM_L(n) (ESR_ELx_FSC_PERM + n) > >> + > >> /* ISS field definitions for Data Aborts */ > >> #define ESR_ELx_ISV_SHIFT (24) > >> #define ESR_ELx_ISV (UL(1) << ESR_ELx_ISV_SHIFT) > >> @@ -388,20 +395,33 @@ static inline bool esr_is_data_abort(unsigned long esr) > >> > >> static inline bool esr_fsc_is_translation_fault(unsigned long esr) > >> { > >> - /* Translation fault, level -1 */ > >> - if ((esr & ESR_ELx_FSC) == 0b101011) > >> - return true; > >> - return (esr & ESR_ELx_FSC_TYPE) == ESR_ELx_FSC_FAULT; > >> + esr = esr & ESR_ELx_FSC; > >> + > >> + return (esr == ESR_ELx_FSC_FAULT_L(3)) || > >> + (esr == ESR_ELx_FSC_FAULT_L(2)) || > >> + (esr == ESR_ELx_FSC_FAULT_L(1)) || > >> + (esr == ESR_ELx_FSC_FAULT_L(0)) || > >> + (esr == ESR_ELx_FSC_FAULT_L(-1)); > >> } > >> > >> static inline bool esr_fsc_is_permission_fault(unsigned long esr) > >> { > >> - return (esr & ESR_ELx_FSC_TYPE) == ESR_ELx_FSC_PERM; > >> + esr = esr & ESR_ELx_FSC; > >> + > >> + return (esr == ESR_ELx_FSC_PERM_L(3)) || > >> + (esr == ESR_ELx_FSC_PERM_L(2)) || > >> + (esr == ESR_ELx_FSC_PERM_L(1)) || > >> + (esr == ESR_ELx_FSC_PERM_L(0)); > >> } > >> > >> static inline bool esr_fsc_is_access_flag_fault(unsigned long esr) > >> { > >> - return (esr & ESR_ELx_FSC_TYPE) == ESR_ELx_FSC_ACCESS; > >> + esr = esr & ESR_ELx_FSC; > >> + > >> + return (esr == ESR_ELx_FSC_ACCESS_L(3)) || > >> + (esr == ESR_ELx_FSC_ACCESS_L(2)) || > >> + (esr == ESR_ELx_FSC_ACCESS_L(1)) || > >> + (esr == ESR_ELx_FSC_ACCESS_L(0)); > >> } > >> > >> /* Indicate whether ESR.EC==0x1A is for an ERETAx instruction */ > > > > This looks better indeed. > > Thanks Marc. > > Hello Mark/Ryan, > > Could I still keep your tags for the patch, or it's better to just > drop them as there are some new changes being folded in. Please do > advise. Thank you. Just drop them for now -- we can easily reply with new tags (and I probably will, as the above looks sane to me). Mark.