aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2011-12-22 00:20:21 -0500
committerBen Skeggs <bskeggs@redhat.com>2011-12-22 00:23:25 -0500
commitf7b24c42da1a7bbb98145d27aa716d8af3cae2a6 (patch)
tree78bf7271c755818a83faf713655a69f611cd23df /drivers/gpu/drm/nouveau
parentb2e0d195d29326fce6aef8f2f789028bf21d743f (diff)
drm/nouveau/ttm: fix crash as a result of a recent ttm change
"drm/ttm: callback move_notify any time bo placement change v4" failed to avoid a NULL pointer dereference in nouveau caused by move_notify being expected to handle that case now. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c8
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_vm.c3
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_vm.h2
3 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index f12dd0f39211..8cf4a48f872e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -682,8 +682,7 @@ nouveau_vma_getmap(struct nouveau_channel *chan, struct nouveau_bo *nvbo,
682 if (mem->mem_type == TTM_PL_VRAM) 682 if (mem->mem_type == TTM_PL_VRAM)
683 nouveau_vm_map(vma, node); 683 nouveau_vm_map(vma, node);
684 else 684 else
685 nouveau_vm_map_sg(vma, 0, mem->num_pages << PAGE_SHIFT, 685 nouveau_vm_map_sg(vma, 0, mem->num_pages << PAGE_SHIFT, node);
686 node, node->pages);
687 686
688 return 0; 687 return 0;
689} 688}
@@ -810,7 +809,6 @@ out:
810static void 809static void
811nouveau_bo_move_ntfy(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem) 810nouveau_bo_move_ntfy(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem)
812{ 811{
813 struct nouveau_mem *node = new_mem->mm_node;
814 struct nouveau_bo *nvbo = nouveau_bo(bo); 812 struct nouveau_bo *nvbo = nouveau_bo(bo);
815 struct nouveau_vma *vma; 813 struct nouveau_vma *vma;
816 814
@@ -822,7 +820,7 @@ nouveau_bo_move_ntfy(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem)
822 nvbo->page_shift == vma->vm->spg_shift) { 820 nvbo->page_shift == vma->vm->spg_shift) {
823 nouveau_vm_map_sg(vma, 0, new_mem-> 821 nouveau_vm_map_sg(vma, 0, new_mem->
824 num_pages << PAGE_SHIFT, 822 num_pages << PAGE_SHIFT,
825 node, node->pages); 823 new_mem->mm_node);
826 } else { 824 } else {
827 nouveau_vm_unmap(vma); 825 nouveau_vm_unmap(vma);
828 } 826 }
@@ -1173,7 +1171,7 @@ nouveau_bo_vma_add(struct nouveau_bo *nvbo, struct nouveau_vm *vm,
1173 nouveau_vm_map(vma, nvbo->bo.mem.mm_node); 1171 nouveau_vm_map(vma, nvbo->bo.mem.mm_node);
1174 else 1172 else
1175 if (nvbo->bo.mem.mem_type == TTM_PL_TT) 1173 if (nvbo->bo.mem.mem_type == TTM_PL_TT)
1176 nouveau_vm_map_sg(vma, 0, size, node, node->pages); 1174 nouveau_vm_map_sg(vma, 0, size, node);
1177 1175
1178 list_add_tail(&vma->head, &nvbo->vma_list); 1176 list_add_tail(&vma->head, &nvbo->vma_list);
1179 vma->refcount = 1; 1177 vma->refcount = 1;
diff --git a/drivers/gpu/drm/nouveau/nouveau_vm.c b/drivers/gpu/drm/nouveau/nouveau_vm.c
index ef0832b29ad2..2bf6c0350b4b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_vm.c
@@ -78,9 +78,10 @@ nouveau_vm_map(struct nouveau_vma *vma, struct nouveau_mem *node)
78 78
79void 79void
80nouveau_vm_map_sg(struct nouveau_vma *vma, u64 delta, u64 length, 80nouveau_vm_map_sg(struct nouveau_vma *vma, u64 delta, u64 length,
81 struct nouveau_mem *mem, dma_addr_t *list) 81 struct nouveau_mem *mem)
82{ 82{
83 struct nouveau_vm *vm = vma->vm; 83 struct nouveau_vm *vm = vma->vm;
84 dma_addr_t *list = mem->pages;
84 int big = vma->node->type != vm->spg_shift; 85 int big = vma->node->type != vm->spg_shift;
85 u32 offset = vma->node->offset + (delta >> 12); 86 u32 offset = vma->node->offset + (delta >> 12);
86 u32 bits = vma->node->type - 12; 87 u32 bits = vma->node->type - 12;
diff --git a/drivers/gpu/drm/nouveau/nouveau_vm.h b/drivers/gpu/drm/nouveau/nouveau_vm.h
index 6ce995f7797e..4fb6e728734d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_vm.h
@@ -89,7 +89,7 @@ void nouveau_vm_map_at(struct nouveau_vma *, u64 offset, struct nouveau_mem *);
89void nouveau_vm_unmap(struct nouveau_vma *); 89void nouveau_vm_unmap(struct nouveau_vma *);
90void nouveau_vm_unmap_at(struct nouveau_vma *, u64 offset, u64 length); 90void nouveau_vm_unmap_at(struct nouveau_vma *, u64 offset, u64 length);
91void nouveau_vm_map_sg(struct nouveau_vma *, u64 offset, u64 length, 91void nouveau_vm_map_sg(struct nouveau_vma *, u64 offset, u64 length,
92 struct nouveau_mem *, dma_addr_t *); 92 struct nouveau_mem *);
93 93
94/* nv50_vm.c */ 94/* nv50_vm.c */
95void nv50_vm_map_pgt(struct nouveau_gpuobj *pgd, u32 pde, 95void nv50_vm_map_pgt(struct nouveau_gpuobj *pgd, u32 pde,