From patchwork Tue Aug 20 13:17:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13770095 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 054CFC3DA4A for ; Tue, 20 Aug 2024 13:20:32 +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=rNh+egg+03aq5bgVsST4UNnsrV N8zPQhzUAt8HJz827dmAoUzGtkDQX6VRtTBLjsgR//fdbURAyrVcsbf0fRVw4KlpzMSR7sEFmdsle d5QJiY7Qa65FLJ/Jfs+pcX60M7Ck3sYy1mkAm/BIsLZhfpp3n5547T2mAfBns5vUPZYH4djyOP5Rk k9lFSnlPEHNRxQNt4UUcPK3oafP5VWbMcgthlTBJ+/OtEwRQ8u0zqibnr/Lnqlv3/v+wzDTeKooZh Zt2F99HZ0RFp1bNCs/RTGJMmgKMjsMEuqqTxn2Fa89fytzfit92TaXcxSRk9zmUsNjWaRqJzsuIiB FhSWfCQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgOmW-00000005KK4-1kPS; Tue, 20 Aug 2024 13:20:16 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgOkT-00000005Jhc-3xWE for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 13:18:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 38F2460DD3; Tue, 20 Aug 2024 13:18:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB192C4AF12; Tue, 20 Aug 2024 13:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1724159889; bh=mcDksh3U4KLI5FYXHkvHzDVOLwp0prVY32Ojy0Do63s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HeypVupPBTc/dbLmV6NEDrBtyAUZgrHs38t1Li59AYc8kKscqQ5ADoylXAKJTWw4T gJ6zntrJfo+oj4ItodH3QO05gkM4w4epqJiBQ5kpDkRx6IoXeb/4a78A15B0nWSvCu oXEiH9mFcoKX2JXPDOhmL8DKFesiKDKN30eiTd4eo1tS4uHSE6NYSCn1w11rCzDwVu 0VY8txl0UZpnScMBPNL+dQOtFL9UgRfCCHq6IdxevoUYIDKUmODbk7WYiMBPoF1ylT oQQKzemp4uK1aUTgBuMtYKCdPmeGaKfBlLzx7TZDwYrkFZGiu95EOnVD9/FfzdXGg/ /ygZJA1z6PxTw== 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 1sgOkQ-005HMQ-W7; Tue, 20 Aug 2024 14:18:07 +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 v4 5/8] KVM: arm64: Honor trap routing for FPMR Date: Tue, 20 Aug 2024 14:17:59 +0100 Message-Id: <20240820131802.3547589-6-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240820131802.3547589-1-maz@kernel.org> References: <20240820131802.3547589-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-20240820_061810_073579_855CB175 X-CRM114-Status: GOOD ( 11.10 ) 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);