diff options
author | Mark Rutland <mark.rutland@arm.com> | 2025-06-17 16:37:16 +0300 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2025-06-19 15:06:20 +0300 |
commit | 186b58bacd74d9b7892869f7c7d20cf865a3c237 (patch) | |
tree | b4810c8bc8d6c5a1346427f722460ead1c07112d /drivers/scsi/mpt2sas/mpi/mpi2_raid.h | |
parent | 59e6e101a6fa542a365dd5858affd18ba3e84cb8 (diff) | |
download | linux-186b58bacd74d9b7892869f7c7d20cf865a3c237.tar.xz |
KVM: arm64: Remove ad-hoc CPTR manipulation from kvm_hyp_handle_fpsimd()
The hyp code FPSIMD/SVE/SME trap handling logic has some rather messy
open-coded manipulation of CPTR/CPACR. This is benign for non-nested
guests, but broken for nested guests, as the guest hypervisor's CPTR
configuration is not taken into account.
Consider the case where L0 provides FPSIMD+SVE to an L1 guest
hypervisor, and the L1 guest hypervisor only provides FPSIMD to an L2
guest (with L1 configuring CPTR/CPACR to trap SVE usage from L2). If the
L2 guest triggers an FPSIMD trap to the L0 hypervisor,
kvm_hyp_handle_fpsimd() will see that the vCPU supports FPSIMD+SVE, and
will configure CPTR/CPACR to NOT trap FPSIMD+SVE before returning to the
L2 guest. Consequently the L2 guest would be able to manipulate SVE
state even though the L1 hypervisor had configured CPTR/CPACR to forbid
this.
Clean this up, and fix the nested virt issue by always using
__deactivate_cptr_traps() and __activate_cptr_traps() to manage the CPTR
traps. This removes the need for the ad-hoc fixup in
kvm_hyp_save_fpsimd_host(), and ensures that any guest hypervisor
configuration of CPTR/CPACR is taken into account.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Fuad Tabba <tabba@google.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20250617133718.4014181-6-mark.rutland@arm.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpi/mpi2_raid.h')
0 files changed, 0 insertions, 0 deletions