python-pathvalidate: bump version to 0.14.1
[buildroot-gz.git] / package / amd-catalyst / 0003-Add-support-for-Linux-4.2.patch
blob745816296550b0402cc8a9de3a7b6dae9b3ee0ac
1 From e2e6c2dac2a0311a022208dd289374b832538329 Mon Sep 17 00:00:00 2001
2 From: Alberto Milone <alberto.milone@canonical.com>
3 Date: Tue, 14 Jul 2015 12:56:37 +0200
4 Subject: [PATCH] Add support for Linux 4.2
6 Deal with the FPU code renaming
8 Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
9 ---
10 common/lib/modules/fglrx/build_mod/firegl_public.c | 38 ++++++++++++++++++++++
11 1 file changed, 38 insertions(+)
13 diff --git a/common/lib/modules/fglrx/build_mod/firegl_public.c b/common/lib/modules/fglrx/build_mod/firegl_public.c
14 index 94778f1..749ea51 100755
15 --- a/common/lib/modules/fglrx/build_mod/firegl_public.c
16 +++ b/common/lib/modules/fglrx/build_mod/firegl_public.c
17 @@ -191,9 +191,17 @@
18 #include <linux/string.h>
19 #include <linux/gfp.h>
20 #include <linux/swap.h>
21 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
22 #include "asm/i387.h"
23 +#else
24 +#include <asm/fpu/api.h>
25 +#endif
26 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
27 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
28 #include <asm/fpu-internal.h>
29 +#else
30 +#include <asm/fpu/internal.h>
31 +#endif
32 #endif
34 #include "firegl_public.h"
35 @@ -1711,6 +1719,9 @@ void ATI_API_CALL KCL_SetCurrentProcessState(KCL_ENUM_ProcessState state)
37 #if defined(__i386__)
38 #ifndef __HAVE_ARCH_CMPXCHG
39 +#ifndef __xg
40 +#define __xg(x) ((volatile long *)(x))
41 +#endif
42 static inline
43 unsigned long __fgl_cmpxchg(volatile void *ptr, unsigned long old,
44 unsigned long new, int size)
45 @@ -1747,7 +1758,11 @@ unsigned long ATI_API_CALL kcl__cmpxchg(volatile void *ptr, unsigned long old,
46 unsigned long new, int size)
48 #ifndef __HAVE_ARCH_CMPXCHG
49 +#if defined(__i386__)
50 return __fgl_cmpxchg(ptr,old,new,size);
51 +#elif defined(__x86_64__)
52 + return cmpxchg((unsigned long*)ptr,old,new);
53 +#endif
54 #else
55 /* On kernel version 2.6.34 passing a variable or unsupported size
56 * argument to the __cmpxchg macro causes the default-clause of a
57 @@ -6443,21 +6458,36 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
58 struct fpu *fpu = &tsk->thread.fpu;
60 if(static_cpu_has(X86_FEATURE_XSAVE)) {
61 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
62 fpu_xsave(fpu);
63 if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP))
64 +#else
65 + copy_xregs_to_kernel(&fpu->state.xsave);
66 + if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP))
67 +#endif
68 return 1;
69 } else if (static_cpu_has(X86_FEATURE_FXSR)) {
70 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
71 fpu_fxsave(fpu);
72 +#else
73 + copy_fxregs_to_kernel(fpu);
74 +#endif
75 } else {
76 asm volatile("fnsave %[fx]; fwait"
77 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
78 : [fx] "=m" (fpu->state->fsave));
79 +#else
80 + : [fx] "=m" (fpu->state.fsave));
81 +#endif
82 return 0;
85 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
86 if (unlikely(fpu->state->fxsave.swd & X87_FSW_ES)) {
87 asm volatile("fnclex");
88 return 0;
90 +#endif
91 return 1;
93 #endif
94 @@ -6469,8 +6499,12 @@ static int KCL_fpu_save_init(struct task_struct *tsk)
95 void ATI_API_CALL KCL_fpu_begin(void)
97 #ifdef CONFIG_X86_64
98 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
99 kernel_fpu_begin();
100 #else
101 + __kernel_fpu_begin();
102 +#endif
103 +#else
104 #ifdef TS_USEDFPU
105 struct thread_info *cur_thread = current_thread_info();
106 struct task_struct *cur_task = get_current();
107 @@ -6515,7 +6549,11 @@ void ATI_API_CALL KCL_fpu_begin(void)
109 void ATI_API_CALL KCL_fpu_end(void)
111 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
112 kernel_fpu_end();
113 +#else
114 + __kernel_fpu_end();
115 +#endif
118 /** Create new directory entry under "/proc/...."
120 2.8.1