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 A26ADC3DA5D for ; Mon, 15 Jul 2024 08:46:01 +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-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gz3ACM9L2SYNsw0gqdiO39YvLapmR0QQ1dA5ZISQO4U=; b=OsAbqfatWaVpKKtmPcZFBnrBNf Rba4Hx70Ny1q+T1BIv68zGs6vVfxPzmxEaX8T/6a9bAK3D3m0LHs1DCmvpnWpWDyA1cxNMmKsL2zR rtW1obyaPwxvuqNMjSmdJazV65G+EnBprYmhFN+ZaWt8Efci/YnvmM3HbC6nm886dg/gNghOnVBl4 9tNDOLlJftNar1ndb0Pm5IvslBtgLuWFDNAT2VEYzh3vgKxBuBq1dnTJF9z28KigFHqYXraf8dbkZ oqbq1+YNMqJlhl2Oz18E0zvYWTFbOgxnE5rn8NyXy+L3sJkLuzX6XEwot4fSHRmVVujL0CbcuX51v +nDNJHhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTHLC-00000006OWx-2CeM; Mon, 15 Jul 2024 08:45:50 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sTHKr-00000006OPR-43ty for linux-arm-kernel@lists.infradead.org; Mon, 15 Jul 2024 08:45:31 +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 4C0CEDA7; Mon, 15 Jul 2024 01:45:54 -0700 (PDT) Received: from [10.162.40.16] (a077893.blr.arm.com [10.162.40.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ABD933F73F; Mon, 15 Jul 2024 01:45:20 -0700 (PDT) Message-ID: <232f5d3d-8a85-4bc2-9076-f5cd4fb968a2@arm.com> Date: Mon, 15 Jul 2024 14:15:17 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 09/29] KVM: arm64: use `at s1e1a` for POE To: Joey Gouly , linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, maz@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, npiggin@gmail.com, oliver.upton@linux.dev, shuah@kernel.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev References: <20240503130147.1154804-1-joey.gouly@arm.com> <20240503130147.1154804-10-joey.gouly@arm.com> Content-Language: en-US From: Anshuman Khandual In-Reply-To: <20240503130147.1154804-10-joey.gouly@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240715_014530_079953_9E37F9CD X-CRM114-Status: GOOD ( 18.11 ) 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 5/3/24 18:31, Joey Gouly wrote: > FEAT_ATS1E1A introduces a new instruction: `at s1e1a`. > This is an address translation, without permission checks. > > POE allows read permissions to be removed from S1 by the guest. This means > that an `at` instruction could fail, and not get the IPA. > > Switch to using `at s1e1a` so that KVM can get the IPA regardless of S1 > permissions. > > Signed-off-by: Joey Gouly > Cc: Marc Zyngier > Cc: Oliver Upton > Cc: Catalin Marinas > Cc: Will Deacon > --- > arch/arm64/kvm/hyp/include/hyp/fault.h | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kvm/hyp/include/hyp/fault.h b/arch/arm64/kvm/hyp/include/hyp/fault.h > index 487c06099d6f..17df94570f03 100644 > --- a/arch/arm64/kvm/hyp/include/hyp/fault.h > +++ b/arch/arm64/kvm/hyp/include/hyp/fault.h > @@ -14,6 +14,7 @@ > > static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar) > { > + int ret; > u64 par, tmp; > > /* > @@ -27,7 +28,9 @@ static inline bool __translate_far_to_hpfar(u64 far, u64 *hpfar) > * saved the guest context yet, and we may return early... > */ > par = read_sysreg_par(); > - if (!__kvm_at(OP_AT_S1E1R, far)) > + ret = system_supports_poe() ? __kvm_at(OP_AT_S1E1A, far) : > + __kvm_at(OP_AT_S1E1R, far); > + if (!ret) > tmp = read_sysreg_par(); > else > tmp = SYS_PAR_EL1_F; /* back to the guest */ Since the idea is to get the IPA, using OP_AT_S1E1A instead, makes sense when POE is enabled. Reviewed-by: Anshuman Khandual