python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / package / amd-catalyst / 0005-Use-a-local-copy-of-copy_xregs_to_kernel.patch
blobc9513ef188bdf1c85c44637861cd9f4c6f83a104
1 From eb703737be5c91c1a0817351db8ec152c523c85d Mon Sep 17 00:00:00 2001
2 From: Alberto Milone <alberto.milone@canonical.com>
3 Date: Thu, 17 Sep 2015 15:49:46 +0200
4 Subject: [PATCH] Use a local copy of copy_xregs_to_kernel
6 This is needed for Linux 4.2.
8 Thanks to Tim Gardner for the patch.
10 Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
11 ---
12 common/lib/modules/fglrx/build_mod/firegl_public.c | 44 +++++++++++++++++++++-
13 1 file changed, 43 insertions(+), 1 deletion(-)
15 diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
16 index 4c1f9a5..bb67bba 100755
17 --- a/common/lib/modules/fglrx/build_mod/firegl_public.c
18 +++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
19 @@ -6443,6 +6443,48 @@ int ATI_API_CALL kcl_sscanf(const char * buf, const char * fmt, ...)
20 return i;
23 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
24 +/*
25 + * Save processor xstate to xsave area.
26 + */
27 +static void _copy_xregs_to_kernel(struct xregs_state *xstate)
29 + u64 mask = -1;
30 + u32 lmask = mask;
31 + u32 hmask = mask >> 32;
32 + int err = 0;
34 + /*WARN_ON(!alternatives_patched);*/
36 + /*
37 + * If xsaves is enabled, xsaves replaces xsaveopt because
38 + * it supports compact format and supervisor states in addition to
39 + * modified optimization in xsaveopt.
40 + *
41 + * Otherwise, if xsaveopt is enabled, xsaveopt replaces xsave
42 + * because xsaveopt supports modified optimization which is not
43 + * supported by xsave.
44 + *
45 + * If none of xsaves and xsaveopt is enabled, use xsave.
46 + */
47 + alternative_input_2(
48 + "1:"XSAVE,
49 + XSAVEOPT,
50 + X86_FEATURE_XSAVEOPT,
51 + XSAVES,
52 + X86_FEATURE_XSAVES,
53 + [xstate] "D" (xstate), "a" (lmask), "d" (hmask) :
54 + "memory");
55 + asm volatile("2:\n\t"
56 + xstate_fault(err)
57 + : "0" (err)
58 + : "memory");
60 + /* We should never fault when copying to a kernel buffer: */
61 + WARN_ON_FPU(err);
63 +#endif
65 /** \brief Generate UUID
66 * \param buf pointer to the generated UUID
67 * \return None
68 @@ -6462,7 +6504,7 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
69 fpu_xsave(fpu);
70 if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
71 #else
72 - copy_xregs_to_kernel(&fpu->state.xsave);
73 + _copy_xregs_to_kernel(&fpu->state.xsave);
74 if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
75 #endif
76 return 1;
77 --
78 2.8.1