1. 03 May, 2024 3 commits
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/nv-eret-pauth into kvmarm-master/next · 2d38f439
      Marc Zyngier authored
      * kvm-arm64/nv-eret-pauth:
        : .
        : Add NV support for the ERETAA/ERETAB instructions. From the cover letter:
        :
        : "Although the current upstream NV support has *some* support for
        : correctly emulating ERET, that support is only partial as it doesn't
        : support the ERETAA and ERETAB variants.
        :
        : Supporting these instructions was cast aside for a long time as it
        : involves implementing some form of PAuth emulation, something I wasn't
        : overly keen on. But I have reached a point where enough of the
        : infrastructure is there that it actually makes sense. So here it is!"
        : .
        KVM: arm64: nv: Work around lack of pauth support in old toolchains
        KVM: arm64: Drop trapping of PAuth instructions/keys
        KVM: arm64: nv: Advertise support for PAuth
        KVM: arm64: nv: Handle ERETA[AB] instructions
        KVM: arm64: nv: Add emulation for ERETAx instructions
        KVM: arm64: nv: Add kvm_has_pauth() helper
        KVM: arm64: nv: Reinject PAC exceptions caused by HCR_EL2.API==0
        KVM: arm64: nv: Handle HCR_EL2.{API,APK} independently
        KVM: arm64: nv: Honor HFGITR_EL2.ERET being set
        KVM: arm64: nv: Fast-track 'InHost' exception returns
        KVM: arm64: nv: Add trap forwarding for ERET and SMC
        KVM: arm64: nv: Configure HCR_EL2 for FEAT_NV2
        KVM: arm64: nv: Drop VCPU_HYP_CONTEXT flag
        KVM: arm64: Constraint PAuth support to consistent implementations
        KVM: arm64: Add helpers for ESR_ELx_ERET_ISS_ERET*
        KVM: arm64: Harden __ctxt_sys_reg() against out-of-range values
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      2d38f439
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/host_data into kvmarm-master/next · 34c0d5a6
      Marc Zyngier authored
      * kvm-arm64/host_data:
        : .
        : Rationalise the host-specific data to live as part of the per-CPU state.
        :
        : From the cover letter:
        :
        : "It appears that over the years, we have accumulated a lot of cruft in
        : the kvm_vcpu_arch structure. Part of the gunk is data that is strictly
        : host CPU specific, and this result in two main problems:
        :
        : - the structure itself is stupidly large, over 8kB. With the
        :   arch-agnostic kvm_vcpu, we're above 10kB, which is insane. This has
        :   some ripple effects, as we need physically contiguous allocation to
        :   be able to map it at EL2 for !VHE. There is more to it though, as
        :   some data structures, although per-vcpu, could be allocated
        :   separately.
        :
        : - We lose track of the life-cycle of this data, because we're
        :   guaranteed that it will be around forever and we start relying on
        :   wrong assumptions. This is becoming a maintenance burden.
        :
        : This series rectifies some of these things, starting with the two main
        : offenders: debug and FP, a lot of which gets pushed out to the per-CPU
        : host structure. Indeed, their lifetime really isn't that of the vcpu,
        : but tied to the physical CPU the vpcu runs on.
        :
        : This results in a small reduction of the vcpu size, but mainly a much
        : clearer understanding of the life-cycle of these structures."
        : .
        KVM: arm64: Move management of __hyp_running_vcpu to load/put on VHE
        KVM: arm64: Exclude FP ownership from kvm_vcpu_arch
        KVM: arm64: Exclude host_fpsimd_state pointer from kvm_vcpu_arch
        KVM: arm64: Exclude mdcr_el2_host from kvm_vcpu_arch
        KVM: arm64: Exclude host_debug_data from vcpu_arch
        KVM: arm64: Add accessor for per-CPU state
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      34c0d5a6
    • Marc Zyngier's avatar
      KVM: arm64: Move management of __hyp_running_vcpu to load/put on VHE · 9a393599
      Marc Zyngier authored
      The per-CPU host context structure contains a __hyp_running_vcpu that
      serves as a replacement for kvm_get_current_vcpu() in contexts where
      we cannot make direct use of it (such as in the nVHE hypervisor).
      Since there is a lot of common code between nVHE and VHE, the latter
      also populates this field even if kvm_get_running_vcpu() always works.
      
      We currently pretty inconsistent when populating __hyp_running_vcpu
      to point to the currently running vcpu:
      
      - on {n,h}VHE, we set __hyp_running_vcpu on entry to __kvm_vcpu_run
        and clear it on exit.
      
      - on VHE, we set __hyp_running_vcpu on entry to __kvm_vcpu_run_vhe
        and never clear it, effectively leaving a dangling pointer...
      
      VHE is obviously the odd one here. Although we could make it behave
      just like nVHE, this wouldn't match the behaviour of KVM with VHE,
      where the load phase is where most of the context-switch gets done.
      
      So move all the __hyp_running_vcpu management to the VHE-specific
      load/put phases, giving us a bit more sanity and matching the
      behaviour of kvm_get_running_vcpu().
      Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
      Link: https://lore.kernel.org/r/20240502154030.3011995-1-maz@kernel.orgSigned-off-by: default avatarMarc Zyngier <maz@kernel.org>
      9a393599
  2. 23 Apr, 2024 1 commit
  3. 20 Apr, 2024 15 commits
  4. 12 Apr, 2024 5 commits
  5. 07 Apr, 2024 4 commits
  6. 06 Apr, 2024 12 commits