Advertisement
Guest User

fglrx linux 4.12 patch

a guest
Jul 29th, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.98 KB | None | 0 0
  1. diff --git archive_files/common/lib/modules/fglrx/build_mod/firegl_public.c archive_files/common/lib/modules/fglrx/build_mod/firegl_public.c
  2. index b2c9e7c..2e9a112 100755
  3. --- archive_files/common/lib/modules/fglrx/build_mod/firegl_public.c
  4. +++ archive_files/common/lib/modules/fglrx/build_mod/firegl_public.c
  5. @@ -208,6 +208,10 @@
  6.  #include <linux/sched/signal.h>
  7.  #endif
  8.  
  9. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  10. +#include <asm/set_memory.h>
  11. +#endif
  12. +
  13.  #include "firegl_public.h"
  14.  #include "kcl_osconfig.h"
  15.  #include "kcl_io.h"
  16. @@ -2752,6 +2756,9 @@ int ATI_API_CALL KCL_MEM_VerifyWriteAccess(void* addr, kcl_size_t size)
  17.  unsigned long ATI_API_CALL KCL_GetInitKerPte(unsigned long address)
  18.  {
  19.      pgd_t *pgd_p;
  20. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  21. +    p4d_t *p4d_p;
  22. +#endif
  23.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  24.      pud_t *pud_p;
  25.  #endif
  26. @@ -2766,7 +2773,13 @@ unsigned long ATI_API_CALL KCL_GetInitKerPte(unsigned long address)
  27.  #endif
  28.      PGD_PRESENT(pgd_p);
  29.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  30. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  31. +    P4D_OFFSET(p4d_p, pgd_p, address);
  32. +    P4D_PRESENT(p4d_p);
  33. +    PUD_OFFSET(pud_p, p4d_p, address);
  34. +#else
  35.      PUD_OFFSET(pud_p, pgd_p, address);
  36. +#endif
  37.      PUD_PRESENT(pud_p);
  38.      PMD_OFFSET(pmd_p, pud_p, address);
  39.  #else
  40. @@ -2823,6 +2836,9 @@ unsigned long ATI_API_CALL KCL_GetPageTableByVirtAddr(
  41.          unsigned long * page_addr)
  42.  {
  43.      pgd_t* pgd_p;
  44. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  45. +    p4d_t *p4d_p;
  46. +#endif
  47.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  48.      pud_t* pud_p;
  49.  #endif
  50. @@ -2835,7 +2851,13 @@ unsigned long ATI_API_CALL KCL_GetPageTableByVirtAddr(
  51.      KCL_DEBUG2(FN_FIREGL_KCL,"pgd_p=0x%08lx\n", (unsigned long)pgd_p);
  52.  
  53.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  54. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  55. +    P4D_OFFSET(p4d_p, pgd_p, virtual_addr);
  56. +    P4D_PRESENT(p4d_p);
  57. +    PUD_OFFSET(pud_p, p4d_p, virtual_addr);
  58. +#else
  59.      PUD_OFFSET(pud_p, pgd_p, virtual_addr);
  60. +#endif
  61.      PUD_PRESENT(pud_p);
  62.      KCL_DEBUG2(FN_FIREGL_KCL,"pud_p=0x%08lx\n", (unsigned long)pud_p);
  63.      PMD_OFFSET(pmd_p, pud_p, virtual_addr);
  64. @@ -2892,6 +2914,9 @@ unsigned int ATI_API_CALL KCL_GetPageSizeByVirtAddr(
  65.          unsigned int  * page_size)
  66.  {
  67.      pgd_t* pgd_p;
  68. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  69. +    p4d_t *p4d_p;
  70. +#endif
  71.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  72.      pud_t* pud_p;
  73.  #endif
  74. @@ -2904,7 +2929,13 @@ unsigned int ATI_API_CALL KCL_GetPageSizeByVirtAddr(
  75.      KCL_DEBUG2(FN_FIREGL_KCL,"pgd_p=0x%08lx\n", (unsigned long)pgd_p);
  76.  
  77.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  78. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  79. +    P4D_OFFSET(p4d_p, pgd_p, virtual_addr);
  80. +    P4D_PRESENT(p4d_p);
  81. +    PUD_OFFSET(pud_p, p4d_p, virtual_addr);
  82. +#else
  83.      PUD_OFFSET(pud_p, pgd_p, virtual_addr);
  84. +#endif
  85.      PUD_PRESENT(pud_p);
  86.      KCL_DEBUG2(FN_FIREGL_KCL,"pud_p=0x%08lx\n", (unsigned long)pud_p);
  87.      PMD_OFFSET(pmd_p, pud_p, virtual_addr);
  88. @@ -3083,6 +3114,9 @@ int ATI_API_CALL KCL_TestAndClearPageDirtyFlag(unsigned long virtual_addr, unsig
  89.  {
  90.      int ret = -1; // init with page not present
  91.      pgd_t* pgd_p;
  92. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  93. +    p4d_t *p4d_p;
  94. +#endif
  95.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  96.      pud_t* pud_p;
  97.  #endif
  98. @@ -3135,7 +3169,16 @@ int ATI_API_CALL KCL_TestAndClearPageDirtyFlag(unsigned long virtual_addr, unsig
  99.           KCL_DEBUG1(FN_FIREGL_KCL,"pgd_p=0x%08lx\n", (unsigned long)pgd_p);
  100.  
  101.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  102. -         PUD_OFFSET(pud_p, pgd_p, page_addr);
  103. +        #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  104. +        P4D_OFFSET(p4d_p, pgd_p, page_addr);
  105. +        if (!p4d_present(*p4d_p)) {
  106. +            KCL_DEBUG1(FN_FIREGL_KCL,"ERROR: !p4d_present\n");
  107. +            continue;
  108. +        }
  109. +        PUD_OFFSET(pud_p, p4d_p, page_addr);
  110. +        #else
  111. +        PUD_OFFSET(pud_p, pgd_p, page_addr);
  112. +        #endif
  113.           if (!pud_present(*pud_p))
  114.           {
  115.               KCL_DEBUG1(FN_FIREGL_KCL,"ERROR: !pud_present\n");
  116. @@ -4077,6 +4120,9 @@ char* ATI_API_CALL KCL_MEM_VM_GetRegionPhysAddrStr(struct vm_area_struct* vma,
  117.                              kcl_dma_addr_t* phys_address)
  118.  {
  119.      pgd_t* pgd_p;
  120. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  121. +    p4d_t *p4d_p;
  122. +#endif
  123.      pmd_t* pmd_p;
  124.      pte_t  pte;
  125.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  126. @@ -4090,7 +4136,17 @@ char* ATI_API_CALL KCL_MEM_VM_GetRegionPhysAddrStr(struct vm_area_struct* vma,
  127.          return buf;
  128.      }
  129.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  130. +    #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  131. +    p4d_p = p4d_offset(pgd_p, virtual_addr);
  132. +    if (!p4d_present(*p4d_p))
  133. +    {
  134. +        *buf = 0;
  135. +        return buf;
  136. +    }
  137. +    pud_p = pud_offset(p4d_p, virtual_addr);
  138. +    #else
  139.      pud_p = pud_offset(pgd_p, virtual_addr);
  140. +    #endif
  141.      if (!pud_present(*pud_p))
  142.      {
  143.          *buf = 0;
  144. diff --git archive_files/common/lib/modules/fglrx/build_mod/firegl_public.h archive_files/common/lib/modules/fglrx/build_mod/firegl_public.h
  145. index 14e25f9..aca2940 100755
  146. --- archive_files/common/lib/modules/fglrx/build_mod/firegl_public.h
  147. +++ archive_files/common/lib/modules/fglrx/build_mod/firegl_public.h
  148. @@ -91,6 +91,23 @@ do { \
  149.      } \
  150.  } while(0)
  151.  
  152. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  153. +#define P4D_OFFSET(p4d_p, pgd_p, pte_linear)  \
  154. +do { \
  155. +    p4d_p = p4d_offset(pgd_p, pte_linear); \
  156. +} while(0)
  157. +
  158. +#define P4D_PRESENT(p4d_p) \
  159. +do { \
  160. +    if (!p4d_present(*(p4d_p))) \
  161. +    { \
  162. +        return PAGING_FAULT_SIGBUS_INT;   /* Something bad happened; generate SIGBUS */ \
  163. +        /* alternatively we could generate a NOPAGE_OOM "out of memory" */ \
  164. +    } \
  165. +} while(0)
  166. +
  167. +#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)
  168. +
  169.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11)
  170.  #define PUD_PRESENT(pud_p) \
  171.  do { \
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement