[PATCH v4 0/3] KVM: arm64: ID register finalisation fixes

Mark Brown posted 3 patches 2 days, 19 hours ago
arch/arm64/include/asm/kvm_host.h               |   8 ++
arch/arm64/kvm/arm.c                            |   2 +-
arch/arm64/kvm/sys_regs.c                       |  57 ++++++++-----
arch/arm64/kvm/sys_regs.h                       |   2 +-
arch/arm64/kvm/vgic/vgic-init.c                 |   6 +-
tools/testing/selftests/kvm/arm64/set_id_regs.c | 106 +++++++++++++++++++++++-
6 files changed, 154 insertions(+), 27 deletions(-)
[PATCH v4 0/3] KVM: arm64: ID register finalisation fixes
Posted by Mark Brown 2 days, 19 hours ago
While looking at some feature enablement I noticed that there are some
scenarios where we can end up with an inconsistently configured vCPU due
to finalizing configuration based on ID registers before we have blocked
writes to the ID registers. This series aims to clean up these issues.

Signed-off-by: Mark Brown <broonie@kernel.org>
---
Changes in v4:
- Rebase onto v7.3-rc3.
- Add a lockdep assert.
- Update Fuad's LLM tag.
- Link to v3: https://patch.msgid.link/20260901-kvm-arm64-idreg-final-v3-0-a0ffa06fa872@kernel.org

Changes in v3:
- Rebase onto v7.3-rc1.
- Explain why KVM_ARCH_FLAG_ID_REGS_INITIALIZED is not reused.
- Pull in Fuad's test cases.
- Link to v2: https://patch.msgid.link/20260803-kvm-arm64-idreg-final-v2-0-d7d7e4efc640@kernel.org

Changes in v2:
- Also replace the kvm_vm_has_ran_once() usage in kvm_set_vm_id_rg() and
  kvm_vm_finalize_sys_regs() with kvm_id_regs_final().
- Link to v1: https://patch.msgid.link/20260731-kvm-arm64-idreg-final-v1-0-3de2a5616dc6@kernel.org

---
Fuad Tabba (1):
      KVM: arm64: selftests: Check ID regs are immutable after a failed run

Mark Brown (2):
      KVM: arm64: Finalize guest-wide sysregs prior to per-vCPU sysregs
      KVM: arm64: Block ID register changes after we rely on the values

 arch/arm64/include/asm/kvm_host.h               |   8 ++
 arch/arm64/kvm/arm.c                            |   2 +-
 arch/arm64/kvm/sys_regs.c                       |  57 ++++++++-----
 arch/arm64/kvm/sys_regs.h                       |   2 +-
 arch/arm64/kvm/vgic/vgic-init.c                 |   6 +-
 tools/testing/selftests/kvm/arm64/set_id_regs.c | 106 +++++++++++++++++++++++-
 6 files changed, 154 insertions(+), 27 deletions(-)
---
base-commit: fd73f4a6659897191fa0d40695fe370925dd3780
change-id: 20260729-kvm-arm64-idreg-final-77cbc46b558a

Best regards,
--  
Mark Brown <broonie@kernel.org>
Re: [PATCH v4 0/3] KVM: arm64: ID register finalisation fixes
Posted by Marc Zyngier 1 day, 22 hours ago
On Tue, 29 Sep 2026 12:57:57 +0100, Mark Brown wrote:
> While looking at some feature enablement I noticed that there are some
> scenarios where we can end up with an inconsistently configured vCPU due
> to finalizing configuration based on ID registers before we have blocked
> writes to the ID registers. This series aims to clean up these issues.

Applied to next, thanks!

[1/3] KVM: arm64: Finalize guest-wide sysregs prior to per-vCPU sysregs
      commit: 19868b67e3e73c34493efdd5b0791ccfdc7bf192
[2/3] KVM: arm64: Block ID register changes after we rely on the values
      commit: 2ce80f62403200f0a59f898dd9cd2ccf756a5a1a
[3/3] KVM: arm64: selftests: Check ID regs are immutable after a failed run
      commit: 00e309933879cbf181a95a0bd02384715a381cff

Cheers,

	M.
-- 
Without deviation from the norm, progress is not possible.
Re: [PATCH v4 0/3] KVM: arm64: ID register finalisation fixes
Posted by Oliver Upton 2 days, 7 hours ago
Hi,

On Tue, Sep 29, 2026 at 12:57:57PM +0100, Mark Brown wrote:
> While looking at some feature enablement I noticed that there are some
> scenarios where we can end up with an inconsistently configured vCPU due
> to finalizing configuration based on ID registers before we have blocked
> writes to the ID registers. This series aims to clean up these issues.
> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
> Changes in v4:
> - Rebase onto v7.3-rc3.
> - Add a lockdep assert.
> - Update Fuad's LLM tag.
> - Link to v3: https://patch.msgid.link/20260901-kvm-arm64-idreg-final-v3-0-a0ffa06fa872@kernel.org
> 
> Changes in v3:
> - Rebase onto v7.3-rc1.
> - Explain why KVM_ARCH_FLAG_ID_REGS_INITIALIZED is not reused.
> - Pull in Fuad's test cases.
> - Link to v2: https://patch.msgid.link/20260803-kvm-arm64-idreg-final-v2-0-d7d7e4efc640@kernel.org
> 
> Changes in v2:
> - Also replace the kvm_vm_has_ran_once() usage in kvm_set_vm_id_rg() and
>   kvm_vm_finalize_sys_regs() with kvm_id_regs_final().
> - Link to v1: https://patch.msgid.link/20260731-kvm-arm64-idreg-final-v1-0-3de2a5616dc6@kernel.org
> 
> ---
> Fuad Tabba (1):
>       KVM: arm64: selftests: Check ID regs are immutable after a failed run
> 
> Mark Brown (2):
>       KVM: arm64: Finalize guest-wide sysregs prior to per-vCPU sysregs
>       KVM: arm64: Block ID register changes after we rely on the values

I'm not too terribly jazzed about testing the relative ordering of
errors in the selftest, but I see why we need to do it. Otherwise,
everything looks good.

Reviewed-by: Oliver Upton <oupton@kernel.org>

Thanks,
Oliver