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 3B062C48BC1 for ; Wed, 14 Feb 2024 13:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=fX3RYqkNkN0bK8sxsD8uDTDCFzjZSTx7hZz6MbAQsXM=; b=OCEaish7Ioz35M Fr9LsQAob40LPJQLdw+AgBolvBN/si0ZYS17SQBWYrFt/KE3UrdA/x+fEf47BfhFZ/RqqrM+34kB2 9VOwjEazjmn4TthhoCh3fikmT2hTTEVV82A9drJEa1W3dOjBebBNt1ab54Kchny3f9vXlvqMkK77y LO/AwHoajhlvxZCnjt1WZK28vbXtuOti908F7ddMgo60ZFCXSybxnli6/sP8a9pr0Am5pxnE4pyKv VejiDmE6PPvrmPvWyDpO5Bg3C6TNJm3IrWVM9iQPr25ra6wojJzOsgC4IBuL1yNOpvv3Xt74GrcTU yB9fwFP5lm1iA1KjQ+cg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1raF9z-0000000CxsH-2oBq; Wed, 14 Feb 2024 13:18:47 +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 1raF9m-0000000CxfK-0jdU for linux-arm-kernel@lists.infradead.org; Wed, 14 Feb 2024 13:18:37 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 9110B61952; Wed, 14 Feb 2024 13:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E57CC43399; Wed, 14 Feb 2024 13:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707916713; bh=lsi00Iid2kGWBmBrapWC34ZWsuXYYtDZi0I6WcPKeUI=; h=From:To:Cc:Subject:Date:From; b=LCcjeERXjjBZuep5xdM//OPrtwcaSe0Ps5uAUYPbIek7IcLnH4Kj77FuCxF0W8/ag WjgGNnmt1NgQVeTjdSOCDhsuMN+ughvr8QcgGXGRn/xLgPaJTK3LOTpCGJnvq68EDT /f/F7vdRXgglwgi15KRBgnnYlWns8Dl21p4ngHAYBqUmnd/oAGcwq8UHO2IoVsLcZz sAddYtUEVm76wFxAV3wgEtXa9RrySWMcOYKjXEC7KKP4EOFvG9QDQy0x19Ka0czCyu pbd8UB51f+9RUGoDtQ4xH1hzo4bFod/k8rneU+keQkXPhgPN0XnDil+soRgK6/Z106 KCqgwHqaASEEA== 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 1raF9i-00394l-I4; Wed, 14 Feb 2024 13:18:30 +0000 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Catalin Marinas , Will Deacon , Joey Gouly , Mark Brown Subject: [PATCH v4 00/26] KVM/arm64: VM configuration enforcement Date: Wed, 14 Feb 2024 13:18:01 +0000 Message-Id: <20240214131827.2856277-1-maz@kernel.org> X-Mailer: git-send-email 2.39.2 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, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, 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-20240214_051834_650769_48311370 X-CRM114-Status: GOOD ( 12.55 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This is the fourth version of this configurationm enforcement series after additional reviewing from Suzuki and Oliver. Many thanks to both. I think I have taken most of the feedback into account, but please shout if I have ignored something. * From v3: [3] - Fixed copy-paste issue while testing for the PAC flags - Added Suzuki's RB on patch #2 * From v2: [2] - Fix totally broken handling of negative features by delegating the work that requires a functionnal brain to other people - Fix handling of HCR_ENSCXT as RES0 instead of RES1 (and its consequences...) - Add handling of VTTBR_EL2.CNP being RES0 - Add a snapshot of all RES0/RES1 fields so that we can catch them being changed behind our backs - Various cleanups * From v1: [1] - Fix embarrassing crash with FEAT_MOPS - Better error handling in the FGT code - Added/Fixed comments - Simplified the __vcpu_sys_reg() macro - Fixed FEAT_PIR handling - Folded in Oliver's PMU rework [1] https://lore.kernel.org/all/20240122201852.262057-1-maz@kernel.org [2] https://lore.kernel.org/all/20240130204533.693853-1-maz@kernel.org [3] https://lore.kernel.org/all/20240205103431.1104133-1-maz@kernel.org Marc Zyngier (26): arm64: sysreg: Add missing ID_AA64ISAR[13]_EL1 fields and variants KVM: arm64: Add feature checking helpers KVM: arm64: nv: Add sanitising to VNCR-backed sysregs KVM: arm64: nv: Add sanitising to EL2 configuration registers KVM: arm64: nv: Add sanitising to VNCR-backed FGT sysregs KVM: arm64: nv: Add sanitising to VNCR-backed HCRX_EL2 KVM: arm64: nv: Drop sanitised_sys_reg() helper KVM: arm64: Unify HDFG[WR]TR_GROUP FGT identifiers KVM: arm64: nv: Correctly handle negative polarity FGTs KVM: arm64: nv: Turn encoding ranges into discrete XArray stores KVM: arm64: Drop the requirement for XARRAY_MULTI KVM: arm64: nv: Move system instructions to their own sys_reg_desc array KVM: arm64: Always populate the trap configuration xarray KVM: arm64: Register AArch64 system register entries with the sysreg xarray KVM: arm64: Use the xarray as the primary sysreg/sysinsn walker KVM: arm64: Rename __check_nv_sr_forward() to triage_sysreg_trap() KVM: arm64: Add Fine-Grained UNDEF tracking information KVM: arm64: Propagate and handle Fine-Grained UNDEF bits KVM: arm64: Move existing feature disabling over to FGU infrastructure KVM: arm64: Streamline save/restore of HFG[RW]TR_EL2 KVM: arm64: Make TLBI OS/Range UNDEF if not advertised to the guest KVM: arm64: Make PIR{,E0}_EL1 UNDEF if S1PIE is not advertised to the guest KVM: arm64: Make AMU sysreg UNDEF if FEAT_AMU is not advertised to the guest KVM: arm64: Make FEAT_MOPS UNDEF if not advertised to the guest KVM: arm64: Snapshot all non-zero RES0/RES1 sysreg fields for later checking KVM: arm64: Add debugfs file for guest's ID registers arch/arm64/include/asm/kvm_arm.h | 4 +- arch/arm64/include/asm/kvm_host.h | 98 +++++++- arch/arm64/include/asm/kvm_nested.h | 1 - arch/arm64/kvm/Kconfig | 1 - arch/arm64/kvm/arm.c | 7 + arch/arm64/kvm/check-res-bits.h | 121 ++++++++++ arch/arm64/kvm/emulate-nested.c | 231 +++++++++++++----- arch/arm64/kvm/hyp/include/hyp/switch.h | 130 +++++----- arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 24 +- arch/arm64/kvm/nested.c | 267 ++++++++++++++++++++- arch/arm64/kvm/pmu-emul.c | 11 +- arch/arm64/kvm/sys_regs.c | 238 +++++++++++++++--- arch/arm64/kvm/sys_regs.h | 2 + arch/arm64/tools/sysreg | 8 +- include/kvm/arm_pmu.h | 11 - 15 files changed, 973 insertions(+), 181 deletions(-) create mode 100644 arch/arm64/kvm/check-res-bits.h -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel