Deleted Added
full compact
ttm_page_alloc.c (256281) ttm_page_alloc.c (275408)
1/*
2 * Copyright (c) Red Hat Inc.
3
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 25 unchanged lines hidden (view full) ---

34
35/* simple list based uncached page pool
36 * - Pool collects resently freed pages for reuse
37 * - Use page->lru to keep a free list
38 * - doesn't track currently in use pages
39 */
40
41#include <sys/cdefs.h>
1/*
2 * Copyright (c) Red Hat Inc.
3
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
8 * and/or sell copies of the Software, and to permit persons to whom the

--- 25 unchanged lines hidden (view full) ---

34
35/* simple list based uncached page pool
36 * - Pool collects resently freed pages for reuse
37 * - Use page->lru to keep a free list
38 * - doesn't track currently in use pages
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: stable/10/sys/dev/drm2/ttm/ttm_page_alloc.c 254879 2013-08-25 15:33:17Z dumbbell $");
42__FBSDID("$FreeBSD: stable/10/sys/dev/drm2/ttm/ttm_page_alloc.c 275408 2014-12-02 14:09:54Z tijl $");
43
44#include <dev/drm2/drmP.h>
45#include <dev/drm2/ttm/ttm_bo_driver.h>
46#include <dev/drm2/ttm/ttm_page_alloc.h>
47
43
44#include <dev/drm2/drmP.h>
45#include <dev/drm2/ttm/ttm_bo_driver.h>
46#include <dev/drm2/ttm/ttm_page_alloc.h>
47
48#ifdef TTM_HAS_AGP
49#include <asm/agp.h>
50#endif
51
52#define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(vm_page_t))
53#define SMALL_ALLOCATION 16
54#define FREE_ALL_PAGES (~0U)
55/* times are in msecs */
56#define PAGE_FREE_INTERVAL 1000
57
58/**
59 * struct ttm_page_pool - Pool to reuse recently allocated uc/wc pages.

--- 155 unchanged lines hidden (view full) ---

215 return snprintf(buffer, PAGE_SIZE, "%u\n", val);
216}
217#endif
218
219static struct ttm_pool_manager *_manager;
220
221static int set_pages_array_wb(vm_page_t *pages, int addrinarray)
222{
48#define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(vm_page_t))
49#define SMALL_ALLOCATION 16
50#define FREE_ALL_PAGES (~0U)
51/* times are in msecs */
52#define PAGE_FREE_INTERVAL 1000
53
54/**
55 * struct ttm_page_pool - Pool to reuse recently allocated uc/wc pages.

--- 155 unchanged lines hidden (view full) ---

211 return snprintf(buffer, PAGE_SIZE, "%u\n", val);
212}
213#endif
214
215static struct ttm_pool_manager *_manager;
216
217static int set_pages_array_wb(vm_page_t *pages, int addrinarray)
218{
223 vm_page_t m;
219#ifdef TTM_HAS_AGP
224 int i;
225
220 int i;
221
226 for (i = 0; i < addrinarray; i++) {
227 m = pages[i];
228#ifdef TTM_HAS_AGP
229 unmap_page_from_agp(m);
222 for (i = 0; i < addrinarray; i++)
223 pmap_page_set_memattr(pages[i], VM_MEMATTR_WRITE_BACK);
230#endif
224#endif
231 pmap_page_set_memattr(m, VM_MEMATTR_WRITE_BACK);
232 }
233 return 0;
234}
235
236static int set_pages_array_wc(vm_page_t *pages, int addrinarray)
237{
225 return 0;
226}
227
228static int set_pages_array_wc(vm_page_t *pages, int addrinarray)
229{
238 vm_page_t m;
230#ifdef TTM_HAS_AGP
239 int i;
240
231 int i;
232
241 for (i = 0; i < addrinarray; i++) {
242 m = pages[i];
243#ifdef TTM_HAS_AGP
244 map_page_into_agp(pages[i]);
233 for (i = 0; i < addrinarray; i++)
234 pmap_page_set_memattr(pages[i], VM_MEMATTR_WRITE_COMBINING);
245#endif
235#endif
246 pmap_page_set_memattr(m, VM_MEMATTR_WRITE_COMBINING);
247 }
248 return 0;
249}
250
251static int set_pages_array_uc(vm_page_t *pages, int addrinarray)
252{
236 return 0;
237}
238
239static int set_pages_array_uc(vm_page_t *pages, int addrinarray)
240{
253 vm_page_t m;
241#ifdef TTM_HAS_AGP
254 int i;
255
242 int i;
243
256 for (i = 0; i < addrinarray; i++) {
257 m = pages[i];
258#ifdef TTM_HAS_AGP
259 map_page_into_agp(pages[i]);
244 for (i = 0; i < addrinarray; i++)
245 pmap_page_set_memattr(pages[i], VM_MEMATTR_UNCACHEABLE);
260#endif
246#endif
261 pmap_page_set_memattr(m, VM_MEMATTR_UNCACHEABLE);
262 }
263 return 0;
264}
265
266/**
267 * Select the right pool or requested caching state and ttm flags. */
268static struct ttm_page_pool *ttm_get_pool(int flags,
269 enum ttm_caching_state cstate)
270{

--- 631 unchanged lines hidden ---
247 return 0;
248}
249
250/**
251 * Select the right pool or requested caching state and ttm flags. */
252static struct ttm_page_pool *ttm_get_pool(int flags,
253 enum ttm_caching_state cstate)
254{

--- 631 unchanged lines hidden ---