[agd5f:drm-next 409/419] drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1210:55: warning: implicit conversion from 'enum <anonymous>' to 'enum dma_resv_usage'

From: kernel test robot
Date: Sat Jul 09 2022 - 03:01:38 EST


tree: https://gitlab.freedesktop.org/agd5f/linux.git drm-next
head: e35cc9020f7b4540f5fbbff9fbe08808aab9addc
commit: 9a65294489b5b61b674f1497b6a54db4588024f9 [409/419] drm/amdgpu/mes: fix bo va unmap issue in mes
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220709/202207091422.0Z9teg5Y-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
git remote add agd5f https://gitlab.freedesktop.org/agd5f/linux.git
git fetch --no-tags agd5f drm-next
git checkout 9a65294489b5b61b674f1497b6a54db4588024f9
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/amd/amdgpu/ drivers/gpu/drm/amd/display/dc/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c: In function 'amdgpu_mes_ctx_alloc_meta_data':
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1079:13: warning: variable 'r' set but not used [-Wunused-but-set-variable]
1079 | int r;
| ^
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c: In function 'amdgpu_mes_ctx_unmap_meta_data':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1210:55: warning: implicit conversion from 'enum <anonymous>' to 'enum dma_resv_usage' [-Wenum-conversion]
1210 | r = dma_resv_get_singleton(bo->tbo.base.resv, false, &fence);
| ^~~~~


vim +1210 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c

1176
1177 int amdgpu_mes_ctx_unmap_meta_data(struct amdgpu_device *adev,
1178 struct amdgpu_mes_ctx_data *ctx_data)
1179 {
1180 struct amdgpu_bo_va *bo_va = ctx_data->meta_data_va;
1181 struct amdgpu_bo *bo = ctx_data->meta_data_obj;
1182 struct amdgpu_vm *vm = bo_va->base.vm;
1183 struct amdgpu_bo_list_entry vm_pd;
1184 struct list_head list, duplicates;
1185 struct dma_fence *fence = NULL;
1186 struct ttm_validate_buffer tv;
1187 struct ww_acquire_ctx ticket;
1188 long r = 0;
1189
1190 INIT_LIST_HEAD(&list);
1191 INIT_LIST_HEAD(&duplicates);
1192
1193 tv.bo = &bo->tbo;
1194 tv.num_shared = 2;
1195 list_add(&tv.head, &list);
1196
1197 amdgpu_vm_get_pd_bo(vm, &list, &vm_pd);
1198
1199 r = ttm_eu_reserve_buffers(&ticket, &list, false, &duplicates);
1200 if (r) {
1201 dev_err(adev->dev, "leaking bo va because "
1202 "we fail to reserve bo (%ld)\n", r);
1203 return r;
1204 }
1205
1206 amdgpu_vm_bo_del(adev, bo_va);
1207 if (!amdgpu_vm_ready(vm))
1208 goto out_unlock;
1209
> 1210 r = dma_resv_get_singleton(bo->tbo.base.resv, false, &fence);
1211 if (r)
1212 goto out_unlock;
1213 if (fence) {
1214 amdgpu_bo_fence(bo, fence, true);
1215 fence = NULL;
1216 }
1217
1218 r = amdgpu_vm_clear_freed(adev, vm, &fence);
1219 if (r || !fence)
1220 goto out_unlock;
1221
1222 dma_fence_wait(fence, false);
1223 amdgpu_bo_fence(bo, fence, true);
1224 dma_fence_put(fence);
1225
1226 out_unlock:
1227 if (unlikely(r < 0))
1228 dev_err(adev->dev, "failed to clear page tables (%ld)\n", r);
1229 ttm_eu_backoff_reservation(&ticket, &list);
1230
1231 return r;
1232 }
1233

--
0-DAY CI Kernel Test Service
https://01.org/lkp