summaryrefslogtreecommitdiff
path: root/arch/loongarch/include/asm/kvm_vcpu.h
diff options
context:
space:
mode:
authorTianrui Zhao <zhaotianrui@loongson.cn>2023-12-19 05:48:28 +0300
committerHuacai Chen <chenhuacai@loongson.cn>2023-12-19 05:48:28 +0300
commitdb1ecca22edf27c5a3dd66af406c88b5b5ac7cc1 (patch)
tree41c21e4c7fe4ed5f984834f148397e10cca7ae65 /arch/loongarch/include/asm/kvm_vcpu.h
parent5b3d524993ff1fb36089be850ccb121ac3296bcf (diff)
downloadlinux-db1ecca22edf27c5a3dd66af406c88b5b5ac7cc1.tar.xz
LoongArch: KVM: Add LSX (128bit SIMD) support
This patch adds LSX (128bit SIMD) support for LoongArch KVM. There will be LSX exception in KVM when guest use the LSX instructions. KVM will enable LSX and restore the vector registers for guest and then return to guest to continue running. Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/include/asm/kvm_vcpu.h')
-rw-r--r--arch/loongarch/include/asm/kvm_vcpu.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/loongarch/include/asm/kvm_vcpu.h b/arch/loongarch/include/asm/kvm_vcpu.h
index 0e87652f780a..db08dd46b525 100644
--- a/arch/loongarch/include/asm/kvm_vcpu.h
+++ b/arch/loongarch/include/asm/kvm_vcpu.h
@@ -55,6 +55,16 @@ void kvm_save_fpu(struct loongarch_fpu *fpu);
void kvm_restore_fpu(struct loongarch_fpu *fpu);
void kvm_restore_fcsr(struct loongarch_fpu *fpu);
+#ifdef CONFIG_CPU_HAS_LSX
+int kvm_own_lsx(struct kvm_vcpu *vcpu);
+void kvm_save_lsx(struct loongarch_fpu *fpu);
+void kvm_restore_lsx(struct loongarch_fpu *fpu);
+#else
+static inline int kvm_own_lsx(struct kvm_vcpu *vcpu) { }
+static inline void kvm_save_lsx(struct loongarch_fpu *fpu) { }
+static inline void kvm_restore_lsx(struct loongarch_fpu *fpu) { }
+#endif
+
void kvm_init_timer(struct kvm_vcpu *vcpu, unsigned long hz);
void kvm_reset_timer(struct kvm_vcpu *vcpu);
void kvm_save_timer(struct kvm_vcpu *vcpu);