From patchwork Wed Oct 9 19:00:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13829130 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 4C9CFCEE342 for ; Wed, 9 Oct 2024 19:13:42 +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=x64x9TADTxxpnU0Rla8YzyCTu404PTbNycMAvcn4kwQ=; b=NvYNaamv8NptWcn9KzVzR+aUir i3qiB889D9iWiiZKIdHZCg0tdW9k4ES6KyWtAm+Zkpen7XgtQ8SVwPjiFCSo4lLEbAFPdRHbUrvpo 0tSm8xfduMoPwi6GNRa8A5zUjIPRuXbXxmr2bY0VPyHriSvZdh2xp3B1NIjWsYa2wqvJHZz0MTRsI WiIyC+Z2m4GV96sDY3C5lbd1nZM/WgVeUFkHutb0CTa4PgpEEwsPirQY/ozgw5FRaA65U4tw7frm/ nNX2RdSgMfVUIvEF9wVaC1TNFB0HugVrICHeMs1z3EiSfdTT4eQP/NT1lnT7dic4NjWjlDj0Ib0th 1cU1EpEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syc7p-0000000ATko-0hYk; Wed, 09 Oct 2024 19:13:33 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sybvT-0000000ARHQ-0gsx for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 19:00:51 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 700C9A44465; Wed, 9 Oct 2024 19:00:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD9B6C4CED4; Wed, 9 Oct 2024 19:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728500445; bh=FgQexBaZfsfQzAHeUxw7obYY6WYgogLcfZPAE0mj4tA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WixtwlLoWOQuDwtZZNW3zKconMpz4W68y2yM5+dYpRiNbwduf37lNfAk6fYsr8KX9 ybFBx+bDuqpR/W7piI3Su8ewDbvQi38Mzk88WM+ot49PDojQ7l4rrkpbsJ6xG37Zz5 /F0AEw0b9/ELTMPGuiTJCbqm3oY1NszchUuaSRHubR2os+TY+JfvPS5/oGlDLOEfTc WfEopICYTEYV26TdgIFkTC/Ful/zWuAipkFeYX+XL6FN8xnLeD1p3OPjESzqp1VqA+ wWu3tnxbA5ZkZpQk6+Pskj9Zq4Prvci452G8GJwhwKi/mOVLBNYc7Q9NhpJz9JovkC QF9REJbjSrs/Q== 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 1sybvQ-001wcY-42; Wed, 09 Oct 2024 20:00:44 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Alexandru Elisei , Mark Brown Subject: [PATCH v4 17/36] KVM: arm64: Sanitise ID_AA64MMFR3_EL1 Date: Wed, 9 Oct 2024 20:00:00 +0100 Message-Id: <20241009190019.3222687-18-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241009190019.3222687-1-maz@kernel.org> References: <20241009190019.3222687-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, joey.gouly@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, alexandru.elisei@arm.com, broonie@kernel.org 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-20241009_120047_427119_04D0CE53 X-CRM114-Status: GOOD ( 10.88 ) 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index c42f09a67a7c9..c9638541c0994 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1617,7 +1617,9 @@ static u64 __kvm_read_sanitised_id_reg(const struct kvm_vcpu *vcpu, val &= ~ID_AA64MMFR2_EL1_CCIDX_MASK; break; case SYS_ID_AA64MMFR3_EL1: - val &= ID_AA64MMFR3_EL1_TCRX | ID_AA64MMFR3_EL1_S1POE; + + val &= ID_AA64MMFR3_EL1_TCRX | ID_AA64MMFR3_EL1_S1POE | + ID_AA64MMFR3_EL1_S1PIE; break; case SYS_ID_MMFR4_EL1: val &= ~ARM64_FEATURE_MASK(ID_MMFR4_EL1_CCIDX); @@ -2500,7 +2502,8 @@ static const struct sys_reg_desc sys_reg_descs[] = { ID_AA64MMFR2_EL1_NV | ID_AA64MMFR2_EL1_CCIDX)), ID_WRITABLE(ID_AA64MMFR3_EL1, (ID_AA64MMFR3_EL1_TCRX | - ID_AA64MMFR3_EL1_S1POE)), + ID_AA64MMFR3_EL1_S1POE | + ID_AA64MMFR3_EL1_S1PIE)), ID_SANITISED(ID_AA64MMFR4_EL1), ID_UNALLOCATED(7,5), ID_UNALLOCATED(7,6),