From patchwork Thu Aug 22 15:10:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13773680 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2322FC52D7C for ; Thu, 22 Aug 2024 15:12:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA8A580038; Thu, 22 Aug 2024 11:12:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A32098001E; Thu, 22 Aug 2024 11:12:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8854D80038; Thu, 22 Aug 2024 11:12:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5927E8001E for ; Thu, 22 Aug 2024 11:12:10 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C924EA88BC for ; Thu, 22 Aug 2024 15:12:09 +0000 (UTC) X-FDA: 82480221978.02.2BC1413 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf30.hostedemail.com (Postfix) with ESMTP id 2330480024 for ; Thu, 22 Aug 2024 15:12:07 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf30.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724339462; a=rsa-sha256; cv=none; b=eme8nVBDi16XmW8sE+O2IxSoFMy+fjkU8fhaHM/lIEJJSbe89puCjvAfJ9oGqSvZHg+Tbs IrflTDzpT268dYVw2QtVmxaKcms+MLYykLmnKsYzf1XmF/ld3cj4H0p3KHbewIRgW5Giyu Ee1XuSoYJxWS4R5JGUg8xBLbH88ye9s= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf30.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724339462; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lhYPnmIy9QUOshqY63sjGUWSg8MXgpvHQMLfdS0GHX8=; b=j6NDX7UisNC6A4O+5AQeLzkvi2G504+XOVA2lO/0J9YUFucIZlUR94K7O9/JmkkACfkYLz UqrgoOTw2//m+YqS6wP2ExOt6TosHUx8/q9xdZ10LGuzuh3MgwyqxY6UjLYrH8//GUGMBs 8SfuAl4VQseenJPxBtr1/9mTHVuksNk= 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 8BA89FEC; Thu, 22 Aug 2024 08:12:33 -0700 (PDT) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6CF9D3F58B; Thu, 22 Aug 2024 08:12:03 -0700 (PDT) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: nd@arm.com, akpm@linux-foundation.org, aneesh.kumar@kernel.org, aneesh.kumar@linux.ibm.com, anshuman.khandual@arm.com, bp@alien8.de, broonie@kernel.org, catalin.marinas@arm.com, christophe.leroy@csgroup.eu, dave.hansen@linux.intel.com, hpa@zytor.com, joey.gouly@arm.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, skhan@linuxfoundation.org, szabolcs.nagy@arm.com, tglx@linutronix.de, will@kernel.org, x86@kernel.org, kvmarm@lists.linux.dev, linux-kselftest@vger.kernel.org Subject: [PATCH v5 10/30] KVM: arm64: Sanitise ID_AA64MMFR3_EL1 Date: Thu, 22 Aug 2024 16:10:53 +0100 Message-Id: <20240822151113.1479789-11-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240822151113.1479789-1-joey.gouly@arm.com> References: <20240822151113.1479789-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 2330480024 X-Stat-Signature: k557duntggfx4ge35zbewjejhr3dgci7 X-Rspam-User: X-HE-Tag: 1724339527-947463 X-HE-Meta: U2FsdGVkX1+zltUU1VR8Drrd/Xt85XuUrqpL9cSfzzj1cAqvCcnGNS2lntaYcmcr7dySB8I1Yv2bjlEo7nHvlHaImhskM9U9GVUM/hed8gzmxk6K0zsBtXuxZhN5D0RENkZEQVU7aIBYcFwx8sT1b7PJnTYVtOGeYJPI0mP9ICMtwS6/IM2MQFzRi+uepGgyeTMG6DlfeCs/Ts9XBGDpODlwBeY3vZ/ahdfmVuIFZeO9Yf9qi20FnzOpPOox5J4IJPqnh2EAtioOPkzsH+ZzBbkrhbFU1SLBiInWsVQWZWv3gzgqO4nIbqtX2omyqZr4fm0KJTbullrD7s7pyq2cHiPEmJ3TLHdTDdxKKi2e9zHUPBo0pFqE/noKasAiSEkB8t16huCLaK+pADo5MI2GdXjuMQiVJ3TyVinm8ihzW7tda3tu2O0yN7K0iq+6JnKvDw6xWRcBMz4Q2Du2pokAWOz82H71FosIQmOHq7e8DFXCeK7LLN/e7wdq1lnLgJoPsGJf9tOap8zP/bcXb3FvaNQJwsiKxJaimZyq+hgqblpPOyRE3iP+2AufTPX7T+4fQ8JljgkgrsMMV3NinfhnQeBETAQ8DToY43b09TftDeQqkxdu0dF520zt7NkwYsvuyxxx2yj4kIzhql5gecTI63C6pzest871wJ4QjjxWfYG0E5o+DxnDHudMf05dC32C5YnY5uJdAmseIcjpPb21N7uBr66tplK+56IgHxwUwRbsddGeThW5u5UfqFyZtTLK/iQj2AmD0xljtA87Mv6BAdChMDYyDgP9IsDzrNPgdZlwgi96un5SynqIM9ivS7Oh8/n6DpNcyFPaemKTYOFtZOrdyFLeJE6ldPePctx1OPlBRTcgOzza+DRdyEHEFARq03MNoJrB0uodH9jePE8CUd3Rebe/wY5oYy5ty0JD8Rc6O0cdLggoHqGL39cu2KKxizQWs8/Wpnhx9vG5fUN eJNXt26q puNIqpOkVQk/H35rEG+tdgrAoiCQXm4l/Lxg0yCarigTMUf3GHGwNtPfha8Iu8umOcvRhjmyiyLvzLtyas4jW/j5tkvegomMetYAnVWs7IA5YvthBKLXmqEtWPXqWjoZS3auxC4nFvdaF4Wb9IN41Yk0ini6Ok8xayurWHx/rWTFY1w6Fs1hWB604KdCnqutB3vqLTq2nlNcFAxYn6uepC43Aq24kOZRgOGARid/92RdcwjuTSDm72zxyw7m6ATKo75Wc5dNAtLek9cM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add the missing sanitisation of ID_AA64MMFR3_EL1, making sure we solely expose S1POE and TCRX (we currently don't support anything else). [joey: Took Marc's patch for S1PIE, and changed it for S1POE] Signed-off-by: Marc Zyngier Signed-off-by: Joey Gouly --- arch/arm64/kvm/sys_regs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git arch/arm64/kvm/sys_regs.c arch/arm64/kvm/sys_regs.c index e7208b59ea12..0f13378e761c 100644 --- arch/arm64/kvm/sys_regs.c +++ arch/arm64/kvm/sys_regs.c @@ -1556,6 +1556,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_S1POE; + break; case SYS_ID_MMFR4_EL1: val &= ~ARM64_FEATURE_MASK(ID_MMFR4_EL1_CCIDX); break; @@ -2427,7 +2430,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_S1POE)), ID_SANITISED(ID_AA64MMFR4_EL1), ID_UNALLOCATED(7,5), ID_UNALLOCATED(7,6),