Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 613884 | Differences between
and this patch

Collapse All | Expand All

(-)work.orig/kernel/nv-linux.h (+7 lines)
Lines 2082-2087 Link Here
2082
 *    2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
2082
 *    2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99
2083
 */
2083
 */
2084
2084
2085
#include <linux/version.h>
2086
2085
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
2087
#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT)
2086
    #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
2088
    #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS)
2087
        #define NV_GET_USER_PAGES           get_user_pages
2089
        #define NV_GET_USER_PAGES           get_user_pages
Lines 2129-2137 Link Here
2129
2131
2130
        #else
2132
        #else
2131
2133
2134
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
2132
               return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
2135
               return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
2133
                                            pages, vmas);
2136
                                            pages, vmas);
2134
2137
2138
#else
2139
               return get_user_pages_remote(tsk, mm, start, nr_pages, flags,
2140
                                            pages, vmas, NULL);
2141
#endif
2135
        #endif
2142
        #endif
2136
2143
2137
        }
2144
        }
(-)work.orig/kernel/nv-p2p.c (-5 / +5 lines)
Lines 112-118 Link Here
112
int nvidia_p2p_get_pages(
112
int nvidia_p2p_get_pages(
113
    uint64_t p2p_token,
113
    uint64_t p2p_token,
114
    uint32_t va_space,
114
    uint32_t va_space,
115
    uint64_t virtual_address,
115
    uint64_t address,
116
    uint64_t length,
116
    uint64_t length,
117
    struct nvidia_p2p_page_table **page_table,
117
    struct nvidia_p2p_page_table **page_table,
118
    void (*free_callback)(void * data),
118
    void (*free_callback)(void * data),
Lines 136-142 Link Here
136
        return -ENOMEM;
136
        return -ENOMEM;
137
137
138
    status = rm_p2p_get_pages(sp, p2p_token, va_space,
138
    status = rm_p2p_get_pages(sp, p2p_token, va_space,
139
            virtual_address, length, &physical_addresses, &wreqmb_h,
139
            address, length, &physical_addresses, &wreqmb_h,
140
            &rreqmb_h, &entries, *page_table,
140
            &rreqmb_h, &entries, *page_table,
141
            free_callback, data);
141
            free_callback, data);
142
    if (status != RM_OK)
142
    if (status != RM_OK)
Lines 195-201 Link Here
195
                nvidia_p2p_page_t_cache);
195
                nvidia_p2p_page_t_cache);
196
    }
196
    }
197
197
198
    rm_p2p_put_pages(sp, p2p_token, va_space, virtual_address,
198
    rm_p2p_put_pages(sp, p2p_token, va_space, address,
199
            *page_table);
199
            *page_table);
200
200
201
    os_free_mem((*page_table)->pages);
201
    os_free_mem((*page_table)->pages);
Lines 232-238 Link Here
232
int nvidia_p2p_put_pages(
232
int nvidia_p2p_put_pages(
233
    uint64_t p2p_token,
233
    uint64_t p2p_token,
234
    uint32_t va_space,
234
    uint32_t va_space,
235
    uint64_t virtual_address,
235
    uint64_t address,
236
    struct nvidia_p2p_page_table *page_table
236
    struct nvidia_p2p_page_table *page_table
237
)
237
)
238
{
238
{
Lines 243-249 Link Here
243
    if (sp == NULL)
243
    if (sp == NULL)
244
        return -ENOMEM;
244
        return -ENOMEM;
245
245
246
    status = rm_p2p_put_pages(sp, p2p_token, va_space, virtual_address,
246
    status = rm_p2p_put_pages(sp, p2p_token, va_space, address,
247
            page_table);
247
            page_table);
248
    if (status == RM_OK)
248
    if (status == RM_OK)
249
        nvidia_p2p_free_page_table(page_table);
249
        nvidia_p2p_free_page_table(page_table);
(-)work.orig/kernel/nv-pat.c (+40 lines)
Lines 203-208 Link Here
203
}
203
}
204
204
205
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
205
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
206
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
206
static int
207
static int
207
nvidia_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
208
nvidia_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
208
{
209
{
Lines 234-239 Link Here
234
    .notifier_call = nvidia_cpu_callback,
235
    .notifier_call = nvidia_cpu_callback,
235
    .priority = 0
236
    .priority = 0
236
};
237
};
238
#else
239
static int nvidia_cpu_online(unsigned int hcpu)
240
{
241
    unsigned int cpu = get_cpu();
242
    if (cpu == hcpu)
243
        nv_setup_pat_entries(NULL);
244
    else
245
        NV_SMP_CALL_FUNCTION(nv_setup_pat_entries, (void *)(long int)hcpu, 1);
246
247
    put_cpu();
248
249
    return 0;
250
}
251
252
static int nvidia_cpu_down_prep(unsigned int hcpu)
253
{
254
    unsigned int cpu = get_cpu();
255
    if (cpu == hcpu)
256
        nv_restore_pat_entries(NULL);
257
    else
258
        NV_SMP_CALL_FUNCTION(nv_restore_pat_entries, (void *)(long int)hcpu, 1);
259
260
    put_cpu();
261
262
    return 0;
263
}
264
#endif
265
237
#endif
266
#endif
238
267
239
int nv_init_pat_support(nv_stack_t *sp)
268
int nv_init_pat_support(nv_stack_t *sp)
Lines 255-261 Link Here
255
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
284
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
256
        if (nv_pat_mode == NV_PAT_MODE_BUILTIN)
285
        if (nv_pat_mode == NV_PAT_MODE_BUILTIN)
257
        {
286
        {
287
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
258
            if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0)
288
            if (register_hotcpu_notifier(&nv_hotcpu_nfb) != 0)
289
#else
290
            if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
291
                                  "gpu/nvidia:online",
292
                                  nvidia_cpu_online,
293
                                  nvidia_cpu_down_prep) != 0)
294
#endif
259
            {
295
            {
260
                nv_disable_pat_support();
296
                nv_disable_pat_support();
261
                nv_printf(NV_DBG_ERRORS,
297
                nv_printf(NV_DBG_ERRORS,
Lines 280-286 Link Here
280
    {
316
    {
281
        nv_disable_pat_support();
317
        nv_disable_pat_support();
282
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
318
#if defined(NV_ENABLE_PAT_SUPPORT) && defined(NV_ENABLE_HOTPLUG_CPU)
319
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0)
283
        unregister_hotcpu_notifier(&nv_hotcpu_nfb);
320
        unregister_hotcpu_notifier(&nv_hotcpu_nfb);
321
#else
322
        cpuhp_remove_state_nocalls(CPUHP_AP_ONLINE_DYN);
323
#endif
284
#endif
324
#endif
285
    }
325
    }
286
}
326
}

Return to bug 613884