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 78348C531DC for ; Mon, 12 Aug 2024 18:05:51 +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:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID: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=CFsoh0MtO5HvY0h8kvTM7zzBKMbWMR2RXUozatxSOzI=; b=kSxertCx1vqliaralG4dkKobtU PkVkxImB8+nZdVMQOTP/TG2q6Pu8A4Ja5jF9ckT/r2wtKQQkhbmYrv3KD69WTn1YGWXynhdUysqW+ kb85xPiOrhpXbop97eEVQK+ZXqHjMxSxvplfRCHamQ3WTLWinQjG4Y3mZx8DWYqa2Vfn0WdSBCUDI j01EmyB1F9OnLxnfCloJyEZON24bZ4J+mi+CYuw8EZR8+lJMsv+7VNTjS8kdwZPi351QipviVik3e HBZB0uAS4nxDYxq8+jNs22ZFZ6IBaTMkJ/tYBmbPrZxMD/xekDU8IHXogBWhYbZ96j0FurlSwzep/ /BKbn9tA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdZQK-0000000185U-1pWR; Mon, 12 Aug 2024 18:05:40 +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 1sdZPi-0000000182H-43pe for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2024 18:05:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 0B84E611FD; Mon, 12 Aug 2024 18:05:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0274C32782; Mon, 12 Aug 2024 18:05:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723485901; bh=U7qc2svI0870+6cT4W//HuRzvJZzOIOWuylXoGD4yFs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jR9/CQ6jYx9ws2sovRA7I1dz0ecyrbIVWr7t+qi32fvxIdmhEY1MttrUukVfNI1qL oNIUW7Hr5SMfNypdj2+YgIybkSlSLZTgsUILlCZBWVPRqZntaY4Z2IuaT2cKMVFdDK LRnaVjotay90awufaQ6SRmMNgBIguduW9ikcPc8EQj5Rx0LYtps0TEcXdZ/+4RAN3j vkuMixIsffOpPpIgphWtV3AoydCNGKBYoT36HiqJ2lB3952aT9jwc/DVNblvOFPfui RoWPZcLjTwvGPb680fSL1KoLVeovJNh469IUxKlPA3duh4pkqrNnENCBqyMyXKQhtk KWAa/xnbP2/tQ== 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 1sdZPf-0035xD-Bf; Mon, 12 Aug 2024 19:04:59 +0100 Date: Mon, 12 Aug 2024 19:04:59 +0100 Message-ID: <861q2t1ut0.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly , Anshuman Khandual , Przemyslaw Gaj Subject: Re: [PATCH v2 13/17] KVM: arm64: nv: Add SW walker for AT S1 emulation In-Reply-To: <8634n91v3z.wl-maz@kernel.org> References: <20240731194030.1991237-1-maz@kernel.org> <20240731194030.1991237-14-maz@kernel.org> <867cco1y4w.wl-maz@kernel.org> <8634n91v3z.wl-maz@kernel.org> 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.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com, anshuman.khandual@arm.com, pgaj@cadence.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-20240812_110503_164117_085F8DF2 X-CRM114-Status: GOOD ( 22.92 ) 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, 12 Aug 2024 18:58:24 +0100, Marc Zyngier wrote: > > Hi Alex, > > On Mon, 12 Aug 2024 16:11:02 +0100, > Alexandru Elisei wrote: > > > > Hi Marc, > > > > On Sat, Aug 10, 2024 at 11:16:15AM +0100, Marc Zyngier wrote: > > > Hi Alex, > > > > > > @@ -136,12 +137,22 @@ static int setup_s1_walk(struct kvm_vcpu *vcpu, u32 op, struct s1_walk_info *wi, > > > va = (u64)sign_extend64(va, 55); > > > > > > /* Let's put the MMU disabled case aside immediately */ > > > - if (!(sctlr & SCTLR_ELx_M) || > > > - (__vcpu_sys_reg(vcpu, HCR_EL2) & HCR_DC)) { > > > + switch (wi->regime) { > > > + case TR_EL10: > > > + if (__vcpu_sys_reg(vcpu, HCR_EL2) & HCR_DC) > > > + wr->level = S1_MMU_DISABLED; > > > > In compute_translation_regime(), for AT instructions other than AT S1E2*, when > > {E2H,TGE} = {0,1}, regime is Regime_EL10. As far as I can tell, when regime is > > Regime_EL10 and TGE is set, stage 1 is disabled, according to > > AArch64.S1Enabled() and the decription of the TGE bit. > > Grmbl... I really dislike E2H=0. May it die a painful death. How about > this on top? > > diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c > index 10017d990bc3..870e77266f80 100644 > --- a/arch/arm64/kvm/at.c > +++ b/arch/arm64/kvm/at.c > @@ -139,7 +139,19 @@ static int setup_s1_walk(struct kvm_vcpu *vcpu, u32 op, struct s1_walk_info *wi, > /* Let's put the MMU disabled case aside immediately */ > switch (wi->regime) { > case TR_EL10: > - if (__vcpu_sys_reg(vcpu, HCR_EL2) & HCR_DC) > + /* > + * If dealing with the EL1&0 translation regime, 3 things > + * can disable the S1 translation: > + * > + * - HCR_EL2.DC = 0 s/0/1/ M. -- Without deviation from the norm, progress is not possible.