x86/fpu: Check CPU-provided sizes against struct declarations
authorDave Hansen <dave.hansen@linux.intel.com>
Wed, 2 Sep 2015 23:31:31 +0000 (16:31 -0700)
committerIngo Molnar <mingo@kernel.org>
Mon, 14 Sep 2015 10:22:02 +0000 (12:22 +0200)
commitef78f2a4bf84d8db9f36868decca2dc24e02a6af
tree42fa0670920bba069749cef56d1b5b239fcc8fad
parente6e888f96b4a531886f3bf29ba9af0b6f1026365
x86/fpu: Check CPU-provided sizes against struct declarations

We now have C structures defined for each of the XSAVE state
components that we support.  This patch adds checks during our
verification pass to ensure that the CPU-provided data
enumerated in CPUID leaves matches our C structures.

If not, we warn and dump all the XSAVE CPUID leaves.

Note: this *actually* found an inconsistency with the MPX
'bndcsr' state.  The hardware pads it out differently from
our C structures.  This patch caught it and warned.

Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: dave@sr71.net
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/20150902233131.A8DB36DA@viggo.jf.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/fpu/xstate.c