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>
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, ...)
23 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)
25 + * Save processor xstate to xsave area.
27 +static void _copy_xregs_to_kernel(struct xregs_state *xstate)
31 + u32 hmask = mask >> 32;
34 + /*WARN_ON(!alternatives_patched);*/
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.
41 + * Otherwise, if xsaveopt is enabled, xsaveopt replaces xsave
42 + * because xsaveopt supports modified optimization which is not
43 + * supported by xsave.
45 + * If none of xsaves and xsaveopt is enabled, use xsave.
47 + alternative_input_2(
50 + X86_FEATURE_XSAVEOPT,
53 + [xstate] "D" (xstate), "a" (lmask), "d" (hmask) :
55 + asm volatile("2:\n\t"
60 + /* We should never fault when copying to a kernel buffer: */
65 /** \brief Generate UUID
66 * \param buf pointer to the generated UUID
68 @@ -6462,7 +6504,7 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
70 if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
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))