From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5227F39E19A for ; Fri, 1 May 2026 11:21:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777634514; cv=none; b=onrlcMNrD4nFjKtos7SMLOjdTxIOeksr88V1U3Iynl2qNk18KRtyI7OZirLyLhOf2pvyddMbhEas0fvGsFtIh9C6USgOz0Qk+xV9on+FTr9p3Pe4w6orZkLBPmWmBH71d2/oF0YOxeyglwMT3AAY2+6iCBEqJlIRQKvaE7GtizE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777634514; c=relaxed/simple; bh=qUux5fWnaB7vwSuaIK7yJ/xoTOk1kHLhaO5Fj32opLY=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=T1/S8YWRlHPF5MSierIWSH1xZPfh45DNnF0ntDWkgwWAtCe8ATfwt106pst/Pdro0JkiXS0c8ql/vkoRWHq9LScTcx//tZX10qKCSHm+JQhlHaHdg3m9Kr4HFN1qVl5KjFIi74et9r/9RGf6jfVnMYVmHEBxX8T2x/TwWlBdrI0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--tabba.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=bCKyhwHX; arc=none smtp.client-ip=209.85.221.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--tabba.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bCKyhwHX" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-4411a36715dso1164001f8f.2 for ; Fri, 01 May 2026 04:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777634511; x=1778239311; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=OsvmNiIFOjSLSp4rcDSw+qNHN7ZNglz3VqzWWNlV7vU=; b=bCKyhwHXoa2an2ZvtTZAWgZAckjcVwu/L0Pdj8xcKdZXzyndJz6qFK19tNwHY/VKKN GlihEssAAdZGopoW446Jx8DGi6wMSYAsH5XYjmLZyL7sBeJDqAcLAkfoqZdzsHEHaXqt xaqjz4rq2+nbfe4zUnLLY4q8xLVJgRX+pi7gTSRAbriIjHeE5v/otY2AYdT6+DW1yl1d aJuBaG7gbx2VO/MkHr/8+J7IHM+6TxJx8HXN6h+bvZu31Vox5UNgLpfLKJ3e+i413Cfo 4AaNctjRnYjzA1eohtiG6DvrRF/aQMscuJEjVLmDvFVQkx6nQPUN+S1VTVdIdoouuc3T AIew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777634511; x=1778239311; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OsvmNiIFOjSLSp4rcDSw+qNHN7ZNglz3VqzWWNlV7vU=; b=ECalcIqey8GKMipxhdTWC01s7Op3bwLS7sSMzOwE19uSoRUE5qnVPkfiwa8HGu4Oiv 3dKA6FWftujC8Z0vENkoIvuRqm+j9Aozxnp/ybK9zjJMY71IAW+j9nZ8N+vBnKtDRFlf 4EbVO3dDeEVG/xlrRpq2Pv1WWtPcWA5MJiPASmW5JpM+b/nOlBOj2pT+xdEIv8VJBtCz 6FBA8lK8oe7dnUPUJ2jSktTfjZbgcioDA+jR3yfJEu+WgbAFhW6zDtCRDRBR/MTRcB5H hIYqcbQE2ySWPPMLekQERtLVfOJ+/8m+uxoitw/ZWKztD/ym5NdJxZRStwEBsfHZEXcM K2dA== X-Forwarded-Encrypted: i=1; AFNElJ9UTRbjjprcstD2wPpJIpsBrZJzu+ytz0Y8x1eY4q9a0wgO/gmbbsfAjTTxzuME7ifF44v4BX+/yLs/x4E=@vger.kernel.org X-Gm-Message-State: AOJu0YxRrTbUU8nKUeE1JQyckTFxmbunjYaCrxgoWishMZ4sdDLNbbtl XIkNjL84QBJQjgKGBc58F+9Pn/HYnSWN0pGBBFuEphqP0Aqhg2UxZ6A6O7+NrnpRf37CxbXwlvk Y+w== X-Received: from wrbgg9.prod.google.com ([2002:a05:6000:2f89:b0:449:ba46:e362]) (user=tabba job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:2f8a:b0:441:1cf9:4f06 with SMTP id ffacd0b85a97d-4493fed64c0mr11269061f8f.31.1777634510466; Fri, 01 May 2026 04:21:50 -0700 (PDT) Date: Fri, 1 May 2026 12:21:43 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.54.0.545.g6539524ca2-goog Message-ID: <20260501112149.2824881-1-tabba@google.com> Subject: [PATCH v2 0/6] KVM: arm64: EL2 synchronisation and pKVM stage-2 error propagation fixes From: Fuad Tabba To: maz@kernel.org, oliver.upton@linux.dev Cc: james.morse@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, qperret@google.com, vdonnefort@google.com, tabba@google.com, catalin.marinas@arm.com, will@kernel.org, yaoyuan@linux.alibaba.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Hi folks, V2 of the kvm/arm64 audit fixes [1]. Changes since v1: Patch 1 (SCTLR_EL2.EIS|EOS): Fixes: tag corrected to 0a35bd285f43 ("arm64: Convert SCTLR_EL2 to sysreg infrastructure"); the commit message now explains that the conversion auto-generated SCTLR_EL2_RES1 to UL(0). Code unchanged. Patches 2-3 (NULL vcpu guard, __deactivate_fgt typo): unchanged. Patch 4 (new): Seed selftest_vcpu's memcache to mirror hyp-main.c's pkvm_refill_memcache() flow; required by the pre-check in patches 5-6. Patches 5-6 (host->guest share/donate, formerly v1 patches 5-6): reworked to pre-check the vcpu memcache against kvm_mmu_cache_min_pages() during the existing pre-check pass, before any state mutation. The WARN_ON() around kvm_pgtable_stage2_map() then asserts an invariant the pre-check pass establishes, rather than swallowing a reachable -ENOMEM. Dropped since v1: - Patch 2 (HCR_EL2 sync): failure path not reachable. - Patches 7-8 (guest->host share/unshare): the stage-2 map cannot fail at those call sites (the leaf already exists). Carried `Reviewed-by` tag (thanks!) and added `Assisted-by:` tags. Note that with `review-prompts` in the `Assisted-by:` tags, I am referring to subsystem guides that I added to the base prompts [2], which I plan submit for upstreaming. Cheers, /fuad [1] https://lore.kernel.org/all/20260428103008.696141-1-tabba@google.com/ [2] https://github.com/masoncl/review-prompts Fuad Tabba (6): KVM: arm64: Make EL2 exception entry and exit context-synchronization events KVM: arm64: Guard against NULL vcpu on VHE hyp panic path KVM: arm64: Fix __deactivate_fgt macro parameter typo KVM: arm64: Seed pkvm_ownership_selftest vcpu memcache KVM: arm64: Pre-check vcpu memcache for host->guest share KVM: arm64: Pre-check vcpu memcache for host->guest donate arch/arm64/include/asm/sysreg.h | 2 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 2 +- arch/arm64/kvm/hyp/nvhe/mem_protect.c | 24 ++++++++++++++++++++++++ arch/arm64/kvm/hyp/nvhe/pkvm.c | 16 +++++++++++++++- arch/arm64/kvm/hyp/vhe/switch.c | 3 ++- 5 files changed, 43 insertions(+), 4 deletions(-) -- 2.54.0.545.g6539524ca2-goog