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 896DEC433EF for ; Mon, 7 Feb 2022 16:32:53 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PhsMNNSiOf7eSBqR1dnIIGx2wVIPxy9O4ZJ800vtxmg=; b=Nhn8iU296ftQYc yPaCjzkT3RQdoIrtri0scIdjbcG7peaXTcovXa3Rfmx4SwzLIdSAhcy5GbAKzgiL2hVjs5vyU5puA UD32aNrVmqMMZz8L4/38YH6Tkten+Y9GTNccxIYWkFN1VNv7YHVSLCGfLqTwWkId3FYh/wZrkkb46 4rhw/KHqZm0p2Dq8UswDzGwIV0fVXvfx/fs3jVtxCeh1QfPw9QmYP/OEm41Eij7tdDVteIG8FvJZn LYuo6INE50EIlcVKTgbobvAS2yHj6/t3JEVW3iz5IYJddIZ2eNp0F2ucOBD3bNumBR+xzkL4QqL6p ocwxrIeHorX7o9umvrVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH6uq-00B5zL-Ll; Mon, 07 Feb 2022 16:31:01 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nH6iz-00B2J3-CH for linux-arm-kernel@lists.infradead.org; Mon, 07 Feb 2022 16:18:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F06B11D4; Mon, 7 Feb 2022 08:18:43 -0800 (PST) Received: from monolith.localdoman (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CEF723F718; Mon, 7 Feb 2022 08:18:40 -0800 (PST) Date: Mon, 7 Feb 2022 16:18:51 +0000 From: Alexandru Elisei To: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Andre Przywara , Christoffer Dall , Jintack Lim , Haibo Xu , Ganapatrao Kulkarni , Chase Conklin , "Russell King (Oracle)" , James Morse , Suzuki K Poulose , karl.heubaum@oracle.com, mihai.carabas@oracle.com, miguel.luis@oracle.com, kernel-team@android.com Subject: Re: [PATCH v6 25/64] KVM: arm64: nv: Respect virtual HCR_EL2.TVM and TRVM settings Message-ID: References: <20220128121912.509006-1-maz@kernel.org> <20220128121912.509006-26-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220128121912.509006-26-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220207_081845_507885_D304C0F9 X-CRM114-Status: GOOD ( 21.03 ) 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 Hi Marc, On Fri, Jan 28, 2022 at 12:18:33PM +0000, Marc Zyngier wrote: > From: Jintack Lim > > Forward the EL1 virtual memory register traps to the virtual EL2 if they > are not coming from the virtual EL2 and the virtual HCR_EL2.TVM or TRVM > bit is set. > > This is for recursive nested virtualization. > > Signed-off-by: Jintack Lim > Signed-off-by: Marc Zyngier > --- > arch/arm64/kvm/sys_regs.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c > index ccd063d6cb69..edaf287c7ec9 100644 > --- a/arch/arm64/kvm/sys_regs.c > +++ b/arch/arm64/kvm/sys_regs.c > @@ -351,6 +351,13 @@ static bool access_vm_reg(struct kvm_vcpu *vcpu, > if (el12_reg(p) && forward_nv_traps(vcpu)) > return false; > > + if (!el12_reg(p)) { > + u64 bit = p->is_write ? HCR_TVM : HCR_TRVM; > + > + if (forward_traps(vcpu, bit)) > + return false; This part of the TVM bit description from the architecture manual (page D13-3290) got me really stumped for a while: "When HCR_EL2.TGE is 1, the PE ignores the value of this field for all purposes other than a direct read of this field". But I soon realized it's forbidden by the architecture to eret to EL1 when TGE is set, so all's good. I wonder why that part was added to the TVM bit description though. Regardless, the patch looks good to me: Reviewed-by: Alexandru Elisei Thanks, Alex > + } > + > /* We don't expect TRVM on the host */ > BUG_ON(!vcpu_is_el2(vcpu) && !p->is_write); > > -- > 2.30.2 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel