mbox series

[v4,0/8] KVM: arm64: Add support for FP8

Message ID 20240820131802.3547589-1-maz@kernel.org (mailing list archive)
Headers show
Series KVM: arm64: Add support for FP8 | expand

Message

Marc Zyngier Aug. 20, 2024, 1:17 p.m. UTC
Although FP8 support was merged in 6.9, the KVM side was dropped, with
no sign of it being picked up again. Given that its absence is getting
in the way of NV upstreaming (HCRX_EL2 needs fleshing out), here's a
small series addressing it.

The support is following the save/restore model established for the
rest of the FP code, with FPMR being tied to it. The sole additions
are the handling of traps in a nested context, and the corresponding
ID registers being made writable. As an extra cleanup, SVCR and FPMR
are moved into the sysreg array.

Patches are on top of v6.11-rc1. Note that this is compile-tested
only, as I have no access to FP8 HW or model (and running NV in a
model is not something I wish to entertain ever again).

* From v3 [3]

  - Simplify handling of SYS_ID_AA64PFR2_EL1

* From v2 [2]

  - Add missing kern_hyp_va() when dereferencing vcpu->kvm on nVHE
    setups

* From v1 [1]

  - Correctly save/restore the guest state (duh), including pKVM
    (double duh)

  - Add a predicate for FPMR support in a VM, as this gets used more
    than twice...

[1] https://lore.kernel.org/r/20240708154438.1218186-1-maz@kernel.org
[2] https://lore.kernel.org/r/20240708154438.1218186-1-maz@kernel.org
[3] https://lore.kernel.org/r/20240813104400.1956132-1-maz@kernel.org

Marc Zyngier (8):
  KVM: arm64: Move SVCR into the sysreg array
  KVM: arm64: Add predicate for FPMR support in a VM
  KVM: arm64: Move FPMR into the sysreg array
  KVM: arm64: Add save/restore support for FPMR
  KVM: arm64: Honor trap routing for FPMR
  KVM: arm64: Expose ID_AA64FPFR0_EL1 as a writable ID reg
  KVM: arm64: Enable FP8 support when available and configured
  KVM: arm64: Expose ID_AA64PFR2_EL1 to userspace and guests

 arch/arm64/include/asm/kvm_host.h       | 20 ++++++++++++++--
 arch/arm64/kvm/emulate-nested.c         |  8 +++++++
 arch/arm64/kvm/fpsimd.c                 |  5 ++--
 arch/arm64/kvm/hyp/include/hyp/switch.h |  3 +++
 arch/arm64/kvm/hyp/nvhe/hyp-main.c      |  9 +++++++
 arch/arm64/kvm/hyp/nvhe/switch.c        |  9 +++++++
 arch/arm64/kvm/hyp/vhe/switch.c         |  3 +++
 arch/arm64/kvm/sys_regs.c               | 32 ++++++++++++++++++++++---
 8 files changed, 82 insertions(+), 7 deletions(-)

Comments

Mark Brown Aug. 21, 2024, 2:34 p.m. UTC | #1
On Tue, Aug 20, 2024 at 02:17:54PM +0100, Marc Zyngier wrote:
> Although FP8 support was merged in 6.9, the KVM side was dropped, with
> no sign of it being picked up again. Given that its absence is getting
> in the way of NV upstreaming (HCRX_EL2 needs fleshing out), here's a
> small series addressing it.

The code looks good to me and I didn't spot any problems in testing so:

Reviewed-by: Mark Brown <broonie@kernel.org>
Tested-by: Mark Brown <broonie@kernel.org>
Marc Zyngier Aug. 27, 2024, 7:07 a.m. UTC | #2
On Tue, 20 Aug 2024 14:17:54 +0100, Marc Zyngier wrote:
> Although FP8 support was merged in 6.9, the KVM side was dropped, with
> no sign of it being picked up again. Given that its absence is getting
> in the way of NV upstreaming (HCRX_EL2 needs fleshing out), here's a
> small series addressing it.
> 
> The support is following the save/restore model established for the
> rest of the FP code, with FPMR being tied to it. The sole additions
> are the handling of traps in a nested context, and the corresponding
> ID registers being made writable. As an extra cleanup, SVCR and FPMR
> are moved into the sysreg array.
> 
> [...]

Applied to next, thanks!

[1/8] KVM: arm64: Move SVCR into the sysreg array
      commit: b55688943597df06f202c67341da5b9b0ec54e93
[2/8] KVM: arm64: Add predicate for FPMR support in a VM
      commit: d4db98791aa5316677a1da9bfa0788068c9863dc
[3/8] KVM: arm64: Move FPMR into the sysreg array
      commit: 7d9c1ed6f4bfa8d5fcafad847ac64e2839a04301
[4/8] KVM: arm64: Add save/restore support for FPMR
      commit: ef3be86021c3bdf384c36d9d4aa1ee9fe65b95af
[5/8] KVM: arm64: Honor trap routing for FPMR
      commit: b8f669b491ec4693d07126b20db0fbe747556d11
[6/8] KVM: arm64: Expose ID_AA64FPFR0_EL1 as a writable ID reg
      commit: 6d7307651a8a021e7286e90264676b893cb6032d
[7/8] KVM: arm64: Enable FP8 support when available and configured
      commit: c9150a8ad9cdb69584d4ec5af61481df41498eb8
[8/8] KVM: arm64: Expose ID_AA64PFR2_EL1 to userspace and guests
      commit: 13c7a51eeb747ec315485ac7b13d4ea03707f53e

Cheers,

	M.