From patchwork Tue Aug 13 14:47:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13762177 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 71E22C52D7B for ; Tue, 13 Aug 2024 14:52:27 +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=cwugWmnBgtC96uQ6541zYgkJmoxRnAYvaKndesM5OOU=; b=ufXt/Llrl1TxsBwVyPOIhLwZmH hVHDYMP1XyQYOgDYbQxaIwmzhiap6as9DmQK1WnDb2imxw9CpdgqmueyxCC1ZxOhZ6oMb924QyWmm AaXT9L75vh7o78D0iGbPRW4Q6cTOk/Lb95VxgXUXKtiia0ZnRSQXvl7UavWcILXXtvFhz6llUT8wk 8aCfoG77Hku3prsGtN435BgGYF7VZlO8IO1rc3OhjfjDSepQ2OdImFvdRNX49+GJNS/B94hyLb9uy DHO11+rn3R+ef/eJtBYPeZ1KPDYdUow4lzglcyDcRjqMj7Mk24G78BP8AFFr/17eezOoMv3UKchgj yjGUG85g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdssg-000000045g9-1Q9m; Tue, 13 Aug 2024 14:52:14 +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 1sdsoc-000000044ci-2JxL for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 14:48:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 690D3CE1409; Tue, 13 Aug 2024 14:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E791AC4AF0B; Tue, 13 Aug 2024 14:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723560479; bh=NGd3Mb3ENRIp6A9T4Pf1BLV4E8SBAeETl4uymIM47B8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZA/cF76l6U156/7LIc2fvEMyZ/LqNWJOCvoHqGEcaRoIFBRHx34ofDm7JDFScY9Xa kvh3IFoiTQP5HA/Q0ZMoSz5Cm3gcG1YYFFSo3cHTERn7HBl0p2id9i83w+VH4VLmyj oNFKJNh3MnAUuck9qOE3sF/zTsOyfNkNIA7JMWwnYnosxSiSivHUqKXUaZGfCDTvY0 zTLPKn/fmy2V1SQc+IYbtdwhRC3kUYoRPEWDCgeOA4BcehfCopq/4K7mf/FuFgiz5i r8l3B92M+scQXu3f8sIPvkGQfVj6jEvzXqOt/XR08rwSYLdm1sKQqjWKlhccKlANyB GWAECsoxuJqdQ== 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 1sdsoY-003O27-3L; Tue, 13 Aug 2024 15:47:58 +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 , Joey Gouly , Alexandru Elisei Subject: [PATCH 10/10] KVM: arm64: Sanitise ID_AA64MMFR3_EL1 Date: Tue, 13 Aug 2024 15:47:38 +0100 Message-Id: <20240813144738.2048302-11-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240813144738.2048302-1-maz@kernel.org> References: <20240813144738.2048302-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, joey.gouly@arm.com, alexandru.elisei@arm.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-20240813_074802_848170_E2AE4264 X-CRM114-Status: GOOD ( 10.74 ) 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 Add the missing sanitisation of ID_AA64MMFR3_EL1, making sure we solely expose S1PIE and TCRX (we currently don't support anything else). Signed-off-by: Marc Zyngier --- arch/arm64/kvm/sys_regs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index a5f604e24e05..d0b4509e59cb 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1608,6 +1608,9 @@ static u64 __kvm_read_sanitised_id_reg(const struct kvm_vcpu *vcpu, case SYS_ID_AA64MMFR2_EL1: val &= ~ID_AA64MMFR2_EL1_CCIDX_MASK; break; + case SYS_ID_AA64MMFR3_EL1: + val &= ID_AA64MMFR3_EL1_TCRX | ID_AA64MMFR3_EL1_S1PIE; + break; case SYS_ID_MMFR4_EL1: val &= ~ARM64_FEATURE_MASK(ID_MMFR4_EL1_CCIDX); break; @@ -2470,7 +2473,8 @@ static const struct sys_reg_desc sys_reg_descs[] = { ID_AA64MMFR2_EL1_IDS | ID_AA64MMFR2_EL1_NV | ID_AA64MMFR2_EL1_CCIDX)), - ID_SANITISED(ID_AA64MMFR3_EL1), + ID_WRITABLE(ID_AA64MMFR3_EL1, (ID_AA64MMFR3_EL1_TCRX | + ID_AA64MMFR3_EL1_S1PIE)), ID_SANITISED(ID_AA64MMFR4_EL1), ID_UNALLOCATED(7,5), ID_UNALLOCATED(7,6),