summaryrefslogtreecommitdiff
blob: c6598835133e08bab2a89dd5e907307d7d6ef0f5 (plain)
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
--- a/common/lib/modules/fglrx/build_mod/firegl_public.c	2015-08-30 17:36:02.000000000 -0400
+++ b/common/lib/modules/fglrx/build_mod/firegl_public.c	2015-08-30 17:39:36.000000000 -0400
@@ -21,6 +21,8 @@
 !!! since it requires changes to linux/init/main.c.
 #endif /* !MODULE */
 
+#include <linux/preempt.h>
+
 // ============================================================
 #include <linux/version.h>
 
@@ -4997,7 +4999,9 @@ static unsigned int kas_spin_unlock(kas_
 unsigned long ATI_API_CALL KAS_GetExecutionLevel(void)
 {
     unsigned long ret;
+    preempt_disable();
     ret = kas_GetExecutionLevel();
+    preempt_enable();
     return ret;
 }
 
@@ -5022,8 +5026,10 @@ unsigned int ATI_API_CALL KAS_Ih_Execute
     KCL_DEBUG5(FN_FIREGL_KAS,"0x%08X, 0x%08X\n", ih_routine, ih_context);
 
     //Prevent simultaneous entry on some SMP systems.
+    preempt_disable();
     if (test_and_set_bit(0, (void *)&(kasContext.in_interrupts[smp_processor_id()])))
     {
+    	preempt_enable();
         KCL_DEBUG1(FN_FIREGL_KAS, "The processor is handling the interrupt\n");
         return IRQ_NONE;
     }
@@ -5036,9 +5042,9 @@ unsigned int ATI_API_CALL KAS_Ih_Execute
 
     kasSetExecutionLevel(orig_level);
     spin_unlock(&kasContext.lock_ih); 
-
     clear_bit(0, (void *)&(kasContext.in_interrupts[smp_processor_id()]));
     KCL_DEBUG5(FN_FIREGL_KAS,"%d\n", ret);
+    preempt_enable();
 
     return ret;
 }
@@ -5256,6 +5262,7 @@ unsigned int ATI_API_CALL KAS_Spinlock_A
 
     KCL_DEBUG5(FN_FIREGL_KAS,"0x%08X\n", hSpinLock);
 
+    preempt_disable();
     spin_lock_info.routine_type = spinlock_obj->routine_type;
     spin_lock_info.plock = &(spinlock_obj->lock);
 
@@ -5263,6 +5270,7 @@ unsigned int ATI_API_CALL KAS_Spinlock_A
 
     spinlock_obj->acquire_type = spin_lock_info.acquire_type;
     spinlock_obj->flags = spin_lock_info.flags;
+    preempt_enable();
 
     KCL_DEBUG5(FN_FIREGL_KAS,"%d\n", ret);
     return ret;
@@ -6034,6 +6042,8 @@ unsigned int ATI_API_CALL KAS_Interlocke
 
     KCL_DEBUG5(FN_FIREGL_KAS,"0x%08X, 0x%08X, 0x%08X\n", hListHead, hListEntry, phPrevEntry);
 
+    preempt_disable();
+
     /* Protect the operation with spinlock */
     spin_lock_info.routine_type = listhead_obj->routine_type;
     spin_lock_info.plock = &(listhead_obj->lock);
@@ -6041,6 +6051,7 @@ unsigned int ATI_API_CALL KAS_Interlocke
     if (!kas_spin_lock(&spin_lock_info))
     {
         KCL_DEBUG_ERROR("Unable to grab list spinlock\n");
+	preempt_enable();
         return 0; /* No spinlock - no operation */
     }
 
@@ -6065,6 +6076,7 @@ unsigned int ATI_API_CALL KAS_Interlocke
     spin_unlock_info.flags = spin_lock_info.flags;
 
     ret = kas_spin_unlock(&spin_unlock_info);
+    preempt_enable();
     KCL_DEBUG5(FN_FIREGL_KAS,"%d", ret);
     return ret;
 }
@@ -6153,8 +6165,10 @@ unsigned int ATI_API_CALL KAS_Interlocke
     spin_lock_info.routine_type = listhead_obj->routine_type;
     spin_lock_info.plock = &(listhead_obj->lock);
 
+    preempt_disable();
     if (!kas_spin_lock(&spin_lock_info))
     {
+        preempt_enable();
         KCL_DEBUG_ERROR("Unable to grab list spinlock");
         return 0; /* No spinlock - no operation */
     }
@@ -6178,6 +6192,7 @@ unsigned int ATI_API_CALL KAS_Interlocke
     spin_unlock_info.flags = spin_lock_info.flags;
 
     ret = kas_spin_unlock(&spin_unlock_info);
+    preempt_enable();
     KCL_DEBUG5(FN_FIREGL_KAS,"%d", ret);
     return ret;
 }