From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-52.mta1.migadu.com (out-52.mta1.migadu.com [95.215.58.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6005539B for ; Thu, 1 Jun 2023 07:32:46 +0000 (UTC) Date: Thu, 1 Jun 2023 07:32:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1685604764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uPY17dV5CAXzTnODjmRi5LAFgEH+A7orbrD/mEtbrII=; b=niAfa2hzGp6/9yevLwa+LGmlh5GUkxdOpvczkmQcaR/P9E93AWmCmI2Rv5vXdHKSXYCM9u Wp++Su6gGAItUJ3rhinMBcqkGb+RF2ggHzEIz9YIyqq6QB9kkNcNFk3hedqw9+c2zOITax zrSSkMTOApkSmORjkIdxiW7DOqRtikU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Quentin Perret , Will Deacon , Fuad Tabba Subject: Re: [PATCH v2 05/17] arm64: Don't enable VHE for the kernel if OVERRIDE_HVHE is set Message-ID: References: <20230526143348.4072074-1-maz@kernel.org> <20230526143348.4072074-6-maz@kernel.org> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230526143348.4072074-6-maz@kernel.org> X-Migadu-Flow: FLOW_OUT On Fri, May 26, 2023 at 03:33:36PM +0100, Marc Zyngier wrote: > If the OVERRIDE_HVHE SW override is set (as a precursor of > the KVM_HVHE capability), do not enable VHE for the kernel > and drop to EL1 as if VHE was either disabled or unavailable. > > Further changes will enable VHE at EL2 only, with the kernel > still running at EL1. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kernel/hyp-stub.S | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S > index 9439240c3fcf..5c71e1019545 100644 > --- a/arch/arm64/kernel/hyp-stub.S > +++ b/arch/arm64/kernel/hyp-stub.S > @@ -82,7 +82,15 @@ SYM_CODE_START_LOCAL(__finalise_el2) > tbnz x1, #0, 1f > > // Needs to be VHE capable, obviously > - check_override id_aa64mmfr1 ID_AA64MMFR1_EL1_VH_SHIFT 2f 1f x1 x2 > + check_override id_aa64mmfr1 ID_AA64MMFR1_EL1_VH_SHIFT 0f 1f x1 x2 > + > +0: // Check whether we only want the hypervisor to run VHE, not the kernel > + adr_l x1, arm64_sw_feature_override > + ldr x2, [x1, FTR_OVR_VAL_OFFSET] > + ldr x1, [x1, FTR_OVR_MASK_OFFSET] > + and x2, x2, x1 nit: is applying the mask even necessary? I get it in the context of an overlay on top of an ID register, but the software features are more of a synthetic ID register in their own right. Same nit applies to the kaslr case as well. > + ubfx x2, x2, #ARM64_SW_FEATURE_OVERRIDE_HVHE, #4 > + cbz x2, 2f > > 1: mov_q x0, HVC_STUB_ERR > eret > -- > 2.34.1 > -- Thanks, Oliver 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 AE672C77B7A for ; Thu, 1 Jun 2023 07:33:39 +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=2u7f7+fPVmZ1sOVXnv/nyGGPIPk0y6I4byFptdqjv+M=; b=P6jSN9KpLQSsx9 fJINP4o2ZYEwJwbdf7ypCNY6crDS+NnG4Zz3NWlIYtdd+8qzWydzRMNIfQGDNo4bfov26OwoeHgD5 BRUT3c6gU6gqOSemYz9O3wQHdyOiWQzJaOV3Ie7cTFuRR3KTlSJLuq3TGL2NN91aX/dtwRqODMiXI BHZ0t00uUOpnu5Bgm0Ms1UazeX4ynzk7qmvsEqj519QbcNp4uq32CTKMg0THjIpUCZmBKDOPrnqJG cDNlEzQtZoYiWE556IMvMnSoklMm256wLiMb+ulDb90OAd+WbY2b2HhsIZBq74/Oq7icw418ky+KI 9JaHghHHXR9k0bw2InVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4cni-002NBw-0E; Thu, 01 Jun 2023 07:32:50 +0000 Received: from out-9.mta1.migadu.com ([2001:41d0:203:375::9]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4cnf-002NB2-0b for linux-arm-kernel@lists.infradead.org; Thu, 01 Jun 2023 07:32:49 +0000 Date: Thu, 1 Jun 2023 07:32:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1685604764; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uPY17dV5CAXzTnODjmRi5LAFgEH+A7orbrD/mEtbrII=; b=niAfa2hzGp6/9yevLwa+LGmlh5GUkxdOpvczkmQcaR/P9E93AWmCmI2Rv5vXdHKSXYCM9u Wp++Su6gGAItUJ3rhinMBcqkGb+RF2ggHzEIz9YIyqq6QB9kkNcNFk3hedqw9+c2zOITax zrSSkMTOApkSmORjkIdxiW7DOqRtikU= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: Marc Zyngier Cc: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Suzuki K Poulose , Zenghui Yu , Quentin Perret , Will Deacon , Fuad Tabba Subject: Re: [PATCH v2 05/17] arm64: Don't enable VHE for the kernel if OVERRIDE_HVHE is set Message-ID: References: <20230526143348.4072074-1-maz@kernel.org> <20230526143348.4072074-6-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230526143348.4072074-6-maz@kernel.org> X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230601_003247_640061_8C08F5AA X-CRM114-Status: GOOD ( 19.93 ) 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, May 26, 2023 at 03:33:36PM +0100, Marc Zyngier wrote: > If the OVERRIDE_HVHE SW override is set (as a precursor of > the KVM_HVHE capability), do not enable VHE for the kernel > and drop to EL1 as if VHE was either disabled or unavailable. > > Further changes will enable VHE at EL2 only, with the kernel > still running at EL1. > > Signed-off-by: Marc Zyngier > --- > arch/arm64/kernel/hyp-stub.S | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S > index 9439240c3fcf..5c71e1019545 100644 > --- a/arch/arm64/kernel/hyp-stub.S > +++ b/arch/arm64/kernel/hyp-stub.S > @@ -82,7 +82,15 @@ SYM_CODE_START_LOCAL(__finalise_el2) > tbnz x1, #0, 1f > > // Needs to be VHE capable, obviously > - check_override id_aa64mmfr1 ID_AA64MMFR1_EL1_VH_SHIFT 2f 1f x1 x2 > + check_override id_aa64mmfr1 ID_AA64MMFR1_EL1_VH_SHIFT 0f 1f x1 x2 > + > +0: // Check whether we only want the hypervisor to run VHE, not the kernel > + adr_l x1, arm64_sw_feature_override > + ldr x2, [x1, FTR_OVR_VAL_OFFSET] > + ldr x1, [x1, FTR_OVR_MASK_OFFSET] > + and x2, x2, x1 nit: is applying the mask even necessary? I get it in the context of an overlay on top of an ID register, but the software features are more of a synthetic ID register in their own right. Same nit applies to the kaslr case as well. > + ubfx x2, x2, #ARM64_SW_FEATURE_OVERRIDE_HVHE, #4 > + cbz x2, 2f > > 1: mov_q x0, HVC_STUB_ERR > eret > -- > 2.34.1 > -- Thanks, Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel