mbox series

[v4,00/15] KVM/arm64: Add NV support for ERET and PAuth

Message ID 20240419102935.1935571-1-maz@kernel.org (mailing list archive)
Headers show
Series KVM/arm64: Add NV support for ERET and PAuth | expand

Message

Marc Zyngier April 19, 2024, 10:29 a.m. UTC
This is the fourth version of this series introducing ERET and PAuth
support for NV guests, and now the base prefix for the NV support
series.

Unless someone shouts, I intend to take this in for 6.10.

* From v3 [3]

  - Check for NV support before checking for HCR_EL2.NV on vpcu exit

  - Rebased on 6.9-rc1

* From v2 [2]

  - Enforce that both Address and Generic authentication use the same
    algorithm

  - Reduce PAuth trapping by eagerly setting the HCR_EL2.API/APK bits

  - Collected RBs, with thanks

  - Rebased on kvmarm-6.9

* From v1 [1]:

  - Don't repaint the ISS_ERET* definitions, but provide reasonable
    helpers instead

  - Dropped superfluous VNCR_EL2 definition

  - Amended comments and creative spelling

[1] https://lore.kernel.org/r/20240219092014.783809-1-maz@kernel.org
[2] https://lore.kernel.org/r/20240226100601.2379693-1-maz@kernel.org
[3] https://lore.kernel.org/r/20240321155356.3236459-1-maz@kernel.org

Marc Zyngier (15):
  KVM: arm64: Harden __ctxt_sys_reg() against out-of-range values
  KVM: arm64: Add helpers for ESR_ELx_ERET_ISS_ERET*
  KVM: arm64: Constraint PAuth support to consistent implementations
  KVM: arm64: nv: Drop VCPU_HYP_CONTEXT flag
  KVM: arm64: nv: Configure HCR_EL2 for FEAT_NV2
  KVM: arm64: nv: Add trap forwarding for ERET and SMC
  KVM: arm64: nv: Fast-track 'InHost' exception returns
  KVM: arm64: nv: Honor HFGITR_EL2.ERET being set
  KVM: arm64: nv: Handle HCR_EL2.{API,APK} independently
  KVM: arm64: nv: Reinject PAC exceptions caused by HCR_EL2.API==0
  KVM: arm64: nv: Add kvm_has_pauth() helper
  KVM: arm64: nv: Add emulation for ERETAx instructions
  KVM: arm64: nv: Handle ERETA[AB] instructions
  KVM: arm64: nv: Advertise support for PAuth
  KVM: arm64: Drop trapping of PAuth instructions/keys

 arch/arm64/include/asm/esr.h            |  12 ++
 arch/arm64/include/asm/kvm_emulate.h    |  10 --
 arch/arm64/include/asm/kvm_host.h       |  26 +++-
 arch/arm64/include/asm/kvm_nested.h     |  13 ++
 arch/arm64/include/asm/kvm_ptrauth.h    |  21 +++
 arch/arm64/include/asm/pgtable-hwdef.h  |   1 +
 arch/arm64/kvm/Makefile                 |   1 +
 arch/arm64/kvm/arm.c                    |  83 +++++++++-
 arch/arm64/kvm/emulate-nested.c         |  66 +++++---
 arch/arm64/kvm/handle_exit.c            |  36 ++++-
 arch/arm64/kvm/hyp/include/hyp/switch.h |  62 +-------
 arch/arm64/kvm/hyp/nvhe/switch.c        |   4 +-
 arch/arm64/kvm/hyp/vhe/switch.c         |  96 +++++++++++-
 arch/arm64/kvm/nested.c                 |   8 +-
 arch/arm64/kvm/pauth.c                  | 196 ++++++++++++++++++++++++
 15 files changed, 514 insertions(+), 121 deletions(-)
 create mode 100644 arch/arm64/kvm/pauth.c

Comments

Oliver Upton April 19, 2024, 5:59 p.m. UTC | #1
On Fri, Apr 19, 2024 at 11:29:20AM +0100, Marc Zyngier wrote:
> This is the fourth version of this series introducing ERET and PAuth
> support for NV guests, and now the base prefix for the NV support
> series.
> 
> Unless someone shouts, I intend to take this in for 6.10.

Meant to do this for the last spin, sorry:

Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Marc Zyngier April 20, 2024, 11:49 a.m. UTC | #2
On Fri, 19 Apr 2024 18:59:59 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
> 
> On Fri, Apr 19, 2024 at 11:29:20AM +0100, Marc Zyngier wrote:
> > This is the fourth version of this series introducing ERET and PAuth
> > support for NV guests, and now the base prefix for the NV support
> > series.
> > 
> > Unless someone shouts, I intend to take this in for 6.10.
> 
> Meant to do this for the last spin, sorry:
> 
> Reviewed-by: Oliver Upton <oliver.upton@linux.dev>

Thanks! I'll queue the series shortly so that it can simmer in -next
for a bit. Potential fixes can go on top if required.

	M.
Marc Zyngier April 20, 2024, 12:18 p.m. UTC | #3
On Fri, 19 Apr 2024 11:29:20 +0100, Marc Zyngier wrote:
> This is the fourth version of this series introducing ERET and PAuth
> support for NV guests, and now the base prefix for the NV support
> series.
> 
> Unless someone shouts, I intend to take this in for 6.10.
> 
> * From v3 [3]
> 
> [...]

Applied to next, thanks!

[01/15] KVM: arm64: Harden __ctxt_sys_reg() against out-of-range values
        commit: 1b06b99f25e0c957feb488ff8117a37f592c3866
[02/15] KVM: arm64: Add helpers for ESR_ELx_ERET_ISS_ERET*
        commit: 80d8b55a57a18b0b1dac951ea28bfd657b14facc
[03/15] KVM: arm64: Constraint PAuth support to consistent implementations
        commit: a07e9345615fb7e7dd4fd5d88d5aaf49085739d0
[04/15] KVM: arm64: nv: Drop VCPU_HYP_CONTEXT flag
        commit: 6f57c6be2a0889cc0fd32b0cd2eb25dfee20dde3
[05/15] KVM: arm64: nv: Configure HCR_EL2 for FEAT_NV2
        commit: 04ab519bb86df10bb8b72054fce9af1d72c36805
[06/15] KVM: arm64: nv: Add trap forwarding for ERET and SMC
        commit: 95537f06b9e826766f32e513d714e1cda468ef15
[07/15] KVM: arm64: nv: Fast-track 'InHost' exception returns
        commit: dd0717a998f77f449c70bee82626cbf9913fe78d
[08/15] KVM: arm64: nv: Honor HFGITR_EL2.ERET being set
        commit: 4cc3f31914d6df9dba8825db933d19c60028f5a8
[09/15] KVM: arm64: nv: Handle HCR_EL2.{API,APK} independently
        commit: 279946ada1f26a905061d0d6f134fff9e7b14239
[10/15] KVM: arm64: nv: Reinject PAC exceptions caused by HCR_EL2.API==0
        commit: 15db034733e4df3ca8ab4bf0a593a8a9b4860541
[11/15] KVM: arm64: nv: Add kvm_has_pauth() helper
        commit: 719f5206a8fd8336d23ccda6fe2a3287fbfb4c92
[12/15] KVM: arm64: nv: Add emulation for ERETAx instructions
        commit: 6ccc971ee2c61a1ffb487e46bf6184f7df6aacfb
[13/15] KVM: arm64: nv: Handle ERETA[AB] instructions
        commit: 213b3d1ea1612c6d26153be446923831c4534689
[14/15] KVM: arm64: nv: Advertise support for PAuth
        commit: f4f6a95bac49144c0d507c24af9905bb999a4579
[15/15] KVM: arm64: Drop trapping of PAuth instructions/keys
        commit: 814ad8f96e929fa9c60bd360d2f7bccfc1df0111

Cheers,

	M.