From mboxrd@z Thu Jan 1 00:00:00 1970 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 CB77AC83F1A for ; Mon, 21 Jul 2025 11:39:41 +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=69j6Hci931s3BT6VHxmODdhkbTp/nYaXa7nFXD6lXvk=; b=U+5xpe7MBco9F/o62hizvS7SQp 8Ga5u0Z1pEYl44zF8vBVS10ZAaKcf91QOTRjZYNTnV1c/5t95Nc3kRJzGl6KrI6B2iGPtjPab5kja 6DAbZlPz2tUxmy61TdeVn4x7eSdBNCyiQf0z04goijJlpuQCXAj78UbcMX/oo+66sPoSaXF/Lc5W1 H9OiFnwuCo15TAhQMC8D2+8tym5aSkLpsNr6iQiQ/nOZ00Q3PKl4QLPU5qzThvHSS6staWJhu1agZ y/+KnTj29Vw4qw9jA8/bAE9TBLTkkdNz7zv/PoQwq55aArcQ67C7WAHAsfXICL7xCbytW3srI9lHu 3rJRJtLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1udork-0000000H7hC-3Alg; Mon, 21 Jul 2025 11:39:33 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1udncv-0000000GwmL-1F7I for linux-arm-kernel@lists.infradead.org; Mon, 21 Jul 2025 10:20:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CAFBC5C5C04; Mon, 21 Jul 2025 10:20:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75E80C4CEF7; Mon, 21 Jul 2025 10:20:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753093208; bh=gFDYm7TB6lkDfF9GDf5OjAQa1yBvnoVEllSD1/QRnvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/0xZwp2xenh9Aknrbc2sbnMrygH2j/vnPz51+Y4oDqAedhGTF7oaDMazOgGcIzPI d2Faw4FCC4aJiojN74c+LuszB8BQm1IETSHTz4iewz+AXvF6Im1GN5Yl4rAgLUSv7w hrKKhxnEia5AbvIe7+AW3t78/ry6b8Ku+MyRqEuGKiiI2Joxk4QCVjajlniOqTw/66 Xdo5S+2bF568YO5tLsO2VE/Xo4EW+2zJIYFRRYqGNS2uVGuxix3F79bMdP4uJhZWVL lbWWxerVnuED/FEEtt/qVYipPSpVXlcOWqmy+Tl31aYAjx+9hsJxIfWti8m+YpJYpo 0im1/gd9hjkQA== 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 1udncs-00HZDF-Jp; Mon, 21 Jul 2025 11:20:06 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: Joey Gouly , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Will Deacon , Catalin Marinas Subject: [PATCH 6/7] KVM: arm64: Expose FEAT_RASv1p1 in a canonical manner Date: Mon, 21 Jul 2025 11:19:54 +0100 Message-Id: <20250721101955.535159-7-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20250721101955.535159-1-maz@kernel.org> References: <20250721101955.535159-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, joey.gouly@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, will@kernel.org, catalin.marinas@arm.com 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-20250721_032009_373408_7DA5BCF9 X-CRM114-Status: GOOD ( 12.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 If we have RASv1p1 on the host, advertise it to the guest in the "canonical way", by setting ID_AA64PFR0_EL1 to V1P1, rather than the convoluted RAS+RAS_frac method. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/sys_regs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 9fb2812106cb0..549766d7abca8 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -1800,6 +1800,15 @@ static u64 sanitise_id_aa64pfr0_el1(const struct kvm_vcpu *vcpu, u64 val) if (!vcpu_has_sve(vcpu)) val &= ~ID_AA64PFR0_EL1_SVE_MASK; + /* + * Describe RASv1p1 in a canonical way -- ID_AA64PFR1_EL1.RAS_frac + * is cleared separately. + */ + if (cpus_have_final_cap(ARM64_HAS_RASV1P1_EXTN)) { + val &= ~ID_AA64PFR0_EL1_RAS; + val |= SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, RAS, V1P1); + } + /* * The default is to expose CSV2 == 1 if the HW isn't affected. * Although this is a per-CPU feature, we make it global because -- 2.39.2