3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/ati-drivers/patches/15.9-preempt.patch

104 lines
3.4 KiB
Diff
Raw Normal View History

--- 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;
}