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 53201C53200 for ; Wed, 29 Jul 2026 13:18: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: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:In-Reply-To:References:List-Owner; bh=IqZNdFsmpnlABfXIHHin3yUUsuo0WpmK5RY/s6b0fU8=; b=oAoidsTSepz423wXcwcb1Eytfg FZ8DUIin2O6FkIHgvLrkJVv2eUBmI87LEOAE1kSfK2e/dTxB+jR2n3pCcxqUEzpnKIq7tIUgELg0/ w6kDG9u67EqhBmATw2WYBvgHMZRNLFaj2G9ShROvf11vaNHfiWELuwwB1dt60CA6+t5wjFunR9tFl 6bIlW0I7jnSK7fWqphZZHpkRSwoygD0l8AqQ/dxXahhYr0j+dOn5fjmbC3gKpPtIkuZjw9SPGVnez Osif+jyb68LSRVdkBV2vGweblPmmoiXH2lrrqvg0ccVMAwGIbGuhneElCwYaH08hcCLhamy4SRyf3 kvB+Mkww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wp4B8-0000000843c-3zmJ; Wed, 29 Jul 2026 13:18:34 +0000 Received: from out-185.mta0.migadu.com ([91.218.175.185]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wp4B5-0000000841j-20Pj for linux-arm-kernel@lists.infradead.org; Wed, 29 Jul 2026 13:18:33 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785331107; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=IqZNdFsmpnlABfXIHHin3yUUsuo0WpmK5RY/s6b0fU8=; b=LJPW5x5kUlPeMas8a0CtmleK5E6NlhCZj7I65KCVFvQ+okjPc0L3oMo7u8jmlocm7HVWbn /wT3IMAqRUValDLi27teen3XR4xzfP+BNIdIJzRvf+2Kuda+gPLfwqzQKR7EBGtbL1RC/R vyNYHf3AFNVQseCvf3jK0UHNFJ9B2Mc= From: Fuad Tabba To: Marc Zyngier , Oliver Upton , kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Joey Gouly , Steffen Eiden , Suzuki K Poulose , Zenghui Yu , Vincent Donnefort , Quentin Perret , Sebastian Ene , Hyunwoo Kim , Fuad Tabba Subject: [PATCH v7 0/8] KVM: arm64: pKVM vCPU state management at EL2 Date: Wed, 29 Jul 2026 14:18:15 +0100 Message-Id: <20260729131823.2021516-1-fuad.tabba@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260729_061831_782395_C5C26A80 X-CRM114-Status: GOOD ( 10.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi folks, Changes since v6 [1]: - Rebased onto v7.2-rc5. - Expanded the comment and commit message in patch 8 explaining why PC and PSTATE are copied back on every exit. No functional change. - Collected Steffen's Reviewed-by on patch 3 (thanks!). Building on Will's pKVM infrastructure series [2], this series reworks how pKVM moves vCPU state between the host and EL2, and stops copying a non-protected guest's state on every world switch. EL2 gains proper primitives for the state it transfers: vCPU lookup helpers, and VGIC flush/sync that reduces how much host state EL2 dereferences. The series also moves some preparatory code (such as sys reg access and PSCI helpers) to shared headers and HYP, and implements lazy copying of a non-protected guest's register state back to the host until the host actually needs it, instead of on every exit. This is the first of two series moving pKVM vCPU state management to EL2. The follow-up completes the job for protected VMs: state isolation, PSCI handling at EL2, and the resulting API behaviour. The series is structured as follows: 01-04: Preparatory refactoring (MPIDR, sys reg access, vCPU reset, PSCI helpers) to shared headers and HYP. 05: Host and hypervisor vCPU lookup primitives. 06-07: VGIC: reduce EL2's exposure to host state, add flush/sync primitives. 08: Lazy state sync for non-protected guests. Based on v7.2-rc5 (f5098b6bae761). Cheers, /fuad [1] https://lore.kernel.org/all/20260715081238.1891918-1-fuad.tabba@linux.dev/ [2] https://lore.kernel.org/all/20260105154939.11041-1-will@kernel.org/ Fuad Tabba (5): KVM: arm64: Extract MPIDR computation into a shared header KVM: arm64: Make vcpu_{read,write}_sys_reg available to HYP code KVM: arm64: Factor out reusable vCPU reset helpers KVM: arm64: Move PSCI helper functions to a shared header KVM: arm64: Implement lazy vCPU state sync for non-protected guests Marc Zyngier (3): KVM: arm64: Add host and hypervisor vCPU lookup primitives KVM: arm64: Minimise EL2's exposure of host VGIC state during world switch KVM: arm64: Add primitives to flush/sync the VGIC state at EL2 arch/arm64/include/asm/kvm_arm.h | 12 ++ arch/arm64/include/asm/kvm_asm.h | 1 + arch/arm64/include/asm/kvm_emulate.h | 63 +++++++ arch/arm64/include/asm/kvm_host.h | 2 + arch/arm64/kvm/arm.c | 7 + arch/arm64/kvm/handle_exit.c | 23 +++ arch/arm64/kvm/hyp/exception.c | 34 +--- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 261 +++++++++++++++++++++++---- arch/arm64/kvm/psci.c | 30 +-- arch/arm64/kvm/reset.c | 60 +----- arch/arm64/kvm/sys_regs.c | 14 +- arch/arm64/kvm/sys_regs.h | 19 ++ include/kvm/arm_psci.h | 27 +++ 13 files changed, 393 insertions(+), 160 deletions(-) base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff -- 2.39.5