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 118E7C98302 for ; Tue, 22 Sep 2026 17:00:49 +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=hkbIO/3RlJRJKqUI/kyd3ndy8/wZKmkrLF5NZLtKMhQ=; b=tgdf+WCxQh12naYnwMu3hBMGSb THRSegbAucVzb97iR/LhxuwqdzjgX+3o/E4jPoc6PMCyHmVfJiim7S9DT7qlyvDC1uQHquoZkqeh1 eT0FU/PEA9ds8EdD4XiNfyF0cLBgBT6uzEkf+IYa1Gce6hu88Lh3FPsdInvcO4/vip6IO4F5Ypf0J mHlulpl5k+PM/Fh7pUllLJ4AVptesvOFb9jKsrAeaysWKdKfGhTOzL+iy2uoHb+rFfhhXEZ1/lOvl 1lMzedZEceCn9ai6CnH47pXy4IQ8+e99fpj+lITq1mvvdlcKoVdnUy/u6hpG/o4iaCzrHkWoRkmBJ 8/H3w+0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x93rH-000000068GV-0GQK; Tue, 22 Sep 2026 17:00:43 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x93rF-000000068G4-45T4 for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2026 17:00:42 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 3F3AC6022A; Tue, 22 Sep 2026 17:00:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A19C1F000FF; Tue, 22 Sep 2026 17:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790096441; bh=hkbIO/3RlJRJKqUI/kyd3ndy8/wZKmkrLF5NZLtKMhQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=LqXZGXqaLjkFDIzwFlI6q+vkKAq7m+BINOi+28VgGxjClWFshGQKzhz4+WWMNM/e9 mcXzP7/bvMPsccb2QzoQbvn1n0f3Ira82z1K2dyKZDCtDJ/xca+1go4QTyq9ADhMPl e646ubQDlz/zDQbWD9USzL3Xpx1xrL5hbyaBp+Iz1E9xrcVDORckiM6yYKgcQ6aqLF ESXQ76Y0oHmS0OQNemfiKS+E9eKbW+L6ZiHFOLZu0DLgMCHxF8GGgGFRZBEtEKUlNJ rpIGinEZTrGGSC9sajOcY54fHK/T//JTs9FVjP2HW7t2xUcgivJgiv/RvfNJO0O2Lw lq/i2er5dMtBg== Date: Tue, 22 Sep 2026 10:00:39 -0700 From: Oliver Upton To: "Lorenzo Stoakes (ARM)" Cc: Catalin Marinas , Will Deacon , Marc Zyngier , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Paolo Bonzini , Jonathan Corbet , Mark Rutland , Fuad Tabba , Randy Dunlap , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Jack Thomson , Jack Thomson , Alexandru Elisei , Vincent Donnefort , "Aneesh Kumar K.V" , Sean Christopherson , Claudio Imbrenda , Leo Soares Passos , Wei-Lin Chang Subject: Re: [PATCH v3 02/14] arm64: Add ESR fault helpers Message-ID: References: <20260922-kvm-arm-prefault-v3-0-787bd3bc7e3f@kernel.org> <20260922-kvm-arm-prefault-v3-2-787bd3bc7e3f@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260922-kvm-arm-prefault-v3-2-787bd3bc7e3f@kernel.org> 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 Tue, Sep 22, 2026 at 03:17:56PM +0100, Lorenzo Stoakes (ARM) wrote: > Add helper functions which operate directly on an ESR value rather than > trying to access the register itself. > > These mirror equivalent KVM vCPU wrappers in kvm_emulate.h and allow those > wrappers and KVM's stage-2 fault handling to operate on a plain ESR value. > > This is needed to later generate a synthetic fault for the stage-2 page > table pre-faulting mechanism. > > No functional change intended. > > Signed-off-by: Lorenzo Stoakes (ARM) > --- > arch/arm64/include/asm/esr.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 44 insertions(+) > > diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h > index f816f5d77f1a..9c0205983d9a 100644 > --- a/arch/arm64/include/asm/esr.h > +++ b/arch/arm64/include/asm/esr.h > @@ -437,6 +437,50 @@ > #ifndef __ASSEMBLER__ > #include > > +static __always_inline u8 esr_get_ec(unsigned long esr) > +{ > + return ESR_ELx_EC(esr); > +} Why do we need to wrap the macro in an inline function? > +static __always_inline bool esr_trap_is_iabt(unsigned long esr) > +{ > + return esr_get_ec(esr) == ESR_ELx_EC_IABT_LOW; > +} > + > +static __always_inline bool esr_abt_is_s1ptw(unsigned long esr) > +{ > + return esr & ESR_ELx_S1PTW; > +} This helper doesn't make a ton of sense outside of KVM, since ESR_ELx.S1PTW is RES0 (not RAZ) outside of a stage-2 abort. Thanks, Oliver