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 8556FC77B7A for ; Fri, 26 May 2023 14:47:52 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Psh+ttSDxmJQm7BNlrAv70TwJuFjStARf/Y+KJzfEdM=; b=qygEO5SKaGaJVr X+wqMpxSzTmlN56JjqdKmuWf8V/c/R+lRaFIOHsh+HJEOCTWwjBMGnACn+6+P3A7MgGl+CsLs49Q8 oZU/rwkJzzN4Lt6gkWiZyKYZwz//DAIMuetT2nxqZiBX8O58wCaFJ1RyUV/yrlAG7YMd4petvPbif aygzCnxUZhaUXiyRVOmrtIEIGswL7eTmFjHwvnpVtkRf3uYZ9F72nscLiRQgqcTNCAWXDBqNOeP+l aIN9tLKijf0RuE06QP84tYnydXLWcbb8iibsIEIFGI8WOsHL4wxn2B+eRZZhc4hQp5suZJuDcGtCt CD+g0vKE6DAGiROPAeqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q2Yj6-002rSG-0U; Fri, 26 May 2023 14:47:32 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q2Yie-002rGK-05 for linux-arm-kernel@lists.infradead.org; Fri, 26 May 2023 14:47:05 +0000 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 dfw.source.kernel.org (Postfix) with ESMTPS id 972F965099; Fri, 26 May 2023 14:47:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AF54C433D2; Fri, 26 May 2023 14:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685112423; bh=XkWyzW+sSMEWSg65caOPf/zhuNHxIwdjYYA7HpLQriM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VipzasFZ7QnwjDLqr+Ww2In84+92fEp8yCoQBpVscbftPSrPN5IRxUyqRm0YjMik0 JfZEOYwZQeS20pBrYYGrK1ylsKOpG4kyCacs/oMOG9DO8XUCcm7h4e9g6zlLvkIop2 H3LUsKvsD0o0RL3LaGgVxzmeX2mGilYLVsfJtBKvFa/egPR0feNPhHDfdV2ttVZ0tY 7OCzqzaaI4l6RLmTMynqZq5z3FR5LZnipPxc1/bbPRtywbEJD/X+ZWm/ttaRkADelw p4dSNROj3Bpux2hdV6X8jhJwoUWasxwBU9cu6BjzyhcEx294MvU5DoGpLGKrJwLgZo 67K2WtyV53f6w== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1q2YVu-000aHS-3E; Fri, 26 May 2023 15:33:54 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Quentin Perret , Will Deacon , Fuad Tabba Subject: [PATCH v2 11/17] KVM: arm64: Disable TTBR1_EL2 when using ARM64_KVM_HVHE Date: Fri, 26 May 2023 15:33:42 +0100 Message-Id: <20230526143348.4072074-12-maz@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230526143348.4072074-1-maz@kernel.org> References: <20230526143348.4072074-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, qperret@google.com, will@kernel.org, tabba@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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230526_074704_116274_72E910F9 X-CRM114-Status: GOOD ( 14.01 ) 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 When using hVHE, we end-up with two TTBRs at EL2. That's great, but we're not quite ready for this just yet. Disable TTBR1_EL2 by setting TCR_EL2.EPD1 so that we only translate via TTBR0_EL2. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/arm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index c12276dd2cf4..35b32cb6faa5 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1666,7 +1666,13 @@ static void __init cpu_prepare_hyp_mode(int cpu, u32 hyp_va_bits) params->mair_el2 = read_sysreg(mair_el1); - tcr = (read_sysreg(tcr_el1) & TCR_EL2_MASK) | TCR_EL2_RES1; + tcr = read_sysreg(tcr_el1); + if (cpus_have_final_cap(ARM64_KVM_HVHE)) { + tcr |= TCR_EPD1_MASK; + } else { + tcr &= TCR_EL2_MASK; + tcr |= TCR_EL2_RES1; + } tcr &= ~TCR_T0SZ_MASK; tcr |= TCR_T0SZ(hyp_va_bits); params->tcr_el2 = tcr; -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel