Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arm64/sve: KVM: Treat guest SVE use as undefined instruction execution

When trapping forbidden attempts by a guest to use SVE, we want the
guest to see a trap consistent with SVE not being implemented.

This patch injects an undefined instruction exception into the
guest in response to such an exception.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>

authored by

Dave Martin and committed by
Will Deacon
aac45ffd 17eed27b

+8
+8
arch/arm64/kvm/handle_exit.c
··· 147 147 return 1; 148 148 } 149 149 150 + static int handle_sve(struct kvm_vcpu *vcpu, struct kvm_run *run) 151 + { 152 + /* Until SVE is supported for guests: */ 153 + kvm_inject_undefined(vcpu); 154 + return 1; 155 + } 156 + 150 157 static exit_handle_fn arm_exit_handlers[] = { 151 158 [0 ... ESR_ELx_EC_MAX] = kvm_handle_unknown_ec, 152 159 [ESR_ELx_EC_WFx] = kvm_handle_wfx, ··· 167 160 [ESR_ELx_EC_HVC64] = handle_hvc, 168 161 [ESR_ELx_EC_SMC64] = handle_smc, 169 162 [ESR_ELx_EC_SYS64] = kvm_handle_sys_reg, 163 + [ESR_ELx_EC_SVE] = handle_sve, 170 164 [ESR_ELx_EC_IABT_LOW] = kvm_handle_guest_abort, 171 165 [ESR_ELx_EC_DABT_LOW] = kvm_handle_guest_abort, 172 166 [ESR_ELx_EC_SOFTSTP_LOW]= kvm_handle_guest_debug,