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 1E828C98302 for ; Tue, 22 Sep 2026 18:13:11 +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=CkCRLFxPHHGYCNcpfamPUAWq4+0JQ01hkaddMI1o5c0=; b=xsLqcQ9yOSj4qP5NvDicL4Rg7R QX3PZ364C2JC2g9tORCLj6xQPdysPWPWIXGUZw4424X2//Lj1LxcAr4kx9JdZNqZRTdz7RUG/zaUU RPsrBquDAP5TfaOS8QLePP56zYDDGpLj7Kuh/uPtmTR6xNG3D6vWkTie/SH2bMPv2A13kRJl+KZ3L 0gItU05GKMjkhm7TAZD5D353DlG+rU2sWeiYEmGN+wy9UH3m1q7FuA+qu/6p6QwJZ7buakahUAuBO k+JLuPvR2FkJ9yz+VP4JeHhn1g5NJYTKg1LuY7cXEdGhWCJXpIUWUH/hEfQLuH5eZlLlYM1LeBl1b DQzhHzlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x94zJ-00000006H8q-498D; Tue, 22 Sep 2026 18:13:06 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x94zI-00000006H8e-2SMX for linux-arm-kernel@lists.infradead.org; Tue, 22 Sep 2026 18:13:04 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 1259E43B4C; Tue, 22 Sep 2026 18:13:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89B2B1F000FF; Tue, 22 Sep 2026 18:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790100784; bh=CkCRLFxPHHGYCNcpfamPUAWq4+0JQ01hkaddMI1o5c0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=aEnsGW0yAgw4LKhTybjTtlcqCi/fZB3g6qFJkA4kXBn1yUrqJyBxJzpOQAX/hUpUC ZAJRHQspZybQ7ZzGv/GdWpa2tvJfCUTqAC6ZZJp/oV8xUtiBjvLpc//89ADZF4TvpI KQJ0T16D3hJwV88PhMcUfsnhEI/h1wCQSFRTSgW1dbeVA01Med4Y3Nc6OxkLy5dG+B b5OLTCoae+BMC/IHCa84m4y3H7c7P9/vo8dU6t5VAFYf0w4SQjsv04OJ3Tbbmo7HP+ poTO7r99P8IjzoEM2qzkAmuXldgPsljt/60qH78l2y/OYoQ5EN+3spVB92F1wcveIk k5NgQ9ESfR2bg== Date: Tue, 22 Sep 2026 11:13:02 -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: 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 06:45:43PM +0100, Lorenzo Stoakes (ARM) wrote: > On Tue, Sep 22, 2026 at 10:00:39AM -0700, Oliver Upton wrote: > > 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? > > It seemed like a more consistent way of doing this but looking through the code > ESR_ELx_EC() is referenced directly in quite a few places so will swap out. > > > > > > +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. > > OK, kvm_emulate.h better? Works for me, thanks! Best, Oliver