From patchwork Thu Aug 1 09:19:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13750079 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 EA146C3DA4A for ; Thu, 1 Aug 2024 09:26: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: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=TxkBPLb98BcA0gpegOE2nJkqZHBPfqiPmjzj8/trcmw=; b=LiiPlMdzcI8/WfBY5jllPbqRKl u2WY6H6zXpTHVY/v+ztC0dOF62orHGkesuOYtywsHQ+ECSIlZDOHAKfkvVMY+ou5FDEiG9c2Czb0/ 7JZ4jqfdOMbRht8jccJoLYvieUR6OWU0xn4oIQ8QDpznbWWfNnFTzN/AHDnsFSrGQvY3agvTStGkM XmmMsT7oHwW92v3iDJoRdhVcFZwzzYNhpTEIv9FTKPFYVVYM7euhK88rqroPA5mxMKNkqD2S+Oze3 sPFqdug+A6aKr6S5dJvfqC7HqhT1bkTWMvbPKiw2YnIgTM03jQOJTkylSkaj9E7PRwrs/LU7UnSzE NmndawZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZS4E-00000004YDk-3yww; Thu, 01 Aug 2024 09:25:50 +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 1sZS16-00000004X6z-26Ke for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 09:22:38 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D03BC627A2; Thu, 1 Aug 2024 09:22:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E4AFC4AF09; Thu, 1 Aug 2024 09:22:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722504155; bh=jKPPLmUGCI7QL8VJUkJaCfnGktj77nkngQUnHwRBvJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PI3gWqzy2BGL03Ejz9cEGUwgi2U2UVX8F2WcF7EHhB9/QJaoZlQXwMBqSNdkYtqdp tyGcfcf9Nlpdl9IpM+orzB89Pk8WUgZD/gmosIqjy5PttGP3LwcqdzlqId5Uzj6Hvr X6eVNqsQKSBxgf1zweXGdUX4BHepcN95LyAhk0dzGDxAGAMtS95AjSVnPUi+pnLTTR 9Db9btI9SWLQzPXaSA0M3It71C2TpaDp8YJmGPcJ/JsCAS2ZH5iA0bxQ8evhhrPq0n GcgoErM+3P9y6kwjIVN9U+5lkZcyFZkqymuvh79WQvqZudT8P3kd5eH/6bSG/6DSIh MTAtj6o6/aUCQ== 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 1sZRya-00HKNZ-06; Thu, 01 Aug 2024 10:20:00 +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 v2 2/8] KVM: arm64: Add predicate for FPMR support in a VM Date: Thu, 1 Aug 2024 10:19:49 +0100 Message-Id: <20240801091955.2066364-3-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240801091955.2066364-1-maz@kernel.org> References: <20240801091955.2066364-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-20240801_022236_657092_6DDCBD73 X-CRM114-Status: GOOD ( 12.89 ) 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 As we are about to check for the advertisement of FPMR support to a guest in a number of places, add a predicate that will gate most of the support code for FPMR. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_host.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index e244e3176b56..e5cf8af54dd6 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -1475,4 +1475,8 @@ void kvm_set_vm_id_reg(struct kvm *kvm, u32 reg, u64 val); (pa + pi + pa3) == 1; \ }) +#define kvm_has_fpmr(k) \ + (system_supports_fpmr() && \ + kvm_has_feat((k), ID_AA64PFR2_EL1, FPMR, IMP)) + #endif /* __ARM64_KVM_HOST_H__ */