summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/fpu/api.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-10-15 04:16:12 +0300
committerBorislav Petkov <bp@suse.de>2021-10-20 16:27:27 +0300
commita0ff0611c2fbde94f6c9db8351939b08f2cb6797 (patch)
tree19c4128a92592a76fd7378ee3ef4994af866a25f /arch/x86/include/asm/fpu/api.h
parent63cf05a19a5d3fb6e66b5f7ceb76e77dfc2695f2 (diff)
downloadlinux-a0ff0611c2fbde94f6c9db8351939b08f2cb6797.tar.xz
x86/fpu: Move KVMs FPU swapping to FPU core
Swapping the host/guest FPU is directly fiddling with FPU internals which requires 5 exports. The upcoming support of dynamically enabled states would even need more. Implement a swap function in the FPU core code and export that instead. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov <bp@suse.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Cc: kvm@vger.kernel.org Link: https://lkml.kernel.org/r/20211015011539.076072399@linutronix.de
Diffstat (limited to 'arch/x86/include/asm/fpu/api.h')
-rw-r--r--arch/x86/include/asm/fpu/api.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/include/asm/fpu/api.h b/arch/x86/include/asm/fpu/api.h
index 23bef08a8388..d2b8603a9c7e 100644
--- a/arch/x86/include/asm/fpu/api.h
+++ b/arch/x86/include/asm/fpu/api.h
@@ -12,6 +12,8 @@
#define _ASM_X86_FPU_API_H
#include <linux/bottom_half.h>
+#include <asm/fpu/types.h>
+
/*
* Use kernel_fpu_begin/end() if you intend to use FPU in kernel context. It
* disables preemption so be careful if you intend to use it for long periods
@@ -108,4 +110,10 @@ extern int cpu_has_xfeatures(u64 xfeatures_mask, const char **feature_name);
static inline void update_pasid(void) { }
+/* fpstate-related functions which are exported to KVM */
+extern void fpu_init_fpstate_user(struct fpu *fpu);
+
+/* KVM specific functions */
+extern void fpu_swap_kvm_fpu(struct fpu *save, struct fpu *rstor, u64 restore_mask);
+
#endif /* _ASM_X86_FPU_API_H */