]> git.pld-linux.org Git - packages/xorg-driver-video-nvidia-legacy-304xx.git/blob - linux-4.11.patch
a6317c24a07f17d9ae3180f16fa106e33a43fab9
[packages/xorg-driver-video-nvidia-legacy-304xx.git] / linux-4.11.patch
1 --- kernel/nv-linux.h\r
2 +++ kernel/nv-linux.h\r
3 @@ -2082,6 +2082,8 @@ static inline NvU64 nv_node_end_pfn(int nid)\r
4   *    2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99\r
5   */\r
6 \r
7 +#include <linux/version.h>\r
8 +\r
9  #if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)\r
10      #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)\r
11          #define NV_GET_USER_PAGES           get_user_pages\r
12 @@ -2129,8 +2131,13 @@ static inline NvU64 nv_node_end_pfn(int nid)\r
13 \r
14          #else\r
15 \r
16 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
17                 return get_user_pages_remote(tsk, mm, start, nr_pages, flags,\r
18                                              pages, vmas);\r
19 +#else\r
20 +               return get_user_pages_remote(tsk, mm, start, nr_pages, flags,\r
21 +                                            pages, vmas, NULL);\r
22 +#endif\r
23 \r
24          #endif\r
25 \r
26 --- kernel/nv-pat.c\r
27 +++ kernel/nv-pat.c\r
28 @@ -203,6 +203,7 @@ void nv_disable_pat_support(void)\r
29  }\r
30 \r
31  #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)\r
32 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
33  static int\r
34  nvidia_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)\r
35  {\r
36 @@ -234,6 +235,34 @@ static struct notifier_block nv_hotcpu_nfb = {\r
37      .notifier_call = nvidia_cpu_callback,\r
38      .priority = 0\r
39  };\r
40 +#else\r
41 +static int nvidia_cpu_online(unsigned int hcpu)\r
42 +{\r
43 +    unsigned int cpu = get_cpu();\r
44 +    if (cpu == hcpu)\r
45 +        nv_setup_pat_entries(NULL);\r
46 +    else\r
47 +        NV_SMP_CALL_FUNCTION(nv_setup_pat_entries, (void *)(long int)hcpu, 1);\r
48 +\r
49 +    put_cpu();\r
50 +\r
51 +    return 0;\r
52 +}\r
53 +\r
54 +static int nvidia_cpu_down_prep(unsigned int hcpu)\r
55 +{\r
56 +    unsigned int cpu = get_cpu();\r
57 +    if (cpu == hcpu)\r
58 +        nv_restore_pat_entries(NULL);\r
59 +    else\r
60 +        NV_SMP_CALL_FUNCTION(nv_restore_pat_entries, (void *)(long int)hcpu, 1);\r
61 +\r
62 +    put_cpu();\r
63 +\r
64 +    return 0;\r
65 +}\r
66 +#endif\r
67 +\r
68  #endif\r
69 \r
70  int nv_init_pat_support(nv_stack_t *sp)\r
71 @@ -255,7 +284,14 @@ int nv_init_pat_support(nv_stack_t *sp)\r
72  #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)\r
73          if (nv_pat_mode == NV_PAT_MODE_BUILTIN)\r
74          {\r
75 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
76              if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0)\r
77 +#else\r
78 +            if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,\r
79 +                                  "gpu/nvidia:online",\r
80 +                                  nvidia_cpu_online,\r
81 +                                  nvidia_cpu_down_prep) != 0)\r
82 +#endif\r
83              {\r
84                  nv_disable_pat_support();\r
85                  nv_printf(NV_DBG_ERRORS,\r
86 @@ -280,7 +316,11 @@ void nv_teardown_pat_support(void)\r
87      {\r
88          nv_disable_pat_support();\r
89  #if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)\r
90 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
91          unregister_hotcpu_notifier(&nv_hotcpu_nfb);\r
92 +#else\r
93 +        cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN);\r
94 +#endif\r
95  #endif\r
96      }\r
97  }\r
98 --- kernel/nv-drm.c     2017-03-31 03:42:21.000000000 +0200\r
99 +++ kernel/nv-drm.c     2017-04-06 23:53:14.273356795 +0200\r
100 @@ -48,7 +48,11 @@\r
101      return -ENODEV;\r
102  }\r
103 \r
104 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
105  static int nv_drm_unload(\r
106 +#else\r
107 +static void nv_drm_unload(\r
108 +#endif\r
109      struct drm_device *dev\r
110  )\r
111  {\r
112 @@ -60,7 +60,11 @@\r
113      {\r
114          if (nvl->dev == dev->pdev)\r
115          {\r
116 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
117              return 0;\r
118 +#else\r
119 +            return;\r
120 +#endif\r
121          }\r
122      }\r
123  \r
124 @@ -64,7 +64,11 @@\r
125          }\r
126      }\r
127 \r
128 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)\r
129      return -ENODEV;\r
130 +#else\r
131 +    return;\r
132 +#endif\r
133  }\r
134 \r
135  static void nv_gem_free(\r
This page took 0.054701 seconds and 3 git commands to generate.