diff options
author | Tianrui Zhao <zhaotianrui@loongson.cn> | 2023-12-19 05:48:28 +0300 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-12-19 05:48:28 +0300 |
commit | 118e10cd893d57df55b3302dfd188a981b6e6d1c (patch) | |
tree | 43f25b27af229cc68bdc42dc3d874a0b8e4e510f /arch/loongarch/kvm/switch.S | |
parent | db1ecca22edf27c5a3dd66af406c88b5b5ac7cc1 (diff) | |
download | linux-118e10cd893d57df55b3302dfd188a981b6e6d1c.tar.xz |
LoongArch: KVM: Add LASX (256bit SIMD) support
This patch adds LASX (256bit SIMD) support for LoongArch KVM.
There will be LASX exception in KVM when guest use the LASX instructions.
KVM will enable LASX and restore the vector registers for guest and then
return to guest to continue running.
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kvm/switch.S')
-rw-r--r-- | arch/loongarch/kvm/switch.S | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/loongarch/kvm/switch.S b/arch/loongarch/kvm/switch.S index 00fbf772d16f..ba976509bfe8 100644 --- a/arch/loongarch/kvm/switch.S +++ b/arch/loongarch/kvm/switch.S @@ -261,6 +261,21 @@ SYM_FUNC_START(kvm_restore_lsx) SYM_FUNC_END(kvm_restore_lsx) #endif +#ifdef CONFIG_CPU_HAS_LASX +SYM_FUNC_START(kvm_save_lasx) + fpu_save_csr a0 t1 + fpu_save_cc a0 t1 t2 + lasx_save_data a0 t1 + jr ra +SYM_FUNC_END(kvm_save_lasx) + +SYM_FUNC_START(kvm_restore_lasx) + lasx_restore_data a0 t1 + fpu_restore_cc a0 t1 t2 + fpu_restore_csr a0 t1 t2 + jr ra +SYM_FUNC_END(kvm_restore_lasx) +#endif .section ".rodata" SYM_DATA(kvm_exception_size, .quad kvm_exc_entry_end - kvm_exc_entry) SYM_DATA(kvm_enter_guest_size, .quad kvm_enter_guest_end - kvm_enter_guest) |