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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37157C433F5 for ; Thu, 27 Jan 2022 11:50:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236031AbiA0Lug (ORCPT ); Thu, 27 Jan 2022 06:50:36 -0500 Received: from sin.source.kernel.org ([145.40.73.55]:46576 "EHLO sin.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbiA0Lug (ORCPT ); Thu, 27 Jan 2022 06:50:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id ABF26CE2191 for ; Thu, 27 Jan 2022 11:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2314DC340E4; Thu, 27 Jan 2022 11:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643284233; bh=Fj6rO6IaAAe0YbSiAt6fjuOzaeN3xp1+03RZCltF6rs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=JQXFBkdwSCOaHmz5Cs6OTKaLnLNHdXTyq3D13G8DzRkTUVG8MExagW9w3SpN4gLVx ANX8bKduLwrEY9MoksbsBVgFy2Sh0BKdy5mrEAFzEmXsWvgqi5w1gOTHMoqSwgoo3g 4ArYBI2Rx4hwjRr/sRJdAmHATuYOt0+kPM+oeLPgM9fgeKeS4feiXrNu2Hmw/y+t6u oBrXWorCAxGA0O29HxquAH9PhmkkmTv4YnxjRsJTH8+BgtsbWJyCMmEJEnTvE1awZ4 nHTiRYS+Q2NwnCFK38PFvFusRyVMtPnsMQsHgFqoiIK2aWAjyGzD8lQfnLS9ktpHFP 6lQO8SJohJe6A== Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nD3IN-003UfR-8X; Thu, 27 Jan 2022 11:50:31 +0000 Date: Thu, 27 Jan 2022 11:50:30 +0000 Message-ID: <871r0t75yx.wl-maz@kernel.org> From: Marc Zyngier To: Ganapatrao Kulkarni Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Andre Przywara , Christoffer Dall , Jintack Lim , Haibo Xu , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: Re: [PATCH v5 38/69] KVM: arm64: nv: Support multiple nested Stage-2 mmu structures In-Reply-To: <21b0fca8-6b31-dc63-7637-2f80c4b3a272@os.amperecomputing.com> References: <20211129200150.351436-1-maz@kernel.org> <20211129200150.351436-39-maz@kernel.org> <21b0fca8-6b31-dc63-7637-2f80c4b3a272@os.amperecomputing.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/27.1 (x86_64-pc-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: gankulkarni@os.amperecomputing.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, andre.przywara@arm.com, christoffer.dall@arm.com, jintack@cs.columbia.edu, haibo.xu@linaro.org, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, 18 Jan 2022 11:24:04 +0000, Ganapatrao Kulkarni wrote: > > > > On 30-11-2021 01:31 am, Marc Zyngier wrote: > > +struct kvm_s2_mmu *lookup_s2_mmu(struct kvm *kvm, u64 vttbr, u64 hcr) > > +{ > > + bool nested_stage2_enabled = hcr & HCR_VM; > > + int i; > > + > > + /* Don't consider the CnP bit for the vttbr match */ > > + vttbr = vttbr & ~VTTBR_CNP_BIT; > > + > > + /* > > + * Two possibilities when looking up a S2 MMU context: > > + * > > + * - either S2 is enabled in the guest, and we need a context that > > + * is S2-enabled and matches the full VTTBR (VMID+BADDR), which > > + * makes it safe from a TLB conflict perspective (a broken guest > > + * won't be able to generate them), > > + * > > + * - or S2 is disabled, and we need a context that is S2-disabled > > + * and matches the VMID only, as all TLBs are tagged by VMID even > > + * if S2 translation is enabled. > > I think you were intended to say "if S2 translation is disabled". Yes, absolutely. Good catch. Thanks, M. -- Without deviation from the norm, progress is not possible.