From 8fc9c3d0698200620ff08d82b693a69673f8704c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Sat, 14 Nov 2015 05:26:22 +0100 Subject: [PATCH] catalyst: fix for linux >= 4.2.0 Closes #2959 --- srcpkgs/catalyst/files/linux-4.2.patch | 73 ++++++++++++++++++++++++++ srcpkgs/catalyst/template | 3 +- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/catalyst/files/linux-4.2.patch diff --git a/srcpkgs/catalyst/files/linux-4.2.patch b/srcpkgs/catalyst/files/linux-4.2.patch new file mode 100644 index 00000000000..95bcc10d6ba --- /dev/null +++ b/srcpkgs/catalyst/files/linux-4.2.patch @@ -0,0 +1,73 @@ +Fix for kernel >= 4.2.0 + +--- fglrx-15.201.1151.orig/common/lib/modules/fglrx/build_mod/firegl_public.c ++++ fglrx-15.201.1151/common/lib/modules/fglrx/build_mod/firegl_public.c +@@ -191,8 +191,14 @@ + #include + #include + #include ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ++#include "asm/fpu/api.h" ++#else + #include "asm/i387.h" +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) ++#endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ++#include ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) + #include + #endif + +@@ -1700,6 +1706,7 @@ void ATI_API_CALL KCL_SetCurrentProcessS + current->state = KCL_MAP_ProcessState[state]; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + #if defined(__i386__) + #ifndef __HAVE_ARCH_CMPXCHG + static inline +@@ -1733,12 +1740,15 @@ unsigned long __fgl_cmpxchg(volatile voi + #elif defined(__alpha__) + todo !!! + #endif ++#endif + + unsigned long ATI_API_CALL kcl__cmpxchg(volatile void *ptr, unsigned long old, + unsigned long new, int size) + { + #ifndef __HAVE_ARCH_CMPXCHG ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + return __fgl_cmpxchg(ptr,old,new,size); ++#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 +@@ -6456,7 +6466,7 @@ void ATI_API_CALL KCL_create_uuid(void * + static int KCL_fpu_save_init(struct task_struct *tsk) + { + struct fpu *fpu = &tsk->thread.fpu; +- ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + if(static_cpu_has(X86_FEATURE_XSAVE)) { + fpu_xsave(fpu); + if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP)) +@@ -6473,6 +6483,7 @@ static int KCL_fpu_save_init(struct task + asm volatile("fnclex"); + return 0; + } ++#endif + return 1; + } + #endif +@@ -6505,7 +6516,9 @@ void ATI_API_CALL KCL_fpu_begin(void) + */ + struct task_struct *cur_task = current; + preempt_disable(); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ++ if (cur_task->thread.fpu.fpregs_active) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) + /* The thread structure is changed with the commit below for kernel 3.3: + * https://github.com/torvalds/linux/commit/7e16838d94b566a17b65231073d179bc04d590c8 + */ + diff --git a/srcpkgs/catalyst/template b/srcpkgs/catalyst/template index 6a1b9524f68..7ceea781aca 100644 --- a/srcpkgs/catalyst/template +++ b/srcpkgs/catalyst/template @@ -4,7 +4,7 @@ _release="15.9" pkgname=catalyst version=15.201.1151 -revision=4 +revision=5 maintainer="Juan RP " license="Proprietary AMD license" homepage="http://www.amd.com" @@ -38,6 +38,7 @@ do_build() { patch -Np1 -i ${FILESDIR}/linux-4.0.patch patch -Np1 -i ${FILESDIR}/kolasa_4.1_remove-IRQF_DISABLED.patch patch -Np1 -i ${FILESDIR}/fglrx_gpl_symbol.patch + patch -Np1 -i ${FILESDIR}/linux-4.2.patch } do_install() { cd fglrx-${version}