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 1EF1CC433F5 for ; Tue, 1 Feb 2022 16:39:41 +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=uYaZUA/Zayx1RAiHe26hKA2Tt1xPowo4R08jLfM4RmE=; b=0jT061eTgH2oPj TfHNGXO5MHQie16B8VlDNXGQYLxX/r/yjuUxmdUUvtlyZZ0cNLfKVbnkVFzLSrxBHIhdPLLnkcsyW 5RdFYJExvp6EOYwTE297qcE9kNxRLvx/cZZLyAzjJAq0QYLiAkwPIFFzkZhb42Bwo1Maa0ALfyO6O H5UU1GmbJo5xK6UDZMh7uFLz0Ouyd6Ew1Fa0gAbEXDIxO42umzJNLo2VpZ/ocbgho13/6oUdksb4Y wuG98uNWwe+oOSO3VK6DPkh23u7K+P/d9OofUcaGsN3E4A74WRZGZeFMI031C7lMAxgrrLiAs4Oil 8AynMVMTxaNMeTkiRxsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEwAX-00D0ny-Qf; Tue, 01 Feb 2022 16:38:13 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEwAT-00D0nM-S3 for linux-arm-kernel@lists.infradead.org; Tue, 01 Feb 2022 16:38:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1lTsDEbwIELOLsQQ3LW7YTALtUz0mwSPckKDI4izXLA=; b=MBrbQx2kPnS1qOhHR005ucRtL2 QUby9b49hytlEAupmcgr6Lex8Lk+lBOpUqlEmuPYmUywvUjGI+mdVf3p87XZo6xKoue25YQHu2AmD LIgZ4VJrDA06LB4AqGx5DcB3++FmZ2AlnYQkdVwByjsfwHrhLTjrrQGA4Qq2ElyGlfQtt0QDRToZB C2YKg10OI51HN52UCV2ja7zIcO35E8mPUzZyxbswIRV6n0jeqtNvezBp9K7n2BBOLoulB+kg0lmNw MWPYxtCUk+ANHPmRxLQNU7WUrDVFKZYb7vQrHksQmrRyUf/gv2cAKE/r4NLEJKqSNdvu3jDeZp9/R OYHfBUVg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:56968) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nEwAJ-0000oc-3y; Tue, 01 Feb 2022 16:37:59 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nEwA5-0002D4-92; Tue, 01 Feb 2022 16:37:45 +0000 Date: Tue, 1 Feb 2022 16:37:45 +0000 From: "Russell King (Oracle)" 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 , James Morse , Suzuki K Poulose , Alexandru Elisei , karl.heubaum@oracle.com, mihai.carabas@oracle.com, miguel.luis@oracle.com, kernel-team@android.com Subject: Re: [PATCH v6 12/64] KVM: arm64: nv: Add non-VHE-EL2->EL1 translation helpers Message-ID: References: <20220128121912.509006-1-maz@kernel.org> <20220128121912.509006-13-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220128121912.509006-13-maz@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220201_083809_940489_DF5ED96F X-CRM114-Status: GOOD ( 17.33 ) 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 Fri, Jan 28, 2022 at 12:18:20PM +0000, Marc Zyngier wrote: > Some EL2 system registers immediately affect the current execution > of the system, so we need to use their respective EL1 counterparts. > For this we need to define a mapping between the two. In general, > this only affects non-VHE guest hypervisors, as VHE system registers > are compatible with the EL1 counterparts. > > These helpers will get used in subsequent patches. > > Co-developed-by: Andre Przywara > Signed-off-by: Andre Przywara > Signed-off-by: Marc Zyngier Reviewed-by: Russell King (Oracle) > --- > arch/arm64/include/asm/kvm_nested.h | 54 +++++++++++++++++++++++++++++ > 1 file changed, 54 insertions(+) > > diff --git a/arch/arm64/include/asm/kvm_nested.h b/arch/arm64/include/asm/kvm_nested.h > index fd601ea68d13..5a85be6d8eb3 100644 > --- a/arch/arm64/include/asm/kvm_nested.h > +++ b/arch/arm64/include/asm/kvm_nested.h > @@ -2,6 +2,7 @@ > #ifndef __ARM64_KVM_NESTED_H > #define __ARM64_KVM_NESTED_H > > +#include > #include > > static inline bool vcpu_has_nv(const struct kvm_vcpu *vcpu) > @@ -11,4 +12,57 @@ static inline bool vcpu_has_nv(const struct kvm_vcpu *vcpu) > test_bit(KVM_ARM_VCPU_HAS_EL2, vcpu->arch.features)); > } > > +/* Translation helpers from non-VHE EL2 to EL1 */ > +static inline u64 tcr_el2_ps_to_tcr_el1_ips(u64 tcr_el2) > +{ > + return (u64)FIELD_GET(TCR_EL2_PS_MASK, tcr_el2) << TCR_IPS_SHIFT; I frowned about the use of FIELD_GET() but not FIELD_PREP(), which would be: return FIELD_PREP(TCR_IPS_MASK, FIELD_GET(TCR_EL2_PS_MASK, tcr_el2)); However, I'm not bothered by this beyond frowning! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel