diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2022-01-05 04:35:17 -0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-01-14 13:43:11 -0500 |
commit | c270ce393dfd700e7510a4579568deeefba954fd (patch) | |
tree | f7a95048f51a0a8f2e2aee7541e37d2eced7ecd0 /arch/x86/kernel/fpu/xstate.h | |
parent | b0237dad2d7f8820b5b415291431d8259e787470 (diff) |
x86/fpu: Add guest support to xfd_enable_feature()
Guest support for dynamically enabled FPU features requires a few
modifications to the enablement function which is currently invoked from
the #NM handler:
1) Use guest permissions and sizes for the update
2) Update fpu_guest state accordingly
3) Take into account that the enabling can be triggered either from a
running guest via XSETBV and MSR_IA32_XFD write emulation or from
a guest restore. In the latter case the guests fpstate is not the
current tasks active fpstate.
Split the function and implement the guest mechanics throughout the
callchain.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jing Liu <jing2.liu@intel.com>
Signed-off-by: Yang Zhong <yang.zhong@intel.com>
Message-Id: <20220105123532.12586-7-yang.zhong@intel.com>
[Add 32-bit stub for __xfd_enable_feature. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kernel/fpu/xstate.h')
-rw-r--r-- | arch/x86/kernel/fpu/xstate.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h index 98a472775c97..67ed6bbc19b8 100644 --- a/arch/x86/kernel/fpu/xstate.h +++ b/arch/x86/kernel/fpu/xstate.h @@ -158,8 +158,14 @@ static inline void xfd_update_state(struct fpstate *fpstate) } } } + +extern int __xfd_enable_feature(u64 which, struct fpu_guest *guest_fpu); #else static inline void xfd_update_state(struct fpstate *fpstate) { } + +static inline int __xfd_enable_feature(u64 which, struct fpu_guest *guest_fpu) { + return -EPERM; +} #endif /* |