Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+6 -7
+3 -5
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 682 682 if (mem->mem_type == TTM_PL_VRAM) 683 683 nouveau_vm_map(vma, node); 684 684 else 685 - nouveau_vm_map_sg(vma, 0, mem->num_pages << PAGE_SHIFT, 686 - node, node->pages); 685 + nouveau_vm_map_sg(vma, 0, mem->num_pages << PAGE_SHIFT, node); 687 686 688 687 return 0; 689 688 } ··· 809 810 static void 810 811 nouveau_bo_move_ntfy(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem) 811 812 { 812 - struct nouveau_mem *node = new_mem->mm_node; 813 813 struct nouveau_bo *nvbo = nouveau_bo(bo); 814 814 struct nouveau_vma *vma; 815 815 ··· 820 822 nvbo->page_shift == vma->vm->spg_shift) { 821 823 nouveau_vm_map_sg(vma, 0, new_mem-> 822 824 num_pages << PAGE_SHIFT, 823 - node, node->pages); 825 + new_mem->mm_node); 824 826 } else { 825 827 nouveau_vm_unmap(vma); 826 828 } ··· 1171 1173 nouveau_vm_map(vma, nvbo->bo.mem.mm_node); 1172 1174 else 1173 1175 if (nvbo->bo.mem.mem_type == TTM_PL_TT) 1174 - nouveau_vm_map_sg(vma, 0, size, node, node->pages); 1176 + nouveau_vm_map_sg(vma, 0, size, node); 1175 1177 1176 1178 list_add_tail(&vma->head, &nvbo->vma_list); 1177 1179 vma->refcount = 1;
+2 -1
drivers/gpu/drm/nouveau/nouveau_vm.c
··· 78 78 79 79 void 80 80 nouveau_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 83 struct nouveau_vm *vm = vma->vm; 84 + dma_addr_t *list = mem->pages; 84 85 int big = vma->node->type != vm->spg_shift; 85 86 u32 offset = vma->node->offset + (delta >> 12); 86 87 u32 bits = vma->node->type - 12;
+1 -1
drivers/gpu/drm/nouveau/nouveau_vm.h
··· 89 89 void nouveau_vm_unmap(struct nouveau_vma *); 90 90 void nouveau_vm_unmap_at(struct nouveau_vma *, u64 offset, u64 length); 91 91 void 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 94 /* nv50_vm.c */ 95 95 void nv50_vm_map_pgt(struct nouveau_gpuobj *pgd, u32 pde,