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

drm/nouveau: fix multihop when move doesn't work.

As per the radeon/amdgpu fix don't use multihop if hw moves
aren't enabled.

Reported-by: Mike Galbraith <efault@gmx.de>
Tested-by: Mike Galbraith <efault@gmx.de>
Fixes: 0c8c0659d747 ("drm/nouveau/ttm: use multihop")
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20201217200943.30511-1-airlied@gmail.com

authored by

Dave Airlie and committed by
Daniel Vetter
660a5995 efd30437

+16 -15
+16 -15
drivers/gpu/drm/nouveau/nouveau_bo.c
··· 942 942 struct nouveau_drm_tile *new_tile = NULL; 943 943 int ret = 0; 944 944 945 - if ((old_reg->mem_type == TTM_PL_SYSTEM && 946 - new_reg->mem_type == TTM_PL_VRAM) || 947 - (old_reg->mem_type == TTM_PL_VRAM && 948 - new_reg->mem_type == TTM_PL_SYSTEM)) { 949 - hop->fpfn = 0; 950 - hop->lpfn = 0; 951 - hop->mem_type = TTM_PL_TT; 952 - hop->flags = 0; 953 - return -EMULTIHOP; 954 - } 955 945 956 946 if (new_reg->mem_type == TTM_PL_TT) { 957 947 ret = nouveau_ttm_tt_bind(bo->bdev, bo->ttm, new_reg); ··· 985 995 986 996 /* Hardware assisted copy. */ 987 997 if (drm->ttm.move) { 998 + if ((old_reg->mem_type == TTM_PL_SYSTEM && 999 + new_reg->mem_type == TTM_PL_VRAM) || 1000 + (old_reg->mem_type == TTM_PL_VRAM && 1001 + new_reg->mem_type == TTM_PL_SYSTEM)) { 1002 + hop->fpfn = 0; 1003 + hop->lpfn = 0; 1004 + hop->mem_type = TTM_PL_TT; 1005 + hop->flags = 0; 1006 + return -EMULTIHOP; 1007 + } 988 1008 ret = nouveau_bo_move_m2mf(bo, evict, ctx, 989 1009 new_reg); 990 - if (!ret) 991 - goto out; 992 - } 1010 + } else 1011 + ret = -ENODEV; 993 1012 994 - /* Fallback to software copy. */ 995 - ret = ttm_bo_move_memcpy(bo, ctx, new_reg); 1013 + if (ret) { 1014 + /* Fallback to software copy. */ 1015 + ret = ttm_bo_move_memcpy(bo, ctx, new_reg); 1016 + } 996 1017 997 1018 out: 998 1019 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {