Prev: [PATCH 07/10] x86, xsave: reduce cpu_has_xsave checks
Next: [PATCH 06/10] x86, xsave: do not initialize xsave in fpu_init()
From: Robert Richter on 20 Jul 2010 15:10 There is a lot of cross referencing between fpu and xsave code. This patch reduces this by making xsave_cntxt_init() a static function. Signed-off-by: Robert Richter <robert.richter(a)amd.com> --- arch/x86/include/asm/xsave.h | 1 - arch/x86/kernel/i387.c | 5 ++--- arch/x86/kernel/xsave.c | 9 +++++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index 94d5f84..4d3b5d1 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h @@ -28,7 +28,6 @@ extern u64 pcntxt_mask; extern struct xsave_struct *init_xstate_buf; extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS]; -extern void xsave_cntxt_init(void); extern void xsave_init(void); extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask); extern int init_fpu(struct task_struct *child); diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 2f32ef0..196b8c7 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c @@ -66,10 +66,9 @@ void __cpuinit init_thread_xstate(void) return; } - if (cpu_has_xsave) { - xsave_cntxt_init(); + if (cpu_has_xsave) + /* xstate_size was already initialized */ return; - } if (cpu_has_fxsr) xstate_size = sizeof(struct i387_fxsave_struct); diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index ab9ad48..c46082d 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c @@ -429,10 +429,13 @@ static void __init setup_xstate_init(void) /* * Enable and initialize the xsave feature. */ -void __ref xsave_cntxt_init(void) +static void __cpuinit xsave_cntxt_init(void) { unsigned int eax, ebx, ecx, edx; + if (!cpu_has_xsave) + return; + cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx); pcntxt_mask = eax + ((u64)edx << 32); @@ -469,7 +472,9 @@ void __cpuinit xsave_init(void) /* * Boot processor to setup the FP and extended state context info. */ - if (!smp_processor_id()) + if (!smp_processor_id()) { + xsave_cntxt_init(); init_thread_xstate(); + } __xsave_init(); } -- 1.7.1.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |