blob: 18f4497157885a897a9cbec14c390d397a02ca25 [file] [log] [blame]
Ben Skeggs6ee73862009-12-11 19:24:15 +10001/*
2 * Copyright (c) 2007-2008 Tungsten Graphics, Inc., Cedar Park, TX., USA,
3 * All Rights Reserved.
4 * Copyright (c) 2009 VMware, Inc., Palo Alto, CA., USA,
5 * All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sub license,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
Ben Skeggsebb945a2012-07-20 08:17:34 +100027#include "nouveau_drm.h"
28#include "nouveau_ttm.h"
29#include "nouveau_gem.h"
Ben Skeggs6ee73862009-12-11 19:24:15 +100030
Dave Airlie2036eaa2014-12-16 16:33:09 +100031#include "drm_legacy.h"
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100032static int
33nouveau_vram_manager_init(struct ttm_mem_type_manager *man, unsigned long psize)
34{
Marcin Slusarz897a6e22013-03-02 20:00:31 +010035 struct nouveau_drm *drm = nouveau_bdev(man->bdev);
Ben Skeggsbe83cd42015-01-14 15:36:34 +100036 struct nvkm_fb *pfb = nvxx_fb(&drm->device);
Marcin Slusarz897a6e22013-03-02 20:00:31 +010037 man->priv = pfb;
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100038 return 0;
39}
40
41static int
42nouveau_vram_manager_fini(struct ttm_mem_type_manager *man)
43{
Marcin Slusarz897a6e22013-03-02 20:00:31 +010044 man->priv = NULL;
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100045 return 0;
46}
47
48static inline void
Ben Skeggsbe83cd42015-01-14 15:36:34 +100049nvkm_mem_node_cleanup(struct nvkm_mem *node)
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100050{
51 if (node->vma[0].node) {
Ben Skeggsbe83cd42015-01-14 15:36:34 +100052 nvkm_vm_unmap(&node->vma[0]);
53 nvkm_vm_put(&node->vma[0]);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100054 }
55
56 if (node->vma[1].node) {
Ben Skeggsbe83cd42015-01-14 15:36:34 +100057 nvkm_vm_unmap(&node->vma[1]);
58 nvkm_vm_put(&node->vma[1]);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100059 }
60}
61
62static void
63nouveau_vram_manager_del(struct ttm_mem_type_manager *man,
64 struct ttm_mem_reg *mem)
65{
Ben Skeggsebb945a2012-07-20 08:17:34 +100066 struct nouveau_drm *drm = nouveau_bdev(man->bdev);
Ben Skeggsbe83cd42015-01-14 15:36:34 +100067 struct nvkm_fb *pfb = nvxx_fb(&drm->device);
68 nvkm_mem_node_cleanup(mem->mm_node);
69 pfb->ram->put(pfb, (struct nvkm_mem **)&mem->mm_node);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100070}
71
72static int
73nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
74 struct ttm_buffer_object *bo,
Christian Königf1217ed2014-08-27 13:16:04 +020075 const struct ttm_place *place,
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100076 struct ttm_mem_reg *mem)
77{
Ben Skeggsebb945a2012-07-20 08:17:34 +100078 struct nouveau_drm *drm = nouveau_bdev(man->bdev);
Ben Skeggsbe83cd42015-01-14 15:36:34 +100079 struct nvkm_fb *pfb = nvxx_fb(&drm->device);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100080 struct nouveau_bo *nvbo = nouveau_bo(bo);
Ben Skeggsbe83cd42015-01-14 15:36:34 +100081 struct nvkm_mem *node;
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100082 u32 size_nc = 0;
83 int ret;
84
Alexandre Courboteaecf032015-02-20 18:22:59 +090085 if (drm->device.info.ram_size == 0)
86 return -ENOMEM;
87
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100088 if (nvbo->tile_flags & NOUVEAU_GEM_TILE_NONCONTIG)
89 size_nc = 1 << nvbo->page_shift;
90
Ben Skeggsdceef5d2013-03-04 13:01:21 +100091 ret = pfb->ram->get(pfb, mem->num_pages << PAGE_SHIFT,
Ben Skeggsebb945a2012-07-20 08:17:34 +100092 mem->page_alignment << PAGE_SHIFT, size_nc,
93 (nvbo->tile_flags >> 8) & 0x3ff, &node);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +100094 if (ret) {
95 mem->mm_node = NULL;
96 return (ret == -ENOSPC) ? 0 : ret;
97 }
98
99 node->page_shift = nvbo->page_shift;
100
101 mem->mm_node = node;
102 mem->start = node->offset >> PAGE_SHIFT;
103 return 0;
104}
105
Marcin Slusarz5b8a43a2012-08-19 23:00:00 +0200106static void
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000107nouveau_vram_manager_debug(struct ttm_mem_type_manager *man, const char *prefix)
108{
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000109 struct nvkm_fb *pfb = man->priv;
110 struct nvkm_mm *mm = &pfb->vram;
111 struct nvkm_mm_node *r;
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000112 u32 total = 0, free = 0;
113
Ben Skeggs51a506c2013-05-13 22:30:56 +1000114 mutex_lock(&nv_subdev(pfb)->mutex);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000115 list_for_each_entry(r, &mm->nodes, nl_entry) {
116 printk(KERN_DEBUG "%s %d: 0x%010llx 0x%010llx\n",
117 prefix, r->type, ((u64)r->offset << 12),
118 (((u64)r->offset + r->length) << 12));
119
120 total += r->length;
121 if (!r->type)
122 free += r->length;
123 }
Ben Skeggs51a506c2013-05-13 22:30:56 +1000124 mutex_unlock(&nv_subdev(pfb)->mutex);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000125
126 printk(KERN_DEBUG "%s total: 0x%010llx free: 0x%010llx\n",
127 prefix, (u64)total << 12, (u64)free << 12);
128 printk(KERN_DEBUG "%s block: 0x%08x\n",
129 prefix, mm->block_size << 12);
130}
131
132const struct ttm_mem_type_manager_func nouveau_vram_manager = {
133 nouveau_vram_manager_init,
134 nouveau_vram_manager_fini,
135 nouveau_vram_manager_new,
136 nouveau_vram_manager_del,
137 nouveau_vram_manager_debug
138};
139
140static int
141nouveau_gart_manager_init(struct ttm_mem_type_manager *man, unsigned long psize)
142{
143 return 0;
144}
145
146static int
147nouveau_gart_manager_fini(struct ttm_mem_type_manager *man)
148{
149 return 0;
150}
151
152static void
153nouveau_gart_manager_del(struct ttm_mem_type_manager *man,
154 struct ttm_mem_reg *mem)
155{
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000156 nvkm_mem_node_cleanup(mem->mm_node);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000157 kfree(mem->mm_node);
158 mem->mm_node = NULL;
159}
160
161static int
162nouveau_gart_manager_new(struct ttm_mem_type_manager *man,
163 struct ttm_buffer_object *bo,
Christian Königf1217ed2014-08-27 13:16:04 +0200164 const struct ttm_place *place,
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000165 struct ttm_mem_reg *mem)
166{
Ben Skeggsde7b7d52013-03-22 12:12:17 +1000167 struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
168 struct nouveau_bo *nvbo = nouveau_bo(bo);
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000169 struct nvkm_mem *node;
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000170
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000171 node = kzalloc(sizeof(*node), GFP_KERNEL);
172 if (!node)
173 return -ENOMEM;
Ben Skeggs2e2cfbe2013-11-15 11:56:49 +1000174
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000175 node->page_shift = 12;
176
Ben Skeggs967e7bd2014-08-10 04:10:22 +1000177 switch (drm->device.info.family) {
178 case NV_DEVICE_INFO_V0_TESLA:
179 if (drm->device.info.chipset != 0x50)
Ben Skeggsde7b7d52013-03-22 12:12:17 +1000180 node->memtype = (nvbo->tile_flags & 0x7f00) >> 8;
181 break;
Ben Skeggs967e7bd2014-08-10 04:10:22 +1000182 case NV_DEVICE_INFO_V0_FERMI:
183 case NV_DEVICE_INFO_V0_KEPLER:
Ben Skeggsde7b7d52013-03-22 12:12:17 +1000184 node->memtype = (nvbo->tile_flags & 0xff00) >> 8;
185 break;
186 default:
187 break;
188 }
189
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000190 mem->mm_node = node;
191 mem->start = 0;
192 return 0;
193}
194
Marcin Slusarz5b8a43a2012-08-19 23:00:00 +0200195static void
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000196nouveau_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix)
197{
198}
199
200const struct ttm_mem_type_manager_func nouveau_gart_manager = {
201 nouveau_gart_manager_init,
202 nouveau_gart_manager_fini,
203 nouveau_gart_manager_new,
204 nouveau_gart_manager_del,
205 nouveau_gart_manager_debug
206};
207
Ben Skeggsfdb751e2014-08-10 04:10:23 +1000208/*XXX*/
Ben Skeggs5ce3bf32015-01-14 09:57:36 +1000209#include <subdev/mmu/nv04.h>
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000210static int
211nv04_gart_manager_init(struct ttm_mem_type_manager *man, unsigned long psize)
212{
Ben Skeggsebb945a2012-07-20 08:17:34 +1000213 struct nouveau_drm *drm = nouveau_bdev(man->bdev);
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000214 struct nvkm_mmu *mmu = nvxx_mmu(&drm->device);
Ben Skeggs5ce3bf32015-01-14 09:57:36 +1000215 struct nv04_mmu_priv *priv = (void *)mmu;
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000216 struct nvkm_vm *vm = NULL;
217 nvkm_vm_ref(priv->vm, &vm, NULL);
Ben Skeggsebb945a2012-07-20 08:17:34 +1000218 man->priv = vm;
219 return 0;
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000220}
221
222static int
223nv04_gart_manager_fini(struct ttm_mem_type_manager *man)
224{
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000225 struct nvkm_vm *vm = man->priv;
226 nvkm_vm_ref(NULL, &vm, NULL);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000227 man->priv = NULL;
228 return 0;
229}
230
231static void
232nv04_gart_manager_del(struct ttm_mem_type_manager *man, struct ttm_mem_reg *mem)
233{
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000234 struct nvkm_mem *node = mem->mm_node;
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000235 if (node->vma[0].node)
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000236 nvkm_vm_put(&node->vma[0]);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000237 kfree(mem->mm_node);
238 mem->mm_node = NULL;
239}
240
241static int
242nv04_gart_manager_new(struct ttm_mem_type_manager *man,
243 struct ttm_buffer_object *bo,
Christian Königf1217ed2014-08-27 13:16:04 +0200244 const struct ttm_place *place,
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000245 struct ttm_mem_reg *mem)
246{
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000247 struct nvkm_mem *node;
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000248 int ret;
249
250 node = kzalloc(sizeof(*node), GFP_KERNEL);
251 if (!node)
252 return -ENOMEM;
253
254 node->page_shift = 12;
255
Ben Skeggsbe83cd42015-01-14 15:36:34 +1000256 ret = nvkm_vm_get(man->priv, mem->num_pages << 12, node->page_shift,
257 NV_MEM_ACCESS_RW, &node->vma[0]);
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000258 if (ret) {
259 kfree(node);
260 return ret;
261 }
262
263 mem->mm_node = node;
264 mem->start = node->vma[0].offset >> PAGE_SHIFT;
265 return 0;
266}
267
Marcin Slusarz5b8a43a2012-08-19 23:00:00 +0200268static void
Ben Skeggsbc9e7b92012-07-19 17:54:21 +1000269nv04_gart_manager_debug(struct ttm_mem_type_manager *man, const char *prefix)
270{
271}
272
273const struct ttm_mem_type_manager_func nv04_gart_manager = {
274 nv04_gart_manager_init,
275 nv04_gart_manager_fini,
276 nv04_gart_manager_new,
277 nv04_gart_manager_del,
278 nv04_gart_manager_debug
279};
280
Ben Skeggs6ee73862009-12-11 19:24:15 +1000281int
282nouveau_ttm_mmap(struct file *filp, struct vm_area_struct *vma)
283{
284 struct drm_file *file_priv = filp->private_data;
Ben Skeggs77145f12012-07-31 16:16:21 +1000285 struct nouveau_drm *drm = nouveau_drm(file_priv->minor->dev);
Ben Skeggs6ee73862009-12-11 19:24:15 +1000286
287 if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
Dave Airlie2036eaa2014-12-16 16:33:09 +1000288 return drm_legacy_mmap(filp, vma);
Ben Skeggs6ee73862009-12-11 19:24:15 +1000289
Ben Skeggsebb945a2012-07-20 08:17:34 +1000290 return ttm_bo_mmap(filp, vma, &drm->ttm.bdev);
Ben Skeggs6ee73862009-12-11 19:24:15 +1000291}
292
293static int
Dave Airlieba4420c2010-03-09 10:56:52 +1000294nouveau_ttm_mem_global_init(struct drm_global_reference *ref)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000295{
296 return ttm_mem_global_init(ref->object);
297}
298
299static void
Dave Airlieba4420c2010-03-09 10:56:52 +1000300nouveau_ttm_mem_global_release(struct drm_global_reference *ref)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000301{
302 ttm_mem_global_release(ref->object);
303}
304
305int
Ben Skeggsebb945a2012-07-20 08:17:34 +1000306nouveau_ttm_global_init(struct nouveau_drm *drm)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000307{
Dave Airlieba4420c2010-03-09 10:56:52 +1000308 struct drm_global_reference *global_ref;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000309 int ret;
310
Ben Skeggsebb945a2012-07-20 08:17:34 +1000311 global_ref = &drm->ttm.mem_global_ref;
Dave Airlieba4420c2010-03-09 10:56:52 +1000312 global_ref->global_type = DRM_GLOBAL_TTM_MEM;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000313 global_ref->size = sizeof(struct ttm_mem_global);
314 global_ref->init = &nouveau_ttm_mem_global_init;
315 global_ref->release = &nouveau_ttm_mem_global_release;
316
Dave Airlieba4420c2010-03-09 10:56:52 +1000317 ret = drm_global_item_ref(global_ref);
Ben Skeggs6ee73862009-12-11 19:24:15 +1000318 if (unlikely(ret != 0)) {
319 DRM_ERROR("Failed setting up TTM memory accounting\n");
Ben Skeggsebb945a2012-07-20 08:17:34 +1000320 drm->ttm.mem_global_ref.release = NULL;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000321 return ret;
322 }
323
Ben Skeggsebb945a2012-07-20 08:17:34 +1000324 drm->ttm.bo_global_ref.mem_glob = global_ref->object;
325 global_ref = &drm->ttm.bo_global_ref.ref;
Dave Airlieba4420c2010-03-09 10:56:52 +1000326 global_ref->global_type = DRM_GLOBAL_TTM_BO;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000327 global_ref->size = sizeof(struct ttm_bo_global);
328 global_ref->init = &ttm_bo_global_init;
329 global_ref->release = &ttm_bo_global_release;
330
Dave Airlieba4420c2010-03-09 10:56:52 +1000331 ret = drm_global_item_ref(global_ref);
Ben Skeggs6ee73862009-12-11 19:24:15 +1000332 if (unlikely(ret != 0)) {
333 DRM_ERROR("Failed setting up TTM BO subsystem\n");
Ben Skeggsebb945a2012-07-20 08:17:34 +1000334 drm_global_item_unref(&drm->ttm.mem_global_ref);
335 drm->ttm.mem_global_ref.release = NULL;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000336 return ret;
337 }
338
339 return 0;
340}
341
342void
Ben Skeggsebb945a2012-07-20 08:17:34 +1000343nouveau_ttm_global_release(struct nouveau_drm *drm)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000344{
Ben Skeggsebb945a2012-07-20 08:17:34 +1000345 if (drm->ttm.mem_global_ref.release == NULL)
Ben Skeggs6ee73862009-12-11 19:24:15 +1000346 return;
347
Ben Skeggsebb945a2012-07-20 08:17:34 +1000348 drm_global_item_unref(&drm->ttm.bo_global_ref.ref);
349 drm_global_item_unref(&drm->ttm.mem_global_ref);
350 drm->ttm.mem_global_ref.release = NULL;
351}
352
353int
354nouveau_ttm_init(struct nouveau_drm *drm)
355{
356 struct drm_device *dev = drm->dev;
357 u32 bits;
358 int ret;
359
Ben Skeggs989aa5b2015-01-12 12:33:37 +1000360 bits = nvxx_mmu(&drm->device)->dma_bits;
361 if (nv_device_is_pci(nvxx_device(&drm->device))) {
Alexandre Courbot420b9462014-02-17 15:17:26 +0900362 if (drm->agp.stat == ENABLED ||
363 !pci_dma_supported(dev->pdev, DMA_BIT_MASK(bits)))
364 bits = 32;
Ben Skeggsebb945a2012-07-20 08:17:34 +1000365
Alexandre Courbot420b9462014-02-17 15:17:26 +0900366 ret = pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(bits));
367 if (ret)
368 return ret;
Ben Skeggsebb945a2012-07-20 08:17:34 +1000369
Alexandre Courbot420b9462014-02-17 15:17:26 +0900370 ret = pci_set_consistent_dma_mask(dev->pdev,
371 DMA_BIT_MASK(bits));
372 if (ret)
373 pci_set_consistent_dma_mask(dev->pdev,
374 DMA_BIT_MASK(32));
375 }
Ben Skeggsebb945a2012-07-20 08:17:34 +1000376
377 ret = nouveau_ttm_global_init(drm);
378 if (ret)
379 return ret;
380
381 ret = ttm_bo_device_init(&drm->ttm.bdev,
382 drm->ttm.bo_global_ref.ref.object,
David Herrmann44d847b2013-08-13 19:10:30 +0200383 &nouveau_bo_driver,
384 dev->anon_inode->i_mapping,
385 DRM_FILE_PAGE_OFFSET,
Ben Skeggsebb945a2012-07-20 08:17:34 +1000386 bits <= 32 ? true : false);
387 if (ret) {
388 NV_ERROR(drm, "error initialising bo driver, %d\n", ret);
389 return ret;
390 }
391
392 /* VRAM init */
Ben Skeggsf392ec42014-08-10 04:10:28 +1000393 drm->gem.vram_available = drm->device.info.ram_user;
Ben Skeggsebb945a2012-07-20 08:17:34 +1000394
395 ret = ttm_bo_init_mm(&drm->ttm.bdev, TTM_PL_VRAM,
396 drm->gem.vram_available >> PAGE_SHIFT);
397 if (ret) {
398 NV_ERROR(drm, "VRAM mm init failed, %d\n", ret);
399 return ret;
400 }
401
Ben Skeggs989aa5b2015-01-12 12:33:37 +1000402 drm->ttm.mtrr = arch_phys_wc_add(nv_device_resource_start(nvxx_device(&drm->device), 1),
403 nv_device_resource_len(nvxx_device(&drm->device), 1));
Ben Skeggsebb945a2012-07-20 08:17:34 +1000404
405 /* GART init */
406 if (drm->agp.stat != ENABLED) {
Ben Skeggs989aa5b2015-01-12 12:33:37 +1000407 drm->gem.gart_available = nvxx_mmu(&drm->device)->limit;
Ben Skeggsebb945a2012-07-20 08:17:34 +1000408 } else {
409 drm->gem.gart_available = drm->agp.size;
410 }
411
412 ret = ttm_bo_init_mm(&drm->ttm.bdev, TTM_PL_TT,
413 drm->gem.gart_available >> PAGE_SHIFT);
414 if (ret) {
415 NV_ERROR(drm, "GART mm init failed, %d\n", ret);
416 return ret;
417 }
418
419 NV_INFO(drm, "VRAM: %d MiB\n", (u32)(drm->gem.vram_available >> 20));
420 NV_INFO(drm, "GART: %d MiB\n", (u32)(drm->gem.gart_available >> 20));
421 return 0;
422}
423
424void
425nouveau_ttm_fini(struct nouveau_drm *drm)
426{
427 mutex_lock(&drm->dev->struct_mutex);
428 ttm_bo_clean_mm(&drm->ttm.bdev, TTM_PL_VRAM);
429 ttm_bo_clean_mm(&drm->ttm.bdev, TTM_PL_TT);
430 mutex_unlock(&drm->dev->struct_mutex);
431
432 ttm_bo_device_release(&drm->ttm.bdev);
433
434 nouveau_ttm_global_release(drm);
435
Andy Lutomirski247d36d2013-05-13 23:58:41 +0000436 arch_phys_wc_del(drm->ttm.mtrr);
437 drm->ttm.mtrr = 0;
Ben Skeggs6ee73862009-12-11 19:24:15 +1000438}