Message ID | 20241217151331.934077-9-maz@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 0FC21E7717F for <linux-arm-kernel@archiver.kernel.org>; Tue, 17 Dec 2024 15:25:09 +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=5KvmCEAGlm+bTGs5uSdcjjBclifUoSwXdBme61AX1J0=; b=B8VISW5I0uIYcTaqW3H9LOhdSs z125jiMDy6Me/IWTURZndYRpc/Di7ylcHHSic/DNLVa9ZzOmObUizo6tJDnNRN3p2pho/bbA9bewb bVtAXMSegDPvoJBnrDoD4mmMU8U7uAg1vy79Hg/vilSfodd7WpzKqwXFcxjRm6NFsubHmWbc3IJYV hWUenoqX9znVZZcuHLnnsWBYF/i6e26o9JIxu7drDt3mTizHJkJCDGPxN4+bbubyuw8b3ZalDkPb4 GOEoJ7DLUbgr+01C2yQYMrgdZi1QfA8t3Y3qEkWQ9Ou070pmqapRhpHMY+htFaZebmk5AVXlGGD8q TEk/X6Fg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNZRR-0000000DwqW-17PA; Tue, 17 Dec 2024 15:24:59 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNZGy-0000000DuUQ-2AmU for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 15:14:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 6D125A41A15; Tue, 17 Dec 2024 15:12:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F14F9C4CEDE; Tue, 17 Dec 2024 15:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734448446; bh=AAx1thK/qARvmlKm/GHshhs0gk8iIkS9tRKm3XsQwuI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MA10NKDGPx1T0Y/jpTwLsC+gBtPG9BNeMRHgOCNoEaxk93pm+qzEnjIhVFegzYo05 k6N/sxmiNEIcgac1Zz6gLwdY+yavfYz/7zMh7FS+oliGrqWzDvXHiWTgMRmJBez8ca DdBjSCZ4nATaVL0ueOPSAEfHOi58gEiNn6Db2qdtffKNo/AirxOxAvWQeDY62o5qUu OGLf2jkD+gHkKLau47SKyHrif7HXU1UZZWP9JA2/SphWiMEbib+4A2YPg88Np4N/Bf brhzZLYgzTmFDPyiNBQxQC21PcV9+AVEMLS5nKcFvGHKfGTYmQX7AErPSP1jj4uX8k wsP1vJ8eVUEEA== 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 <maz@kernel.org>) id 1tNZGu-004bWV-2b; Tue, 17 Dec 2024 15:14:04 +0000 From: Marc Zyngier <maz@kernel.org> To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: Joey Gouly <joey.gouly@arm.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Oliver Upton <oliver.upton@linux.dev>, Zenghui Yu <yuzenghui@huawei.com>, Andre Przywara <andre.przywara@arm.com>, Eric Auger <eauger@redhat.com>, Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com> Subject: [PATCH 08/16] KVM: arm64: nv: Sanitise ICH_HCR_EL2 accesses Date: Tue, 17 Dec 2024 15:13:23 +0000 Message-Id: <20241217151331.934077-9-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241217151331.934077-1-maz@kernel.org> References: <20241217151331.934077-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, andre.przywara@arm.com, eauger@redhat.com, gankulkarni@os.amperecomputing.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-20241217_071408_621030_6BB6E574 X-CRM114-Status: GOOD ( 10.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
KVM: arm64: Add NV GICv3 support
|
expand
|
diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index 9b36218b48def..37f7ef2f44bd8 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -1271,6 +1271,15 @@ int kvm_init_nv_sysregs(struct kvm *kvm) res0 |= MDCR_EL2_EnSTEPOP; set_sysreg_masks(kvm, MDCR_EL2, res0, res1); + /* ICH_HCR_EL2 */ + res0 = ICH_HCR_EL2_RES0; + res1 = ICH_HCR_EL2_RES1; + if (!(kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_EL2_TDS)) + res0 |= ICH_HCR_EL2_TDIR; + /* No GICv4 is presented to the guest */ + res0 |= ICH_HCR_EL2_DVIM | ICH_HCR_EL2_vSGIEOICount; + set_sysreg_masks(kvm, ICH_HCR_EL2, res0, res1); + return 0; }
As ICH_HCR_EL2 is a VNCR accessor when runnintg NV, add some sanitising to what gets written. Crucially, mark TDIR as RES0 if the HW doesn't support it (unlikely, but hey...), as well as anything GICv4 related, since we only expose a GICv3 to the uest. Signed-off-by: Marc Zyngier <maz@kernel.org> --- arch/arm64/kvm/nested.c | 9 +++++++++ 1 file changed, 9 insertions(+)