[PATCH v2 0/6] KVM: arm64: EL2 synchronisation and pKVM stage-2 error propagation fixes

Fuad Tabba posted 6 patches 1 month, 1 week ago
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(-)
[PATCH v2 0/6] KVM: arm64: EL2 synchronisation and pKVM stage-2 error propagation fixes
Posted by Fuad Tabba 1 month, 1 week ago
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
Re: [PATCH v2 0/6] KVM: arm64: EL2 synchronisation and pKVM stage-2 error propagation fixes
Posted by Marc Zyngier 1 month, 1 week ago
On Fri, 01 May 2026 12:21:43 +0100, Fuad Tabba wrote:
> 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.
> 
> [...]

Applied to fixes, thanks!

[1/6] KVM: arm64: Make EL2 exception entry and exit context-synchronization events
      commit: d7396a72eae795d7f968fb451237b6ac1616d712
[2/6] KVM: arm64: Guard against NULL vcpu on VHE hyp panic path
      commit: 300fac4cc266b7782d88602b6b6a7faf31ce6405
[3/6] KVM: arm64: Fix __deactivate_fgt macro parameter typo
      commit: d4d215e5b81ba5acb17752cab12c514a8062bada
[4/6] KVM: arm64: Seed pkvm_ownership_selftest vcpu memcache
      commit: 5130d450d1488e62e1b5310f41910a3c7320e827
[5/6] KVM: arm64: Pre-check vcpu memcache for host->guest share
      commit: 8234409ffb656970e2f5b29e416f041419980bef
[6/6] KVM: arm64: Pre-check vcpu memcache for host->guest donate
      commit: effc0a39b8e0f30670fe24f51e44329d4324e566

Cheers,

	M.
-- 
Without deviation from the norm, progress is not possible.
Re: (subset) [PATCH v2 0/6] KVM: arm64: EL2 synchronisation and pKVM stage-2 error propagation fixes
Posted by Marc Zyngier 2 weeks, 3 days ago
On Fri, 01 May 2026 12:21:43 +0100, Fuad Tabba wrote:
> 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.
> 
> [...]

Applied to next, thanks!

[2/6] KVM: arm64: Guard against NULL vcpu on VHE hyp panic path
      commit: 214a821c1462924668644e167a9706564cba65ea
[3/6] KVM: arm64: Fix __deactivate_fgt macro parameter typo
      commit: 1bdcdc84f9f91e702bb4410cb46016cde1d57d9b
[4/6] KVM: arm64: Seed pkvm_ownership_selftest vcpu memcache
      commit: 3a4f5b96730cb40d5d9b31293fd34e11a10f2d6d
[5/6] KVM: arm64: Pre-check vcpu memcache for host->guest share
      commit: 8ed0fbe5404616041f6daf1d2fa1824d75602f63
[6/6] KVM: arm64: Pre-check vcpu memcache for host->guest donate
      commit: cada2549ca4c934e6fb3801f857c6b4b0c36490b

Cheers,

	M.
-- 
Without deviation from the norm, progress is not possible.