From patchwork Wed Aug 21 23:35:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13772237 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 0EA5CC52D7C for ; Wed, 21 Aug 2024 23:38:00 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=v6PpDRnVrkCxF0cJk+Q3s1OHiD6FKHKLy76A8JwzKWY=; b=qK9vY2ge9+JqLmbFynZ4wJ1mtf jUXe7MBMtU7AIzH2yZMDKAl9ogl4qwo/G8O8N28J2OFRGClfqhl4JFLwEHqiFMtWBGC5j7p4usWYV NxZ3/mvqvdvCk38FVi7QWuEX0FEsAEGCf8GloLdNCuzx76ctAlBLNVkRbJrrw2Roco1vOcm1zzaiT TqHTeASv4ywPp3SSHvNoTtBnSk4QxoEmxUnUXq4nE6+jgmiaHhCCfCL5ES4U3jF7xy2vZzFELH4/e PZzASufwbKpM4C54j1OQzvLo/0Qs10REUbDR7spZPqFJH6l8flma863vTMgt5u2Mpy1WCgSsGro7z p8Jsz3kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgutf-0000000AgKM-3Mr4; Wed, 21 Aug 2024 23:37:47 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgusI-0000000Ag2Q-1FtL for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 23:36:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7558D61181; Wed, 21 Aug 2024 23:36:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DBC0C32782; Wed, 21 Aug 2024 23:36:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724283381; bh=TnLcZV5j0h1vfwLf7V+sLcnJs4449D1TH0HuTBuSxFY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UVJODIBkPa2yzzOUczJ87OFjHeeEH3ykt9CBt7yjiV4HZYE5kvEx26ie2f9J75OUg ThXNgMfoHS7mdPzOmzkZGPY8Lo/VAEQdAIBMan1I9NcdtDPdC4hxtg5F14hJL47pJC BrBWMwsjc2wGJNt5+IF/MKpI/hBRJq0FApyf49L8mn0SbIBElWTgyKdX6Vqhe4n+rt gsNQFRQVBMTYTR2RyslAaCrlQBNmuGQrsw5AxH0O6p5iZeCnQ7ZxTlPNccy5aC6erg ZgEL6Pr28BareoygcSb0dZnI/LkeXtCAlqw5X+2oqdsYQo78sInWDMbRoZRi6dSXCe X11aUKnWCkePA== From: Mark Brown Date: Thu, 22 Aug 2024 00:35:36 +0100 Subject: [PATCH v2 1/3] KVM: arm64: Define helper for EL2 registers with custom visibility MIME-Version: 1.0 Message-Id: <20240822-kvm-arm64-hide-pie-regs-v2-1-376624fa829c@kernel.org> References: <20240822-kvm-arm64-hide-pie-regs-v2-0-376624fa829c@kernel.org> In-Reply-To: <20240822-kvm-arm64-hide-pie-regs-v2-0-376624fa829c@kernel.org> To: Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Catalin Marinas , Will Deacon , Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, Mark Brown , 20240813144738.2048302-1-maz@kernel.org X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1399; i=broonie@kernel.org; h=from:subject:message-id; bh=TnLcZV5j0h1vfwLf7V+sLcnJs4449D1TH0HuTBuSxFY=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmxnnp/eE7jfejNCJhPTNlB8GBsgUEO1dh38EUFkDi 7nBBSjSJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZsZ56QAKCRAk1otyXVSH0DiTB/ 9XkFXBeTHJFPIz0WRf13WK1WV5XrzrlUYRwxzkALiU6IEwF6/lfutvjFO6yGScRYuAsjHcXbTNdrDW 3iSSUULIKNAAmnzc8CMe8cGCDJCexf0uuXVKeiijGCpBI+y+u0L9SUckx7e0iE6oU03cBoqYSWQDst VUM/WL4ChuK4zB3cR7uZnHY/GYZGd30WxU4aeo82V6S78S5UJqZ9UppAlJDJ3eADeFTojthIOTzMWq 4y1ibnm+17XUpCSVsZolSJB9cK/AdQkTEDt1iOKWHuoBKKCK+A4SU7RNcWXGgVqk8HfXEjwtCKHlWm fmedslXbWsubOhmpAac9L+gDeYD4wz X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_163622_428457_F8E98A47 X-CRM114-Status: GOOD ( 11.65 ) 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 In preparation for adding more visibility filtering for EL2 registers add a helper macro like EL2_REG() which allows specification of a custom visibility operation. Signed-off-by: Mark Brown --- arch/arm64/kvm/sys_regs.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index d0b4509e59cb..1af15140e067 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -2136,6 +2136,15 @@ static bool bad_redir_trap(struct kvm_vcpu *vcpu, .val = v, \ } +#define EL2_REG_FILTERED(name, acc, rst, v, filter) { \ + SYS_DESC(SYS_##name), \ + .access = acc, \ + .reset = rst, \ + .reg = name, \ + .visibility = filter, \ + .val = v, \ +} + #define EL2_REG_VNCR(name, rst, v) EL2_REG(name, bad_vncr_trap, rst, v) #define EL2_REG_REDIR(name, rst, v) EL2_REG(name, bad_redir_trap, rst, v) @@ -2803,8 +2812,8 @@ static const struct sys_reg_desc sys_reg_descs[] = { EL2_REG_VNCR(HFGITR_EL2, reset_val, 0), EL2_REG_VNCR(HACR_EL2, reset_val, 0), - { SYS_DESC(SYS_ZCR_EL2), .access = access_zcr_el2, .reset = reset_val, - .visibility = sve_el2_visibility, .reg = ZCR_EL2 }, + EL2_REG_FILTERED(ZCR_EL2, access_zcr_el2, reset_val, 0, + sve_el2_visibility), EL2_REG_VNCR(HCRX_EL2, reset_val, 0),