From 16304dd5382a5a0f2a1e4f803241e146b92befc2 Mon Sep 17 00:00:00 2001 From: lemmi Date: Sat, 2 Apr 2016 07:34:20 +0200 Subject: [PATCH] catalyst: linux-4.4 support --- .../files/4.2-amd-from_crimson_15.11.patch | 447 ++++++++++++++++++ srcpkgs/catalyst/files/4.3-gentoo-mtrr.patch | 27 ++ .../files/4.3-kolasa-seq_printf.patch | 16 + .../catalyst/files/4.4-manjaro-xstate.patch | 22 + srcpkgs/catalyst/files/crimson_i686_xg.patch | 12 + srcpkgs/catalyst/files/grsec_arch.patch | 77 +++ .../kolasa_4.1_remove-IRQF_DISABLED.patch | 15 - .../files/lano1106_fglrx_intel_iommu.patch | 11 + .../files/lano1106_kcl_agp_13_4.patch | 90 ++++ srcpkgs/catalyst/files/linux-4.0.patch | 15 - srcpkgs/catalyst/files/linux-4.2.patch | 73 --- srcpkgs/catalyst/template | 17 +- 12 files changed, 713 insertions(+), 109 deletions(-) create mode 100644 srcpkgs/catalyst/files/4.2-amd-from_crimson_15.11.patch create mode 100644 srcpkgs/catalyst/files/4.3-gentoo-mtrr.patch create mode 100644 srcpkgs/catalyst/files/4.3-kolasa-seq_printf.patch create mode 100644 srcpkgs/catalyst/files/4.4-manjaro-xstate.patch create mode 100644 srcpkgs/catalyst/files/crimson_i686_xg.patch create mode 100644 srcpkgs/catalyst/files/grsec_arch.patch delete mode 100644 srcpkgs/catalyst/files/kolasa_4.1_remove-IRQF_DISABLED.patch create mode 100644 srcpkgs/catalyst/files/lano1106_fglrx_intel_iommu.patch create mode 100644 srcpkgs/catalyst/files/lano1106_kcl_agp_13_4.patch delete mode 100644 srcpkgs/catalyst/files/linux-4.0.patch delete mode 100644 srcpkgs/catalyst/files/linux-4.2.patch diff --git a/srcpkgs/catalyst/files/4.2-amd-from_crimson_15.11.patch b/srcpkgs/catalyst/files/4.2-amd-from_crimson_15.11.patch new file mode 100644 index 00000000000..cd957917b1b --- /dev/null +++ b/srcpkgs/catalyst/files/4.2-amd-from_crimson_15.11.patch @@ -0,0 +1,447 @@ +diff -uNr 15.12/common/lib/modules/fglrx//build_mod/firegl_public.c 15.12b/common/lib/modules/fglrx//build_mod/firegl_public.c +--- 15.12/common/lib/modules/fglrx//build_mod/firegl_public.c 2015-09-09 00:57:14.000000000 +0200 ++++ 15.12b/common/lib/modules/fglrx//build_mod/firegl_public.c 2015-11-21 00:35:38.000000000 +0100 +@@ -191,9 +191,17 @@ + #include + #include + #include ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + #include "asm/i387.h" ++#else ++#include ++#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + #include ++#else ++#include ++#endif + #endif + + #include "firegl_public.h" +@@ -1742,7 +1750,11 @@ + 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 +@@ -3503,10 +3515,12 @@ + KCL_PUB_InterruptHandlerWrap, + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + ((useMSI) ? (SA_INTERRUPT) : (SA_SHIRQ)), +-#else ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) + //when MSI enabled. keep irq disabled when calling the action handler, + //exclude this IRQ from irq balancing (only on one CPU) +- ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)), ++ ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)), ++#else ++ ((useMSI) ? (0x0) : (IRQF_SHARED)), + #endif + dev_name, + context); +@@ -5031,7 +5045,7 @@ + orig_level = kasSetExecutionLevel(kasContext.exec_level_ih); + + ret = kasContext.callback_wrapper_ret(ih_routine, ih_context); +- KCL_DEBUG1(FN_FIREGL_KAS,"Interrupt handler returned 0x%08X\n", ret); ++ KCL_DEBUG1(FN_FIREGL_KAS,"Interrupt handler returned 0x%08X\n", ret); + + kasSetExecutionLevel(orig_level); + spin_unlock(&kasContext.lock_ih); +@@ -6436,21 +6450,36 @@ + 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)) +- return 1; ++#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)) { +- fpu_fxsave(fpu); +- } else { ++#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)); +- return 0; ++#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; ++ asm volatile("fnclex"); ++ return 0; + } ++#endif + return 1; + } + #endif +@@ -6462,8 +6491,13 @@ + 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 ++ preempt_disable(); ++ __kernel_fpu_begin(); ++#endif ++#else + #ifdef TS_USEDFPU + struct thread_info *cur_thread = current_thread_info(); + struct task_struct *cur_task = get_current(); +@@ -6487,8 +6521,12 @@ + /* The thread structure is changed with the commit below for kernel 3.3: + * https://github.com/torvalds/linux/commit/7e16838d94b566a17b65231073d179bc04d590c8 + */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + if (cur_task->thread.fpu.has_fpu) + #else ++ if (cur_task->thread.fpu.fpregs_active) ++#endif ++#else + if (cur_task->thread.has_fpu) + #endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0) +@@ -6508,7 +6546,12 @@ + */ + void ATI_API_CALL KCL_fpu_end(void) + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + kernel_fpu_end(); ++#else ++ __kernel_fpu_end(); ++ preempt_enable(); ++#endif + } + + /** Create new directory entry under "/proc/...." +diff -uNr 15.12/common/lib/modules/fglrx//build_mod/kcl_debug.c 15.12b/common/lib/modules/fglrx//build_mod/kcl_debug.c +--- 15.12/common/lib/modules/fglrx//build_mod/kcl_debug.c 2015-09-09 00:57:14.000000000 +0200 ++++ 15.12b/common/lib/modules/fglrx//build_mod/kcl_debug.c 2015-11-21 00:35:38.000000000 +0100 +@@ -35,10 +35,10 @@ + #include + #include + #include +- ++#include "firegl_public.h" + #include "kcl_debug.h" + +-extern void* ATI_API_CALL KCL_MEM_SmallBufferAllocAtomic(unsigned long size); ++extern void* ATI_API_CALL KCL_MEM_SmallBufferAllocAtomic(kcl_size_t size); + extern void ATI_API_CALL KCL_MEM_SmallBufferFree(void* p); + + extern int ATI_API_CALL firegl_debug_dump(void); +@@ -156,6 +156,47 @@ + KCL_MEM_SmallBufferFree(buffer); + } + ++/** \brief Print debug information to the OS debug console according to traceMask and debugMask ++ * \param traceMask Bit mask of enabled trace function ++ * \param debugMask Bit mask of enabled debug level. 0-7 total ++ * \param name function name ++ * \param line line number inside the file ++ * \param the print parameter ++ * \param fmt printf-like formatting string ++ * \param ... printf-like parameters ++ */ ++void ATI_API_CALL KCL_DEBUG_Print_Trace(unsigned int traceMask, unsigned int debugMask, void* name, int line, long param, const char* fmt, ...) ++{ ++ int print = firegl_trace(traceMask, debugMask, name, line, param); ++ if(print) ++ { ++ int len; ++ char* buffer=KCL_MEM_SmallBufferAllocAtomic(MAX_STRING_LENGTH); ++ if(buffer==NULL) ++ return; ++ if(fmt == NULL) ++ { ++ buffer[0] = '\n'; ++ buffer[1] = '\0'; ++ } ++ else ++ { ++ va_list marker; ++ va_start(marker, fmt); ++ kcl_vsnprintf(buffer,255,fmt, marker); ++ va_end(marker); ++ len = strlen(buffer); ++ if(buffer[len-1] != '\n') ++ { ++ buffer[len]='\n'; ++ buffer[len+1]='\0'; ++ } ++ } ++ KCL_DEBUG_Print("[fglrx] %s:%d %s", (char*)name, line, buffer); ++ KCL_MEM_SmallBufferFree(buffer); ++ } ++} ++ + /** \brief Register keyboard handler to dump module internal state + * \param enable 1 to register the handler, 0 to unregister it + * \return 0 +diff -uNr 15.12/common/lib/modules/fglrx//build_mod/kcl_debug.h 15.12b/common/lib/modules/fglrx//build_mod/kcl_debug.h +--- 15.12/common/lib/modules/fglrx//build_mod/kcl_debug.h 2015-09-09 00:57:14.000000000 +0200 ++++ 15.12b/common/lib/modules/fglrx//build_mod/kcl_debug.h 2015-11-21 00:35:38.000000000 +0100 +@@ -64,17 +64,22 @@ + FN_GENERIC_MAXIMUM = 0x3f + } FN_TRACE; + +-extern void ATI_API_CALL firegl_trace(unsigned int traceMask, ++extern int ATI_API_CALL firegl_trace(unsigned int traceMask, + unsigned int debugMask, + void* name, + int line, +- long param, +- const char* fmt, +- ...); ++ long param); + + #define MAX_STRING_LENGTH 512 + + void ATI_API_CALL KCL_DEBUG_Print(const char* fmt, ...); ++void ATI_API_CALL KCL_DEBUG_Print_Trace(unsigned int traceMask, ++ unsigned int debugMask, ++ void* name, ++ int line, ++ long param, ++ const char* fmt, ++ ...); + int ATI_API_CALL KCL_DEBUG_RegKbdHandler(int enable); + int ATI_API_CALL KCL_DEBUG_RegKbdDumpHandler(int enable); + void ATI_API_CALL KCL_DEBUG_OsDump(void); +@@ -211,102 +216,106 @@ + KCL_DEBUG_Print("<6>[fglrx] " fmt, ##arg) + + +-#define KCL_DEBUG_TRACE(m, p, fmt, arg...) \ +- do \ +- { \ +- firegl_trace(m, \ +- FN_DEBUG_TRACE, \ +- (void*)__FUNCTION__, \ +- (int)(__LINE__), \ +- (long)(p), \ +- fmt, \ +- ##arg); \ ++#define KCL_DEBUG_TRACE(m, p, fmt, arg...) \ ++ do \ ++ { \ ++ KCL_DEBUG_Print_Trace(m, \ ++ FN_DEBUG_TRACE, \ ++ (void*)__FUNCTION__, \ ++ (int)(__LINE__), \ ++ (long)(p), \ ++ fmt, \ ++ ##arg); \ + } while (0) + + #define KCL_DEBUG_TRACEIN KCL_DEBUG_TRACE + +-#define KCL_DEBUG_TRACEOUT(m, p, fmt, arg...) \ +- do \ +- { \ +- firegl_trace(m, \ +- FN_DEBUG_TRACEOUT, \ +- (void*)__FUNCTION__, \ +- (int)(__LINE__), \ +- (long)(p), \ +- fmt, \ +- ##arg); \ +- } while (0) +- +-#define KCL_DEBUG1(m, fmt, arg...) \ +- do \ +- { \ +- firegl_trace(m, \ +- FN_DEBUG_LEVEL1, \ +- (void*)__FUNCTION__, \ +- (int)__LINE__, \ +- 0, \ +- fmt, \ +- ##arg); \ +- } while (0) +- +-#define KCL_DEBUG2(m, fmt, arg...) \ +- do \ +- { \ +- firegl_trace(m, \ +- FN_DEBUG_LEVEL2, \ +- (void*)__FUNCTION__, \ +- (int)__LINE__, \ +- 0, \ +- fmt, \ +- ##arg); \ +- } while (0) +- +-#define KCL_DEBUG3(m, fmt, arg...) \ +- do \ +- { \ +- firegl_trace(m, \ +- FN_DEBUG_LEVEL3, \ +- (void*)__FUNCTION__, \ +- (int)__LINE__, \ +- 0, \ +- fmt, \ +- ##arg); \ +- } while (0) +- +-#define KCL_DEBUG4(m, fmt, arg...) \ +- do \ +- { \ +- firegl_trace(m, \ +- FN_DEBUG_LEVEL4, \ +- (void*)__FUNCTION__, \ +- (int)__LINE__, \ +- 0, \ +- fmt, \ +- ##arg); \ +- } while (0) +- +-#define KCL_DEBUG5(m, fmt, arg...) \ +- do \ +- { \ +- firegl_trace(m, \ +- FN_DEBUG_LEVEL5, \ +- (void*)__FUNCTION__, \ +- (int)__LINE__, \ +- 0, \ +- fmt, \ +- ##arg); \ +- } while (0) +- +-#define KCL_DEBUG6(m, fmt, arg...) \ +- do \ +- { \ +- firegl_trace(m, \ +- FN_DEBUG_LEVEL6, \ +- (void*)__FUNCTION__, \ +- (int)__LINE__, \ +- 0, \ +- fmt, \ +- ##arg); \ ++#define KCL_DEBUG_TRACEOUT(m, p, fmt, arg...) \ ++ do \ ++ { \ ++ KCL_DEBUG_Print_Trace(m, \ ++ FN_DEBUG_TRACEOUT, \ ++ (void*)__FUNCTION__, \ ++ (int)(__LINE__), \ ++ (long)(p), \ ++ fmt, \ ++ ##arg); \ ++ } while (0) ++ ++ ++#define KCL_DEBUG1(m, fmt, arg...) \ ++ do \ ++ { \ ++ KCL_DEBUG_Print_Trace(m, \ ++ FN_DEBUG_LEVEL1, \ ++ (void*)__FUNCTION__, \ ++ (int)(__LINE__), \ ++ 0, \ ++ fmt, \ ++ ##arg); \ ++ } while (0) ++ ++#define KCL_DEBUG2(m, fmt, arg...) \ ++ do \ ++ { \ ++ KCL_DEBUG_Print_Trace(m, \ ++ FN_DEBUG_LEVEL2, \ ++ (void*)__FUNCTION__, \ ++ (int)(__LINE__), \ ++ 0, \ ++ fmt, \ ++ ##arg); \ ++ } while (0) ++ ++#define KCL_DEBUG3(m, fmt, arg...) \ ++ do \ ++ { \ ++ KCL_DEBUG_Print_Trace(m, \ ++ FN_DEBUG_LEVEL3, \ ++ (void*)__FUNCTION__, \ ++ (int)(__LINE__), \ ++ 0, \ ++ fmt, \ ++ ##arg); \ ++ } while (0) ++ ++ ++#define KCL_DEBUG4(m, fmt, arg...) \ ++ do \ ++ { \ ++ KCL_DEBUG_Print_Trace(m, \ ++ FN_DEBUG_LEVEL4, \ ++ (void*)__FUNCTION__, \ ++ (int)(__LINE__), \ ++ 0, \ ++ fmt, \ ++ ##arg); \ ++ } while (0) ++ ++ ++#define KCL_DEBUG5(m, fmt, arg...) \ ++ do \ ++ { \ ++ KCL_DEBUG_Print_Trace(m, \ ++ FN_DEBUG_LEVEL5, \ ++ (void*)__FUNCTION__, \ ++ (int)(__LINE__), \ ++ 0, \ ++ fmt, \ ++ ##arg); \ ++ } while (0) ++ ++ ++#define KCL_DEBUG6(m, fmt, arg...) \ ++ do \ ++ { \ ++ KCL_DEBUG_Print_Trace(m, \ ++ FN_DEBUG_LEVEL6, \ ++ (void*)__FUNCTION__, \ ++ (int)(__LINE__), \ ++ 0, \ ++ fmt, \ ++ ##arg); \ + } while (0) + + #endif +diff -uNr 15.12/common/lib/modules/fglrx//build_mod/kcl_str.c 15.12b/common/lib/modules/fglrx//build_mod/kcl_str.c +--- 15.12/common/lib/modules/fglrx//build_mod/kcl_str.c 2015-09-09 00:57:14.000000000 +0200 ++++ 15.12b/common/lib/modules/fglrx//build_mod/kcl_str.c 2015-11-21 00:35:38.000000000 +0100 +@@ -42,6 +42,10 @@ + #include "kcl_type.h" + #include "kcl_str.h" + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 20, 0) ++#define strnicmp strncasecmp ++#endif ++ + /** \brief Fill memory with a constant byte + * \param s Pointer to memory + * \param c Initializing value diff --git a/srcpkgs/catalyst/files/4.3-gentoo-mtrr.patch b/srcpkgs/catalyst/files/4.3-gentoo-mtrr.patch new file mode 100644 index 00000000000..86d7ffc3cc2 --- /dev/null +++ b/srcpkgs/catalyst/files/4.3-gentoo-mtrr.patch @@ -0,0 +1,27 @@ +--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-09 00:57:14.000000000 +0200 ++++ 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-03 19:00:09.121884973 +0100 +@@ -3412,7 +3412,11 @@ + int ATI_API_CALL KCL_MEM_MTRR_AddRegionWc(unsigned long base, unsigned long size) + { + #ifdef CONFIG_MTRR ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) ++ return arch_phys_wc_add(base, size); ++#else + return mtrr_add(base, size, MTRR_TYPE_WRCOMB, 1); ++#endif + #else /* !CONFIG_MTRR */ + return -EPERM; + #endif /* !CONFIG_MTRR */ +@@ -3421,7 +3425,12 @@ + int ATI_API_CALL KCL_MEM_MTRR_DeleteRegion(int reg, unsigned long base, unsigned long size) + { + #ifdef CONFIG_MTRR ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) ++ arch_phys_wc_del(reg); ++ return reg; ++#else + return mtrr_del(reg, base, size); ++#endif + #else /* !CONFIG_MTRR */ + return -EPERM; + #endif /* !CONFIG_MTRR */ diff --git a/srcpkgs/catalyst/files/4.3-kolasa-seq_printf.patch b/srcpkgs/catalyst/files/4.3-kolasa-seq_printf.patch new file mode 100644 index 00000000000..6cd08a93aca --- /dev/null +++ b/srcpkgs/catalyst/files/4.3-kolasa-seq_printf.patch @@ -0,0 +1,16 @@ +--- 15.9/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-09-09 00:57:14.000000000 +0200 ++++ 15.9b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-02 21:02:06.124639919 +0100 +@@ -623,8 +623,13 @@ + + len = snprintf(buf, request, "%d\n", major); + #else ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0) ++ seq_printf(m, "%d\n", major); ++ len = 0; ++#else + len = seq_printf(m, "%d\n", major); + #endif ++#endif + + KCL_DEBUG1(FN_FIREGL_PROC, "return len=%i\n",len); + diff --git a/srcpkgs/catalyst/files/4.4-manjaro-xstate.patch b/srcpkgs/catalyst/files/4.4-manjaro-xstate.patch new file mode 100644 index 00000000000..c221952d5ec --- /dev/null +++ b/srcpkgs/catalyst/files/4.4-manjaro-xstate.patch @@ -0,0 +1,22 @@ +--- 15.12/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-12-18 19:47:41.000000000 +0100 ++++ 15.12b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-12-19 20:48:13.223261632 +0100 +@@ -6450,12 +6450,15 @@ + 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 ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) ++ copy_xregs_to_kernel(&fpu->state.xsave); ++ if (!(fpu->state.xsave.header.xfeatures & XFEATURE_MASK_FP)) ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) + copy_xregs_to_kernel(&fpu->state.xsave); + if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP)) ++#else ++ fpu_xsave(fpu); ++ if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP)) + #endif + return 1; + } else if (static_cpu_has(X86_FEATURE_FXSR)) { diff --git a/srcpkgs/catalyst/files/crimson_i686_xg.patch b/srcpkgs/catalyst/files/crimson_i686_xg.patch new file mode 100644 index 00000000000..e3ce379f33d --- /dev/null +++ b/srcpkgs/catalyst/files/crimson_i686_xg.patch @@ -0,0 +1,12 @@ +--- 15.11/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-21 00:35:38.000000000 +0100 ++++ 15.11b/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-11-24 22:28:02.113843493 +0100 +@@ -1714,6 +1714,9 @@ + + #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) diff --git a/srcpkgs/catalyst/files/grsec_arch.patch b/srcpkgs/catalyst/files/grsec_arch.patch new file mode 100644 index 00000000000..323e44fd02f --- /dev/null +++ b/srcpkgs/catalyst/files/grsec_arch.patch @@ -0,0 +1,77 @@ +diff -uNr 15.12/common/lib/modules/fglrx//build_mod/firegl_public.c 15.12b/common/lib/modules/fglrx//build_mod/firegl_public.c +--- 15.12/common/lib/modules/fglrx//build_mod/firegl_public.c 2015-12-19 21:14:13.251002548 +0100 ++++ 15.12b/common/lib/modules/fglrx//build_mod/firegl_public.c 2015-12-19 21:36:27.703783498 +0100 +@@ -6465,11 +6465,21 @@ + + if(static_cpu_has(X86_FEATURE_XSAVE)) { + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,0) ++#ifdef CONFIG_GRKERNSEC ++ copy_xregs_to_kernel(&fpu->state->xsave); ++ if (!(fpu->state->xsave.header.xfeatures & XFEATURE_MASK_FP)) ++#else + copy_xregs_to_kernel(&fpu->state.xsave); + if (!(fpu->state.xsave.header.xfeatures & XFEATURE_MASK_FP)) ++#endif + #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ++#ifdef CONFIG_GRKERNSEC ++ copy_xregs_to_kernel(&fpu->state->xsave); ++ if (!(fpu->state->xsave.header.xfeatures & XSTATE_FP)) ++#else + copy_xregs_to_kernel(&fpu->state.xsave); + if (!(fpu->state.xsave.header.xfeatures & XSTATE_FP)) ++#endif + #else + fpu_xsave(fpu); + if (!(fpu->state->xsave.xsave_hdr.xstate_bv & XSTATE_FP)) +@@ -6486,8 +6496,12 @@ + #if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0) + : [fx] "=m" (fpu->state->fsave)); + #else ++#ifdef CONFIG_GRKERNSEC ++ : [fx] "=m" (fpu->state->fsave)); ++#else + : [fx] "=m" (fpu->state.fsave)); + #endif ++#endif + return 0; + } + +diff -uNr 15.12/common/lib/modules/fglrx//build_mod/kcl_acpi.c 15.12b/common/lib/modules/fglrx//build_mod/kcl_acpi.c +--- 15.12/common/lib/modules/fglrx//build_mod/kcl_acpi.c 2015-12-19 21:14:13.247669219 +0100 ++++ 15.12b/common/lib/modules/fglrx//build_mod/kcl_acpi.c 2015-12-19 21:10:27.224899708 +0100 +@@ -145,7 +145,11 @@ + return NOTIFY_OK; + } + ++#ifdef CONFIG_GRKERNSEC ++static notifier_block_no_const firegl_acpi_lid_notifier = { ++#else + static struct notifier_block firegl_acpi_lid_notifier = { ++#endif + .notifier_call = firegl_acpi_lid_event, + }; + #endif +@@ -400,7 +404,11 @@ + KCL_DEBUG_ERROR ("Could not allocate enough memory for video notifier_block\n"); + return -ENOMEM; + } ++#ifdef CONFIG_GRKERNSEC ++ ((notifier_block_no_const*)(*nb))->notifier_call = firegl_acpi_video_event; ++#else + ((struct notifier_block*)(*nb))->notifier_call = firegl_acpi_video_event; ++#endif + return register_acpi_notifier((struct notifier_block*)(*nb)); + } + +@@ -413,7 +421,11 @@ + KCL_DEBUG_ERROR ("Could not allocate enough memory for ac notifier_block\n"); + return -ENOMEM; + } ++#ifdef CONFIG_GRKERNSEC ++ ((notifier_block_no_const*)(*nb))->notifier_call = firegl_acpi_ac_event; ++#else + ((struct notifier_block*)(*nb))->notifier_call = firegl_acpi_ac_event; ++#endif + return register_acpi_notifier((struct notifier_block*)(*nb)); + } + diff --git a/srcpkgs/catalyst/files/kolasa_4.1_remove-IRQF_DISABLED.patch b/srcpkgs/catalyst/files/kolasa_4.1_remove-IRQF_DISABLED.patch deleted file mode 100644 index 176359a9484..00000000000 --- a/srcpkgs/catalyst/files/kolasa_4.1_remove-IRQF_DISABLED.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- 15.7/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-07-04 16:31:23.000000000 +0200 -+++ 15.7a/common/lib/modules/fglrx/build_mod/firegl_public.c 2015-07-09 17:40:58.611608136 +0200 -@@ -3498,7 +3498,11 @@ - #else - //when MSI enabled. keep irq disabled when calling the action handler, - //exclude this IRQ from irq balancing (only on one CPU) -- ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)), -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) -+ ((useMSI) ? (IRQF_NOBALANCING) : (IRQF_SHARED)), -+#else -+ ((useMSI) ? (IRQF_DISABLED) : (IRQF_SHARED)), -+#endif - #endif - dev_name, - context); diff --git a/srcpkgs/catalyst/files/lano1106_fglrx_intel_iommu.patch b/srcpkgs/catalyst/files/lano1106_fglrx_intel_iommu.patch new file mode 100644 index 00000000000..101654c41c6 --- /dev/null +++ b/srcpkgs/catalyst/files/lano1106_fglrx_intel_iommu.patch @@ -0,0 +1,11 @@ +--- 13.4/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-04-16 23:29:55.000000000 +0200 ++++ 13.4/common/lib/modules/fglrx/build_mod/firegl_public.c 2013-05-21 17:05:34.726681102 +0200 +@@ -93,7 +93,7 @@ + and they use different config options. These options can only be enabled + on x86_64 with newer 2.6 kernels (2.6.23 for intel, 2.6.26 for amd). + */ +-#if defined(CONFIG_AMD_IOMMU) || defined(CONFIG_DMAR) ++#if defined(CONFIG_AMD_IOMMU) || defined(CONFIG_INTEL_IOMMU) + #define FIREGL_DMA_REMAPPING + #endif + diff --git a/srcpkgs/catalyst/files/lano1106_kcl_agp_13_4.patch b/srcpkgs/catalyst/files/lano1106_kcl_agp_13_4.patch new file mode 100644 index 00000000000..d39c5aaeb10 --- /dev/null +++ b/srcpkgs/catalyst/files/lano1106_kcl_agp_13_4.patch @@ -0,0 +1,90 @@ +--- 13.4/common/lib/modules/fglrx/build_mod/kcl_agp.c 2013-05-24 16:45:52.236740084 -0400 ++++ 13.4/common/lib/modules/fglrx/build_mod/kcl_agp.c 2013-05-24 16:49:29.283579408 -0400 +@@ -56,6 +56,43 @@ unsigned int KCL_AGP_IsInUse(void) + return kcl_agp_is_in_use; + } + ++/** \brief Find AGP caps registers in PCI config space ++ ** \param dev PCI device handle ++ ** \return Positive register index on success, negative errno on error ++ */ ++int ATI_API_CALL KCL_AGP_FindCapsRegisters(KCL_PCI_DevHandle dev) ++{ ++ u8 capndx; ++ u32 cap_id; ++ ++ if (!dev) ++ { ++ return -ENODEV; ++ } ++ ++ pci_read_config_byte((struct pci_dev*)dev, 0x34, &capndx); ++ ++ if (capndx == 0x00) ++ { ++ return -ENODATA; ++ } ++ ++ do ++ { // search capability list for AGP caps ++ pci_read_config_dword((struct pci_dev*)dev, capndx, &cap_id); ++ ++ if ((cap_id & 0xff) == 0x02) ++ { ++ return capndx; ++ } ++ ++ capndx = (cap_id >> 8) & 0xff; ++ } ++ while (capndx != 0x00); ++ ++ return -ENODATA; ++} ++ + #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) + + typedef struct { +@@ -272,43 +309,6 @@ int ATI_API_CALL KCL_AGP_Enable(unsigned + } + } + +-/** \brief Find AGP caps registers in PCI config space +- ** \param dev PCI device handle +- ** \return Positive register index on success, negative errno on error +- */ +-int ATI_API_CALL KCL_AGP_FindCapsRegisters(KCL_PCI_DevHandle dev) +-{ +- u8 capndx; +- u32 cap_id; +- +- if (!dev) +- { +- return -ENODEV; +- } +- +- pci_read_config_byte((struct pci_dev*)dev, 0x34, &capndx); +- +- if (capndx == 0x00) +- { +- return -ENODATA; +- } +- +- do +- { // search capability list for AGP caps +- pci_read_config_dword((struct pci_dev*)dev, capndx, &cap_id); +- +- if ((cap_id & 0xff) == 0x02) +- { +- return capndx; +- } +- +- capndx = (cap_id >> 8) & 0xff; +- } +- while (capndx != 0x00); +- +- return -ENODATA; +-} +- + /** \brief Get AGP caps + ** \param dev PCI device handle + ** \param caps pointer to caps vector diff --git a/srcpkgs/catalyst/files/linux-4.0.patch b/srcpkgs/catalyst/files/linux-4.0.patch deleted file mode 100644 index 2b77927b860..00000000000 --- a/srcpkgs/catalyst/files/linux-4.0.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- 14.12/common/lib/modules/fglrx/build_mod/kcl_str.c 2014-11-28 21:02:10.000000000 +0100 -+++ 14.12_2/common/lib/modules/fglrx/build_mod/kcl_str.c 2015-03-08 13:25:11.568396701 +0100 -@@ -169,7 +169,11 @@ - const char* s2, - KCL_TYPE_SizeSigned count) - { -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) - return strnicmp(s1, s2, count); -+#else -+ return strncasecmp(s1, s2, count); -+#endif - } - - /** \brief Locate character in string - diff --git a/srcpkgs/catalyst/files/linux-4.2.patch b/srcpkgs/catalyst/files/linux-4.2.patch deleted file mode 100644 index 95bcc10d6ba..00000000000 --- a/srcpkgs/catalyst/files/linux-4.2.patch +++ /dev/null @@ -1,73 +0,0 @@ -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 7ceea781aca..33567f9c155 100644 --- a/srcpkgs/catalyst/template +++ b/srcpkgs/catalyst/template @@ -4,7 +4,7 @@ _release="15.9" pkgname=catalyst version=15.201.1151 -revision=5 +revision=6 maintainer="Juan RP " license="Proprietary AMD license" homepage="http://www.amd.com" @@ -35,10 +35,15 @@ do_build() { /bin/sh ./*.run --extract fglrx-${version} cd fglrx-${version} - patch -Np1 -i ${FILESDIR}/linux-4.0.patch - patch -Np1 -i ${FILESDIR}/kolasa_4.1_remove-IRQF_DISABLED.patch + patch -Np1 -i ${FILESDIR}/lano1106_fglrx_intel_iommu.patch + patch -Np1 -i ${FILESDIR}/lano1106_kcl_agp_13_4.patch + patch -Np1 -i ${FILESDIR}/4.2-amd-from_crimson_15.11.patch + patch -Np1 -i ${FILESDIR}/4.3-kolasa-seq_printf.patch + patch -Np1 -i ${FILESDIR}/4.3-gentoo-mtrr.patch patch -Np1 -i ${FILESDIR}/fglrx_gpl_symbol.patch - patch -Np1 -i ${FILESDIR}/linux-4.2.patch + [ "$XBPS_MACHINE" = "i686" ] && patch -Np1 -i ${FILESDIR}/crimson_i686_xg.patch + patch -Np1 -i ${FILESDIR}/4.4-manjaro-xstate.patch + patch -Np1 -i ${FILESDIR}/grsec_arch.patch } do_install() { cd fglrx-${version} @@ -48,7 +53,7 @@ do_install() { install -dm755 ${DESTDIR}/usr/include/GL install -dm755 ${DESTDIR}/etc/{ati,acpi/events,security/console.apps} install -dm755 ${DESTDIR}/usr/share/{applications,ati/amdcccle,man/man8,pixmaps} - + # binaries install -m755 common/usr/sbin/* ${DESTDIR}/usr/bin/ install -m755 common/usr/X11R6/bin/* ${DESTDIR}/usr/bin/ @@ -88,7 +93,7 @@ do_install() { ln -s libfglrx_dm.so.1.0 ${DESTDIR}/usr/lib/libfglrx_dm.so.1 popd - # various files + # various files install -m644 common/usr/share/man/man8/* ${DESTDIR}/usr/share/man/man8/ install -m644 common/usr/share/applications/* ${DESTDIR}/usr/share/applications/ install -m644 common/usr/share/icons/* ${DESTDIR}/usr/share/pixmaps/