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 2EA1FC48BC4 for ; Tue, 20 Feb 2024 12:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0LnOeuYa7D/vJg2IZurbWWdAdiXPqFx6YvJeUnOkNgA=; b=zJBXfmcEnsn4/p Nxy5L24AHR2gHlqWf16O3fOcPk335wEx26WGyOLHMu0LcQt4E661f7VPyi58wCby4T4/yJZDheCR1 J4zNVp7NFqMO0weA19JCdNI1CMkHQ94OACqysMc1CJ123Gb4aGKS613rDkwwzCPRfBJJRtrtgTbtL QdlTlxO8/nd2d0GxeG1BzOdPZbTBwohwLrC9u1y+gpA2jt9ulAaLbXg8SBKFf0sg29SaKWWSBgKgW ih213umcShSANtS/D0tv+RP3HSak6JlqBZr3S4YG/1f+gPZwme5hmVcFlq+7Eydy1SmniT+7YT4+6 myEFCjMp6CczBgSRx+Yw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcPFh-0000000EhMS-188M; Tue, 20 Feb 2024 12:29:37 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcPFe-0000000EhLK-0WVv for linux-arm-kernel@lists.infradead.org; Tue, 20 Feb 2024 12:29:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 405D260C94; Tue, 20 Feb 2024 12:29:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCA0DC433C7; Tue, 20 Feb 2024 12:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708432172; bh=8m22g+Ahfu3JukKQ7xiuwIYdtui1QkCaMrKFG3Bu9fU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uQuCyfOG4bp8RrQpn+lVdvcAZoRCBCAlEG+yZxD0pRwstT3HJZfFLDbjwxYgRHoHB Nso1OCmPwW7EE/zYVpUm2Af+tUa8bfIQOq/Vlh0eImfNw7xaWyP9RUZy3e+pkkON3h oWuMEgO9f5PtDD/GQNSTFds+VQ0s2bQIcg6ixKGD4Ka2MW+otrW0GYYWt7SfAfmXGR 9QS8vJZMOUTj9rpNDpubEB7Se8JH6PzkCrFwU6X9kavVMDIagE6u1VLSTNjMD6TW8q GuM/RWVJpXwmlM1Sa+HiB8k2s4kCZQXhyo+tN2Mmup04eLAAZ9k8ipg11+iryobi0r 3vhMfx+j77jMg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rcPFa-004uw3-On; Tue, 20 Feb 2024 12:29:30 +0000 Date: Tue, 20 Feb 2024 12:29:30 +0000 Message-ID: <861q9748ut.wl-maz@kernel.org> From: Marc Zyngier To: Joey Gouly Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Will Deacon , Catalin Marinas Subject: Re: [PATCH 02/13] KVM: arm64: Clarify ESR_ELx_ERET_ISS_ERET* In-Reply-To: <20240220113127.GB16168@e124191.cambridge.arm.com> References: <20240219092014.783809-1-maz@kernel.org> <20240219092014.783809-3-maz@kernel.org> <20240220113127.GB16168@e124191.cambridge.arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: joey.gouly@arm.com, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, will@kernel.org, catalin.marinas@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240220_042934_277760_823A80D9 X-CRM114-Status: GOOD ( 27.29 ) 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: , 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 On Tue, 20 Feb 2024 11:31:27 +0000, Joey Gouly wrote: > > On Mon, Feb 19, 2024 at 09:20:03AM +0000, Marc Zyngier wrote: > > The ESR_ELx_ERET_ISS_ERET* macros are a bit confusing: > > > > - ESR_ELx_ERET_ISS_ERET really indicates that we have trapped an > > ERETA* instruction, as opposed to an ERET > > > > - ESR_ELx_ERET_ISS_ERETA reallu indicates that we have trapped > > an ERETAB instruction, as opposed to an ERETAA. > > > > Repaint the two helpers such as: > > > > - ESR_ELx_ERET_ISS_ERET becomes ESR_ELx_ERET_ISS_ERETA > > > > - ESR_ELx_ERET_ISS_ERETA becomes ESR_ELx_ERET_ISS_ERETAB > > > > At the same time, use BIT() instead of raw values. > > > > Signed-off-by: Marc Zyngier > > I'm somewhat against this, as the original names are what the Arm > ARM specifies. I don't disagree, but that doesn't make the ARM ARM right! ;-) > > > --- > > arch/arm64/include/asm/esr.h | 4 ++-- > > arch/arm64/kvm/handle_exit.c | 2 +- > > 2 files changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/arch/arm64/include/asm/esr.h b/arch/arm64/include/asm/esr.h > > index 353fe08546cf..72c7810ccf2c 100644 > > --- a/arch/arm64/include/asm/esr.h > > +++ b/arch/arm64/include/asm/esr.h > > @@ -290,8 +290,8 @@ > > ESR_ELx_SYS64_ISS_OP2_SHIFT)) > > > > /* ISS field definitions for ERET/ERETAA/ERETAB trapping */ > > -#define ESR_ELx_ERET_ISS_ERET 0x2 > > -#define ESR_ELx_ERET_ISS_ERETA 0x1 > > +#define ESR_ELx_ERET_ISS_ERETA BIT(1) > > +#define ESR_ELx_ERET_ISS_ERETAB BIT(0) > > > > /* > > * ISS field definitions for floating-point exception traps > > diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c > > index 617ae6dea5d5..0646c623d1da 100644 > > --- a/arch/arm64/kvm/handle_exit.c > > +++ b/arch/arm64/kvm/handle_exit.c > > @@ -219,7 +219,7 @@ static int kvm_handle_ptrauth(struct kvm_vcpu *vcpu) > > > > static int kvm_handle_eret(struct kvm_vcpu *vcpu) > > { > > - if (kvm_vcpu_get_esr(vcpu) & ESR_ELx_ERET_ISS_ERET) > > + if (kvm_vcpu_get_esr(vcpu) & ESR_ELx_ERET_ISS_ERETA) > > If this part is confusing due to the name, maybe introduce a function in esr.h > esr_is_pac_eret() (name pending bikeshedding)? That's indeed a better option. Now for the bikeshed aspect: - esr_iss_is_eretax(): check for ESR_ELx_ERET_ISS_ERET being set - esr_iss_is_eretab(): check for ESR_ELx_ERET_ISS_ERETA being set Thoughts? M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel