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