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 0DE68C021B8 for ; Wed, 26 Feb 2025 11:12:57 +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=A7ctPFMSJw9LrIsmrryIjwyKasq4M9J1CRD8hVjRhQw=; b=1gMy7KYwwma1esQjbnQYElfygD N0b74xKxdBjn51xMlWROLK+GskMP2JJP7CgUa0v5f8oQmjiy3pdfckJ+4O9/9qVBXYkaigCxswah+ 014iB0XUlIa6nZ/hFrpNVvFYE7RY3ByFdFTHyKOnv2lQ3QRRovnKAR3JCsbQD/IFIIPspxv0i5kzj xVPaLCnkN4q/s3xyoeeTNAOPGqgMAmTyP0ymp2cMTJOB0vNQLv9szvS3C2PeL108ylYw7f+xfkUy1 kD+zK00RtMhk1+bY/tWe9GrrrfOEos/QU4r0w0Q0WgqD5F2yztkvjvMx3vYFgPmoollyGDXGW5Hb5 VwjSfv+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tnFLK-00000003RZr-25ny; Wed, 26 Feb 2025 11:12:46 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tnEv1-00000003Lcs-2soq for linux-arm-kernel@lists.infradead.org; Wed, 26 Feb 2025 10:45:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 70420611D8; Wed, 26 Feb 2025 10:45:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA8F1C4CED6; Wed, 26 Feb 2025 10:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740566734; bh=Aoyk5i039i3K4vSIZbUYee6SquXrsZNgAvYyy1nF94M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dwhR3/+6ZQkmtrXmXNnvXov2VWi1mX3a6pUI28+6Qvgv7PiCNvbVtZHXHGBBSml3E TJXzHB3RZSU9B8kwKMBmh15CbqZvIje9VWz8JvOpxuBZ8FiFfKED8ajjuW7TKW2xDA iH0MwNUXBxiMhnxUbn+SHLnO4qBKAnOkW08ASvjNmGgVy+HhrEGMSSUyOmIm2JUyIT LAUI7084abOp6bsD6wlb+eO0sMllVgUoh56u6XOrCGMAzDXh9C1h+xxtYB7X5TIIIQ 2sjAP+qWLhsoepRaeVgXQrtjilOYOAM+LQWZlFSKfzwJZdB3VCnIuAwv8Mpbkq2mNM 2qz3b7NmNP8Ww== 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 1tnEuy-0088gP-Dc; Wed, 26 Feb 2025 10:45:32 +0000 Date: Wed, 26 Feb 2025 10:45:32 +0000 Message-ID: <86a5a9q90z.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: Fuad Tabba , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, broonie@kernel.org, qperret@google.com, vdonnefort@google.com Subject: Re: [PATCH v1 1/3] KVM: arm64: Initialize HCRX_EL2 traps in pKVM In-Reply-To: References: <20250214150258.464798-1-tabba@google.com> <20250214150258.464798-2-tabba@google.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.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: oliver.upton@linux.dev, tabba@google.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, catalin.marinas@arm.com, broonie@kernel.org, qperret@google.com, vdonnefort@google.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false 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 Wed, 26 Feb 2025 10:07:56 +0000, Oliver Upton wrote: > > Hi Fuad, > > Series LGTM overall, one comment: > > On Fri, Feb 14, 2025 at 03:02:56PM +0000, Fuad Tabba wrote: > > Initialize and set the traps controlled by the HCRX_EL2 in pKVM > > when the register is supported by the system. > > > > Signed-off-by: Fuad Tabba > > --- > > arch/arm64/kvm/hyp/nvhe/pkvm.c | 46 ++++++++++++++++++++++++++++++++++ > > 1 file changed, 46 insertions(+) > > > > diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c > > index 3927fe52a3dd..668ebec27f1b 100644 > > --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c > > +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c > > @@ -58,6 +58,30 @@ static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu) > > vcpu->arch.hcr_el2 |= HCR_ATA; > > } > > > > +static void pkvm_vcpu_reset_hcrx(struct pkvm_hyp_vcpu *hyp_vcpu) > > +{ > > + struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu; > > + struct kvm_vcpu *vcpu = &hyp_vcpu->vcpu; > > + > > + if (!cpus_have_final_cap(ARM64_HAS_HCX)) > > + return; > > + > > + /* > > + * In general, all HCRX_EL2 bits are gated by a feature. > > + * The only reason we can set SMPME without checking any > > + * feature is that its effects are not directly observable > > + * from the guest. > > + */ > > + vcpu->arch.hcrx_el2 = HCRX_EL2_SMPME; > > + > > The comment isn't wrong, but we don't support SME at all in KVM at this > point. This is a copy/paste of what we have in kvm_calculate_traps(), and the result of the removal of the dreaded HCRX_GUEST_FLAGS. > Any objection to dropping this bit? I can fix it when applying the > series, no need to respin. Whatever we do, I think we should keep the two side of the trap configuration in sync, as this is otherwise a cause of bugs. Thanks, M. -- Without deviation from the norm, progress is not possible.