From patchwork Tue Aug 13 10:43:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13761768 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 1BE49C52D7C for ; Tue, 13 Aug 2024 10:46:14 +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=sXucwTU7ue38UjiN3meM3QlyLzObCensA5Hi0Pf5qsA=; b=aTpX2oazTAqxmBaM81azNNj97V UGn7lSJ7gv0nue+uUkxL40AKMWNj2AW2DBLiQNh/TV2Ius4EKuyWbtj+8o1tjKHGEyNznW4KBgmGt qV2fwgTlEINeVHe2wHeeELVDk+3dDL6TeyTI4saNKnArXzE+cvGHzKmdMy85+fQSv0G6vIVTK499p g6AcQq3/+GzETjjbyEz5cI2+3ecN4VP+Xkzy1F7j4vgP7mQJkgKdn8MMxiP9jBqhqefjPam/A2ol3 qLP3ce/Sq6Rp2i6sFIBPg7Y3sjXsTIhxqUtFKt8YBujIlpHty00t6eAPfEBc1S5P7vYgKIOgnHPyL qXMFKH4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdp2Q-00000003NrY-0Ywv; Tue, 13 Aug 2024 10:46:02 +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 1sdp0d-00000003NEo-3agP for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 10:44:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 544786163D; Tue, 13 Aug 2024 10:44:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3FF0C4AF18; Tue, 13 Aug 2024 10:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723545850; bh=mcDksh3U4KLI5FYXHkvHzDVOLwp0prVY32Ojy0Do63s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BfC/dzN/e+su9MZ88MNp39yik96svabW4uzOQhzH5ld/K23H/8iUeLI56Zx+PgOYn ipaNi44Hn+N5LlaqQv3Gl6a5apTpcXTR2UTeFs7f3RU7/0O68eEIWQsBoDM/ld8z7s eKEZxnoa9utQudtYOXYuch9w15gg9GJzxRQupbCE/oLTFafAGrjojgH5Yl3YwR6Rog p15MhntB5QoHGQUzTNQjyBbWeu7UYfnZqguaOxCQbaw2NSkbE0cLh6mqb8ZVPCeRq/ 8qfNohFygoe3//LfpZGp45zhAv5nO2b/tmaDigarvbdiNr9yh3X3Nd5qedF6aRa4Bq stu3jL3x2qw2w== 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 1sdp0a-003JD1-UN; Tue, 13 Aug 2024 11:44:08 +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 , Fuad Tabba , Joey Gouly , Mark Brown Subject: [PATCH v3 5/8] KVM: arm64: Honor trap routing for FPMR Date: Tue, 13 Aug 2024 11:43:57 +0100 Message-Id: <20240813104400.1956132-6-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240813104400.1956132-1-maz@kernel.org> References: <20240813104400.1956132-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, tabba@google.com, joey.gouly@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-20240813_034411_962750_E61E1949 X-CRM114-Status: GOOD ( 11.25 ) 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 HCRX_EL2.EnFPM controls the trapping of FPMR (as well as the validity of any FP8 instruction, but we don't really care about this last part). Describe the trap bit so that the exception can be reinjected in a NV guest. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/emulate-nested.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c index 05166eccea0a..ee280239f14f 100644 --- a/arch/arm64/kvm/emulate-nested.c +++ b/arch/arm64/kvm/emulate-nested.c @@ -83,6 +83,7 @@ enum cgt_group_id { CGT_CPTR_TAM, CGT_CPTR_TCPAC, + CGT_HCRX_EnFPM, CGT_HCRX_TCR2En, /* @@ -372,6 +373,12 @@ static const struct trap_bits coarse_trap_bits[] = { .mask = CPTR_EL2_TCPAC, .behaviour = BEHAVE_FORWARD_ANY, }, + [CGT_HCRX_EnFPM] = { + .index = HCRX_EL2, + .value = 0, + .mask = HCRX_EL2_EnFPM, + .behaviour = BEHAVE_FORWARD_ANY, + }, [CGT_HCRX_TCR2En] = { .index = HCRX_EL2, .value = 0, @@ -1108,6 +1115,7 @@ static const struct encoding_to_trap_config encoding_to_cgt[] __initconst = { SR_TRAP(SYS_CNTP_CTL_EL0, CGT_CNTHCTL_EL1PTEN), SR_TRAP(SYS_CNTPCT_EL0, CGT_CNTHCTL_EL1PCTEN), SR_TRAP(SYS_CNTPCTSS_EL0, CGT_CNTHCTL_EL1PCTEN), + SR_TRAP(SYS_FPMR, CGT_HCRX_EnFPM), }; static DEFINE_XARRAY(sr_forward_xa);