diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2009-04-10 18:21:24 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-12 07:08:56 -0400 |
commit | a30469e7921a6dd2067e9e836d7787cfa0105627 (patch) | |
tree | 6a5418033c233648b436610a6f6730f37ba80144 /arch/x86 | |
parent | 1ee4bd92a7aa49eb66c8d5672e837090d3e7b7ff (diff) |
x86: add linux kernel support for YMM state
Impact: save/restore Intel-AVX state properly between tasks
Intel Advanced Vector Extensions (AVX) introduce 256-bit vector processing
capability. More about AVX at http://software.intel.com/sites/avx
Add OS support for YMM state management using xsave/xrstor infrastructure
to support AVX.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
LKML-Reference: <1239402084.27006.8057.camel@localhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/processor.h | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/sigcontext.h | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/xsave.h | 3 | ||||
-rw-r--r-- | arch/x86/kernel/xsave.c | 2 |
4 files changed, 15 insertions, 2 deletions
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 34c52370f2fe..fcf4d92e7e04 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -352,6 +352,11 @@ struct i387_soft_struct { | |||
352 | u32 entry_eip; | 352 | u32 entry_eip; |
353 | }; | 353 | }; |
354 | 354 | ||
355 | struct ymmh_struct { | ||
356 | /* 16 * 16 bytes for each YMMH-reg = 256 bytes */ | ||
357 | u32 ymmh_space[64]; | ||
358 | }; | ||
359 | |||
355 | struct xsave_hdr_struct { | 360 | struct xsave_hdr_struct { |
356 | u64 xstate_bv; | 361 | u64 xstate_bv; |
357 | u64 reserved1[2]; | 362 | u64 reserved1[2]; |
@@ -361,6 +366,7 @@ struct xsave_hdr_struct { | |||
361 | struct xsave_struct { | 366 | struct xsave_struct { |
362 | struct i387_fxsave_struct i387; | 367 | struct i387_fxsave_struct i387; |
363 | struct xsave_hdr_struct xsave_hdr; | 368 | struct xsave_hdr_struct xsave_hdr; |
369 | struct ymmh_struct ymmh; | ||
364 | /* new processor state extensions will go here */ | 370 | /* new processor state extensions will go here */ |
365 | } __attribute__ ((packed, aligned (64))); | 371 | } __attribute__ ((packed, aligned (64))); |
366 | 372 | ||
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h index ec666491aaa4..72e5a4491661 100644 --- a/arch/x86/include/asm/sigcontext.h +++ b/arch/x86/include/asm/sigcontext.h | |||
@@ -269,6 +269,11 @@ struct _xsave_hdr { | |||
269 | __u64 reserved2[5]; | 269 | __u64 reserved2[5]; |
270 | }; | 270 | }; |
271 | 271 | ||
272 | struct _ymmh_state { | ||
273 | /* 16 * 16 bytes for each YMMH-reg */ | ||
274 | __u32 ymmh_space[64]; | ||
275 | }; | ||
276 | |||
272 | /* | 277 | /* |
273 | * Extended state pointed by the fpstate pointer in the sigcontext. | 278 | * Extended state pointed by the fpstate pointer in the sigcontext. |
274 | * In addition to the fpstate, information encoded in the xstate_hdr | 279 | * In addition to the fpstate, information encoded in the xstate_hdr |
@@ -278,6 +283,7 @@ struct _xsave_hdr { | |||
278 | struct _xstate { | 283 | struct _xstate { |
279 | struct _fpstate fpstate; | 284 | struct _fpstate fpstate; |
280 | struct _xsave_hdr xstate_hdr; | 285 | struct _xsave_hdr xstate_hdr; |
286 | struct _ymmh_state ymmh; | ||
281 | /* new processor state extensions go here */ | 287 | /* new processor state extensions go here */ |
282 | }; | 288 | }; |
283 | 289 | ||
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h index 08e9a1ac07a9..727acc152344 100644 --- a/arch/x86/include/asm/xsave.h +++ b/arch/x86/include/asm/xsave.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #define XSTATE_FP 0x1 | 8 | #define XSTATE_FP 0x1 |
9 | #define XSTATE_SSE 0x2 | 9 | #define XSTATE_SSE 0x2 |
10 | #define XSTATE_YMM 0x4 | ||
10 | 11 | ||
11 | #define XSTATE_FPSSE (XSTATE_FP | XSTATE_SSE) | 12 | #define XSTATE_FPSSE (XSTATE_FP | XSTATE_SSE) |
12 | 13 | ||
@@ -15,7 +16,7 @@ | |||
15 | /* | 16 | /* |
16 | * These are the features that the OS can handle currently. | 17 | * These are the features that the OS can handle currently. |
17 | */ | 18 | */ |
18 | #define XCNTXT_MASK (XSTATE_FP | XSTATE_SSE) | 19 | #define XCNTXT_MASK (XSTATE_FP | XSTATE_SSE | XSTATE_YMM) |
19 | 20 | ||
20 | #ifdef CONFIG_X86_64 | 21 | #ifdef CONFIG_X86_64 |
21 | #define REX_PREFIX "0x48, " | 22 | #define REX_PREFIX "0x48, " |
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index 2b54fe002e94..0a5b04aa98f1 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c | |||
@@ -324,7 +324,7 @@ void __ref xsave_cntxt_init(void) | |||
324 | } | 324 | } |
325 | 325 | ||
326 | /* | 326 | /* |
327 | * for now OS knows only about FP/SSE | 327 | * Support only the state known to OS. |
328 | */ | 328 | */ |
329 | pcntxt_mask = pcntxt_mask & XCNTXT_MASK; | 329 | pcntxt_mask = pcntxt_mask & XCNTXT_MASK; |
330 | xsave_init(); | 330 | xsave_init(); |