From patchwork Tue Jun 4 13:05: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: 13685274 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 B4D2FC25B78 for ; Tue, 4 Jun 2024 13:06:21 +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=OIddBv4TDqgktq9pS+Nbixrd/Yjl4ca1fogEPvYlIQQ=; b=FYNBsyIDugmDg9 ZKhlJskOEeLKPiZdXwk7BE7oFicOBmUHZZ9geFBaaQ8JUCgNEF4mguWhQh3stsnEcuaQl8vchzXNh w4vB8k7Q+koMoQw3PAYsn6nd1YLZVofDgqhtP/2JHjyQEl7PCRVcDFmY+jbt5bFzOcphnRfnmpJdG uN89OkQQnrZ0ZmrAF2fc6SSGg5TtmodjSs6DfuNMw19843aQFPrd2JF2DEMoI4bSywHMyJRCzztOj NunwzI7u9WPWmytVjbLOFhblwqiR0GHa9q06EGR8i5c47KGk6nxAJfE1qWtrLOa7L9i393jkW7UHN p3GYO3+msSCux/84C2Kw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETrf-00000002RAZ-28Sw; Tue, 04 Jun 2024 13:06:11 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sETrW-00000002R3w-3BsM for linux-arm-kernel@lists.infradead.org; Tue, 04 Jun 2024 13:06:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 61F29CE1116; Tue, 4 Jun 2024 13:06:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E77FC2BBFC; Tue, 4 Jun 2024 13:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717506359; bh=jgiMvoROmKbX19y+Xzc9VR3YZLxO0oGWc5sp//YYw4I=; h=From:To:Cc:Subject:Date:From; b=rVlnpwcJX6z7S2T8s9ky1xTI3wmqe5PWbplpGKa0/5atqTkU7TOI7BpKdP7mN2Ohm VbYtOxiPDgncWM1kBaRBsn6aELQxUK9nKgSoVg/AWtbS+Gb9EIMzmHVHQjVVBs/om+ IGmpC1Biv/47XK75WgLx/wOPEOy2mEME/zQfXRlhki6ghAc29b9Iwkk51wp7pPHgFK YX4UglFenKrJ8o6CbEHzTa+SrxLRlf6DlgCoRS3D+vgxMEUT1J3tapR5YMSwLs09ws d+tDDv7OxjFjpq8YWKtH6VJ04U66HwyFtbcus7kZ0UfUiRn4BlHiBC45wBkx5qxmPs ttYAugjLNCt6Q== 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 1sETrR-000ZSS-CW; Tue, 04 Jun 2024 14:05:57 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly Subject: [PATCH 0/4] KVM: arm64: nv: Add CPTR_EL2 handling Date: Tue, 4 Jun 2024 14:05:49 +0100 Message-Id: <20240604130553.199981-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, joey.gouly@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-20240604_060603_017045_65911930 X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. 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 Building on top of Oliver's NV+SVE series[1], I've put together a small set of patches handling CPTR_EL2, as the two are pretty closely related. This series adds: - the description on the CPTR_EL2-driven traps in the exception routing tables - the merging of the L1 guest's CPTR_EL2 traps with the host's - the handling of L1's CPTR_EL2 access via the CPACR_EL1 accessor as a trap so that we can emulate writing to the TCPAC/TTA bits Overall, this is pretty straightforward (for NV, that is...). [1] https://lore.kernel.org/r/20240531231358.1000039-1-oliver.upton@linux.dev Marc Zyngier (4): KVM: arm64: nv: Add TCPAC/TTA to CPTR->CPACR conversion helper KVM: arm64: nv: Add trap description for CPTR_EL2 KVM: arm64: nv: Add additional trap setup for CPTR_EL2 KVM: arm64: nv: Handle CPACR_EL1 traps arch/arm64/include/asm/kvm_emulate.h | 2 +- arch/arm64/include/asm/kvm_nested.h | 4 +- arch/arm64/kvm/emulate-nested.c | 91 ++++++++++++++++++++++++++++ arch/arm64/kvm/hyp/vhe/switch.c | 55 ++++++++++++++++- 4 files changed, 148 insertions(+), 4 deletions(-)