]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86/fpu: Remove xsave_init() bootmem allocations
authorIngo Molnar <mingo@kernel.org>
Sat, 25 Apr 2015 03:04:41 +0000 (05:04 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 19 May 2015 13:47:38 +0000 (15:47 +0200)
There's only 8 xstate bits at the moment, and it's not like we
can support unknown bits - so put xstate_offsets[] and
xstate_sizes[] into static allocation.

This is in preparation to be able to call the FPU init code
earlier, when there's no bootmem available yet.

Reviewed-by: Borislav Petkov <bp@alien8.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/include/asm/fpu/xsave.h
arch/x86/kernel/fpu/xsave.c

index b27b4466f88d17e5dce8ca7e27cbca1621377347..fd564344783e1b3a1a590ed1538aeef4f86377fa 100644 (file)
@@ -15,6 +15,9 @@
 #define XSTATE_ZMM_Hi256       0x40
 #define XSTATE_Hi16_ZMM                0x80
 
+/* The highest xstate bit above (of XSTATE_Hi16_ZMM): */
+#define XFEATURES_NR_MAX       8
+
 #define XSTATE_FPSSE   (XSTATE_FP | XSTATE_SSE)
 #define XSTATE_AVX512  (XSTATE_OPMASK | XSTATE_ZMM_Hi256 | XSTATE_Hi16_ZMM)
 /* Bit 63 of XCR0 is reserved for future expansion */
index f3d30f0c50f91b064d11a7041eedd72c0b9077bb..adeab16655ae6f14fd6aae481438f04fcc8c24ab 100644 (file)
@@ -23,7 +23,7 @@ u64 xfeatures_mask;
 struct xsave_struct *init_xstate_buf;
 
 static struct _fpx_sw_bytes fx_sw_reserved, fx_sw_reserved_ia32;
-static unsigned int *xstate_offsets, *xstate_sizes;
+static unsigned int xstate_offsets[XFEATURES_NR_MAX], xstate_sizes[XFEATURES_NR_MAX];
 static unsigned int xstate_comp_offsets[sizeof(xfeatures_mask)*8];
 
 /* The number of supported xfeatures in xfeatures_mask: */
@@ -478,8 +478,6 @@ static void __init setup_xstate_features(void)
        int eax, ebx, ecx, edx, leaf = 0x2;
 
        xfeatures_nr = fls64(xfeatures_mask);
-       xstate_offsets = alloc_bootmem(xfeatures_nr * sizeof(int));
-       xstate_sizes = alloc_bootmem(xfeatures_nr * sizeof(int));
 
        do {
                cpuid_count(XSTATE_CPUID, leaf, &eax, &ebx, &ecx, &edx);