From patchwork Thu Aug 15 12:59:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13764784 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 F13B1C52D7C for ; Thu, 15 Aug 2024 13:08:16 +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: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=w8wjv4S7lBWQ06DAKpuRkSutjtzTRCJIT6UGFapve3Y=; b=drg+2ul/G7WRi4bgNUVdkW1ZyI 78JUNMBLzGZIJOhctpPHws5uCXqtLDvGHiLSmAzYM1hCb+1QCBoa59fNl1ViQXOBW/bY2JBim2C6z gQ0oOh4+daPZN0k36/AOeermBspn/rPeSoOrrpGEVJSnSNBULzWx4oLOURqStAK956FAchy3kp7CT xiqDp3wJVigsoph0i3EKYbkIB6CeTBOIn74aS0LU5niYp+n/WYvgTziZiudB/Me/cGsD7YtFPVUwv 4pyGLI715eemmSyfIhkRH4gf+V9C/ToBmij0kca66j3ZgAiYZ0nwBZ8tz/dn5dfJ5jxHvfGhTs9Aj jmJPumRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1seaD0-00000009zVj-1Kql; Thu, 15 Aug 2024 13:08:06 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sea5K-00000009xkh-3Evs for linux-arm-kernel@lists.infradead.org; Thu, 15 Aug 2024 13:00:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id BA5A3CE1C4E; Thu, 15 Aug 2024 13:00:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2A5CC4AF0E; Thu, 15 Aug 2024 13:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723726805; bh=elhHN6q3wNJu3gQxFTv4Q2GV0VvzvpMyf883cw9HyZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b50XmLDKgpWqwQ+J+8Fpdlz/fsF7bOuMPyQSHI0DWZlCE26lvNsnoot1nc1YKM2LP KtfGZDwXz8TylnYtwKDgK+NU7p+b9o2e//UARF2g1+4CyFV0kFKGNzpCdQSZL1z2p1 1yFo6zgCSgpBSdslbED2E3p6jKwUNAEO0b8rbkZ9l6VCzjywWB177PHfQnkGU3gqhB SqbIkYM7iWFA128/tBHy/4dLlDCI9RG5lye112XL3hpXJAsV9xrt+mPP9aRLG+zkL0 5rgNfFb7zmO3d+fx6M4TLEzbarCj/aBQhjBoqqBlVTZkQMgmMvOT+zuV+ogY5CI4Q3 xUAtk0CXgenXA== 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 1sea5D-003xld-Vb; Thu, 15 Aug 2024 14:00:04 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH 07/11] KVM: arm64: Restrict ACCDATA_EL1 undef to FEAT_ST64_ACCDATA being disabled Date: Thu, 15 Aug 2024 13:59:55 +0100 Message-Id: <20240815125959.2097734-8-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240815125959.2097734-1-maz@kernel.org> References: <20240815125959.2097734-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, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.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-20240815_060011_065679_28A4830B X-CRM114-Status: GOOD ( 11.05 ) 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 We currently unconditionally make ACCDATA_EL1 accesses UNDEF. As we are about to support it, restrict the UNDEF behaviour to cases where FEAT_ST64_ACCDATA is not exposed to the guest. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/sys_regs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 7b540811aa38..39c2ee15dc0a 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -4580,10 +4580,12 @@ void kvm_calculate_traps(struct kvm_vcpu *vcpu) HFGxTR_EL2_nS2POR_EL1 | HFGxTR_EL2_nPOR_EL1 | HFGxTR_EL2_nPOR_EL0 | - HFGxTR_EL2_nACCDATA_EL1 | HFGxTR_EL2_nSMPRI_EL1_MASK | HFGxTR_EL2_nTPIDR2_EL0_MASK); + if (!kvm_has_feat(kvm, ID_AA64ISAR1_EL1, LS64, LS64_ACCDATA)) + kvm->arch.fgu[HFGxTR_GROUP] |= HFGxTR_EL2_nACCDATA_EL1; + if (!kvm_has_feat(kvm, ID_AA64ISAR0_EL1, TLB, OS)) kvm->arch.fgu[HFGITR_GROUP] |= (HFGITR_EL2_TLBIRVAALE1OS| HFGITR_EL2_TLBIRVALE1OS |