Fix instrumentation bugs objtool found: vmlinux.o: warning: objtool: intel_idle_s2idle+0xd5: call to fpu_idle_fpregs() leaves .noinstr.text section vmlinux.o: warning: objtool: intel_idle_xstate+0x11: call to fpu_idle_fpregs() leaves .noinstr.text section vmlinux.o: warning: objtool: fpu_idle_fpregs+0x9: call to xfeatures_in_use() leaves .noinstr.text section Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Tested-by: Tony Lindgren <tony@atomide.com> Tested-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lore.kernel.org/r/20230112195540.494977795@infradead.org
35 lines
811 B
C
35 lines
811 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_FPU_XCR_H
|
|
#define _ASM_X86_FPU_XCR_H
|
|
|
|
#define XCR_XFEATURE_ENABLED_MASK 0x00000000
|
|
#define XCR_XFEATURE_IN_USE_MASK 0x00000001
|
|
|
|
static __always_inline u64 xgetbv(u32 index)
|
|
{
|
|
u32 eax, edx;
|
|
|
|
asm volatile("xgetbv" : "=a" (eax), "=d" (edx) : "c" (index));
|
|
return eax + ((u64)edx << 32);
|
|
}
|
|
|
|
static inline void xsetbv(u32 index, u64 value)
|
|
{
|
|
u32 eax = value;
|
|
u32 edx = value >> 32;
|
|
|
|
asm volatile("xsetbv" :: "a" (eax), "d" (edx), "c" (index));
|
|
}
|
|
|
|
/*
|
|
* Return a mask of xfeatures which are currently being tracked
|
|
* by the processor as being in the initial configuration.
|
|
*
|
|
* Callers should check X86_FEATURE_XGETBV1.
|
|
*/
|
|
static __always_inline u64 xfeatures_in_use(void)
|
|
{
|
|
return xgetbv(XCR_XFEATURE_IN_USE_MASK);
|
|
}
|
|
|
|
#endif /* _ASM_X86_FPU_XCR_H */
|