KVM: arm64: Synchronize SMEN on vcpu schedule out
authorNianyao Tang <tangnianyao@huawei.com>
Tue, 20 Dec 2022 10:50:24 +0000 (18:50 +0800)
committerOliver Upton <oliver.upton@linux.dev>
Thu, 12 Jan 2023 21:15:16 +0000 (21:15 +0000)
commit59d78a2ec0e9cfba5935f3a0d3f14a771461cded
tree1a716454c69cfd36b94d8a957f6435498fd12cd4
parent7a5e9c8f0b2d18fa5e7f2b8e4ef68464fa3bc83e
KVM: arm64: Synchronize SMEN on vcpu schedule out

If we have VHE and need to reenable SME for host in
kvm_arch_vcpu_put_fp, CPACR.SMEN is modified from 0 to 1. Trap
control for reading SVCR is modified from enable to disable.
Synchronization is needed before reading SVCR later in
fpsimd_save, or it may cause sync exception which can not be
handled by host.

Cc: Marc Zyngier <maz@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Nianyao Tang <tangnianyao@huawei.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20221220105024.13484-1-dongbo4@huawei.com
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/fpsimd.c