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 C2026C001E0 for ; Fri, 28 Jul 2023 08:30:36 +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=tR2Xc5UAbUEetMr06CX/rQhewIEFZTQFL6Apjtu3YB8=; b=u8VSMGnYINaTgn IWYa0JK7bMiODck0AYYudDf2EFYp3IbBlu4iV73w9iQR+9panv3ezLKpoD8xWdoFs6EozmewyfaFe teTX2H22WeGMZjZvMdQHRv16/L2yr9nEzw/gO4vHTl73eQurVYNz9uWu9CG7M4VdB2cFSOLWC+VpJ BdsV3SUrl6Oz2xDEKparRw7tjKQnKDLdeV6+Vq9J/69bayMomxijxzFwR3KFQEjt6dJNvpBmpTdbs RaAJnsKktjJ4M06i2K0rghcA2hxc8Q6xISa9d4N1qhtCjO0+2XhpPySp/JPLvDCWK53WiB8oTz5Tj K3O3HM70LDOrG0aHbjAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qPIrN-002Oqm-0r; Fri, 28 Jul 2023 08:30:05 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qPIrK-002Ono-20 for linux-arm-kernel@lists.infradead.org; Fri, 28 Jul 2023 08:30:04 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A26C62057; Fri, 28 Jul 2023 08:30:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1516C43391; Fri, 28 Jul 2023 08:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690533000; bh=yZcmhkVMMz+kdgiMr/eWhQGJ2beGySESdCvZqQcaZy8=; h=From:To:Cc:Subject:Date:From; b=gqjS58jiIRcP+SC5UPgIH3fZINNtlflJLzew5gWXkmMFb9ZjjmdESFOfjj3+o6qJr VBP8lQ+KYTb/E1vBGscZJMh+oz0fPfKUloLjAzJ4rKeSRWpQJPw99W7SYOHGVlDOe2 0Uv0bAkE0a8w/i7GnLvnrCHz5Yzf1VBIcqtJFklXpNiySaROnrPBySu7DyZXvjRsz0 d8pzNE38Y0KAbDMRJpt7ATeDQTN74SIk+w4CA1wutY5n/Y+1+t7bY2t1EmMD7r1tww 3SQcieo7iTsc6pcoOHOS4lCplnxPWG9irGztu7GoZOpOail5psvMcTWnhJ0zNpF3JJ t4CFedxQv3BKg== 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 1qPIrG-0000EO-6L; Fri, 28 Jul 2023 09:29:58 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas , Eric Auger , Mark Brown , Mark Rutland , Will Deacon , Alexandru Elisei , Andre Przywara , Chase Conklin , Ganapatrao Kulkarni , Darren Hart , Miguel Luis , James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH v2 00/26] KVM: arm64: NV trap forwarding infrastructure Date: Fri, 28 Jul 2023 09:29:26 +0100 Message-Id: <20230728082952.959212-1-maz@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, eric.auger@redhat.com, broonie@kernel.org, mark.rutland@arm.com, will@kernel.org, alexandru.elisei@arm.com, andre.przywara@arm.com, chase.conklin@arm.com, gankulkarni@os.amperecomputing.com, darren@os.amperecomputing.com, miguel.luis@oracle.com, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.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-20230728_013002_750565_A440A9E5 X-CRM114-Status: GOOD ( 15.74 ) 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 As people are getting tired of seeing the full NV series, I've extracted some of the easy stuff which I'm targeting for 6.6. This implements the so called "trap forwarding" infrastructure, which gets used when we take a trap from an L2 guest and that the L1 guest wants to see the trap for itself. Most of the series is pretty boring stuff, mostly a long list of encodings which are mapped to a set of trap bits. I swear they are correct. Sort of (then are much more correct now that Eric has gone through them all with a fine comb). The interesting bit is around how we compute the trap result, which is pretty complex due to the layers of crap the architecture has piled over the years (a single op can be trapped by multiple coarse grained trap bits, or a fine grained trap bit, which may itself be conditioned by another control bit -- madness). This also results in some rework of both the FGT stuff (for which I carry a patch from Mark) and newly introduced the HCRX support. With that (and the rest of the NV series[0]), FGT gets exposed to guests and the trapping seems to work as expected. * From v1 [1]: - Lots of fixups all over the map (too many to mention) after Eric's fantastic reviewing effort. Hopefully the result is easier to understand and less wrong - Amended Mark's patch to use the ARM64_CPUID_FIELDS() macro - Collected RBs, with thanks. [0] https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/log/?h=kvm-arm64/nv-6.6-WIP [1] https://lore.kernel.org/all/20230712145810.3864793-1-maz@kernel.org/ Marc Zyngier (25): arm64: Add missing VA CMO encodings arm64: Add missing ERX*_EL1 encodings arm64: Add missing DC ZVA/GVA/GZVA encodings arm64: Add TLBI operation encodings arm64: Add AT operation encodings arm64: Add debug registers affected by HDFGxTR_EL2 arm64: Add missing BRB/CFP/DVP/CPP instructions arm64: Add HDFGRTR_EL2 and HDFGWTR_EL2 layouts KVM: arm64: Correctly handle ACCDATA_EL1 traps KVM: arm64: Add missing HCR_EL2 trap bits KVM: arm64: nv: Add FGT registers KVM: arm64: Restructure FGT register switching KVM: arm64: nv: Add trap forwarding infrastructure KVM: arm64: nv: Add trap forwarding for HCR_EL2 KVM: arm64: nv: Expose FEAT_EVT to nested guests KVM: arm64: nv: Add trap forwarding for MDCR_EL2 KVM: arm64: nv: Add trap forwarding for CNTHCTL_EL2 KVM: arm64: nv: Add trap forwarding for HFGxTR_EL2 KVM: arm64: nv: Add trap forwarding for HFGITR_EL2 KVM: arm64: nv: Add trap forwarding for HDFGxTR_EL2 KVM: arm64: nv: Add SVC trap forwarding KVM: arm64: nv: Add switching support for HFGxTR/HDFGxTR KVM: arm64: nv: Expose FGT to nested guests KVM: arm64: Move HCRX_EL2 switch to load/put on VHE systems KVM: arm64: nv: Add support for HCRX_EL2 Mark Brown (1): arm64: Add feature detection for fine grained traps arch/arm64/include/asm/kvm_arm.h | 50 + arch/arm64/include/asm/kvm_host.h | 7 + arch/arm64/include/asm/kvm_nested.h | 2 + arch/arm64/include/asm/sysreg.h | 270 +++- arch/arm64/kernel/cpufeature.c | 7 + arch/arm64/kvm/arm.c | 4 + arch/arm64/kvm/emulate-nested.c | 1731 +++++++++++++++++++++++ arch/arm64/kvm/handle_exit.c | 12 + arch/arm64/kvm/hyp/include/hyp/switch.h | 127 +- arch/arm64/kvm/nested.c | 11 +- arch/arm64/kvm/sys_regs.c | 15 + arch/arm64/kvm/trace_arm.h | 19 + arch/arm64/tools/cpucaps | 1 + arch/arm64/tools/sysreg | 129 ++ 14 files changed, 2345 insertions(+), 40 deletions(-) -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel