tree: git://people.freedesktop.org/~agd5f/linux.git amd-staging-dkms-4.13 head: 7bde112fab15c0a28c1d056959167cd4393bf538 commit: 7f7a03f8049d505d450f27973d5c96af13bc8fe6 [2525/3830] drm/ttm: add operation ctx to ttm_bo_validate v2 reproduce: # apt-get install sparse git checkout 7f7a03f8049d505d450f27973d5c96af13bc8fe6 make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) drivers/staging/vboxvideo/vbox_ttm.c:233:22: sparse: symbol 'vbox_bo_driver' was not declared. Should it be >> drivers/staging/vboxvideo/vbox_ttm.c:392:56: sparse: Using plain integer as NULL pointer >> drivers/staging/vboxvideo/vbox_ttm.c:392:30: sparse: too many arguments for function ttm_bo_validate drivers/staging/vboxvideo/vbox_ttm.c:419:56: sparse: Using plain integer as NULL pointer drivers/staging/vboxvideo/vbox_ttm.c:419:30: sparse: too many arguments for function ttm_bo_validate drivers/staging/vboxvideo/vbox_ttm.c:451:56: sparse: Using plain integer as NULL pointer drivers/staging/vboxvideo/vbox_ttm.c:451:30: sparse: too many arguments for function ttm_bo_validate drivers/staging/vboxvideo/vbox_ttm.c: In function 'vbox_bo_pin': drivers/staging/vboxvideo/vbox_ttm.c:392:8: error: too many arguments to function 'ttm_bo_validate' ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); ^~~~~~~~~~~~~~~ In file included from drivers/staging/vboxvideo/vbox_drv.h:43:0, from drivers/staging/vboxvideo/vbox_ttm.c:30: include/drm/ttm/ttm_bo_api.h:334:5: note: declared here int ttm_bo_validate(struct ttm_buffer_object ^~~~~~~~~~~~~~~ drivers/staging/vboxvideo/vbox_ttm.c: In function 'vbox_bo_unpin': drivers/staging/vboxvideo/vbox_ttm.c:419:8: error: too many arguments to function 'ttm_bo_validate' ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); ^~~~~~~~~~~~~~~ In file included from drivers/staging/vboxvideo/vbox_drv.h:43:0, from drivers/staging/vboxvideo/vbox_ttm.c:30: include/drm/ttm/ttm_bo_api.h:334:5: note: declared here int ttm_bo_validate(struct ttm_buffer_object ^~~~~~~~~~~~~~~ drivers/staging/vboxvideo/vbox_ttm.c: In function 'vbox_bo_push_sysram': drivers/staging/vboxvideo/vbox_ttm.c:451:8: error: too many arguments to function 'ttm_bo_validate' ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); ^~~~~~~~~~~~~~~ In file included from drivers/staging/vboxvideo/vbox_drv.h:43:0, from drivers/staging/vboxvideo/vbox_ttm.c:30: include/drm/ttm/ttm_bo_api.h:334:5: note: declared here int ttm_bo_validate(struct ttm_buffer_object ^~~~~~~~~~~~~~~ vim +392 drivers/staging/vboxvideo/vbox_ttm.c dd55d44f4 Hans de Goede 2017-07-06 232 dd55d44f4 Hans de Goede 2017-07-06 @233 struct ttm_bo_driver vbox_bo_driver = { dd55d44f4 Hans de Goede 2017-07-06 234 .ttm_tt_create = vbox_ttm_tt_create, dd55d44f4 Hans de Goede 2017-07-06 235 .ttm_tt_populate = vbox_ttm_tt_populate, dd55d44f4 Hans de Goede 2017-07-06 236 .ttm_tt_unpopulate = vbox_ttm_tt_unpopulate, dd55d44f4 Hans de Goede 2017-07-06 237 .init_mem_type = vbox_bo_init_mem_type, dd55d44f4 Hans de Goede 2017-07-06 238 .eviction_valuable = ttm_bo_eviction_valuable, dd55d44f4 Hans de Goede 2017-07-06 239 .evict_flags = vbox_bo_evict_flags, dd55d44f4 Hans de Goede 2017-07-06 240 .move = vbox_bo_move, dd55d44f4 Hans de Goede 2017-07-06 241 .verify_access = vbox_bo_verify_access, dd55d44f4 Hans de Goede 2017-07-06 242 .io_mem_reserve = &vbox_ttm_io_mem_reserve, dd55d44f4 Hans de Goede 2017-07-06 243 .io_mem_free = &vbox_ttm_io_mem_free, dd55d44f4 Hans de Goede 2017-07-06 244 .io_mem_pfn = ttm_bo_default_io_mem_pfn, dd55d44f4 Hans de Goede 2017-07-06 245 }; dd55d44f4 Hans de Goede 2017-07-06 246 dd55d44f4 Hans de Goede 2017-07-06 247 int vbox_mm_init(struct vbox_private *vbox) dd55d44f4 Hans de Goede 2017-07-06 248 { dd55d44f4 Hans de Goede 2017-07-06 249 int ret; dd55d44f4 Hans de Goede 2017-07-06 250 struct drm_device *dev = vbox->dev; dd55d44f4 Hans de Goede 2017-07-06 251 struct ttm_bo_device *bdev = &vbox->ttm.bdev; dd55d44f4 Hans de Goede 2017-07-06 252 dd55d44f4 Hans de Goede 2017-07-06 253 ret = vbox_ttm_global_init(vbox); dd55d44f4 Hans de Goede 2017-07-06 254 if (ret) dd55d44f4 Hans de Goede 2017-07-06 255 return ret; dd55d44f4 Hans de Goede 2017-07-06 256 dd55d44f4 Hans de Goede 2017-07-06 257 ret = ttm_bo_device_init(&vbox->ttm.bdev, dd55d44f4 Hans de Goede 2017-07-06 258 vbox->ttm.bo_global_ref.ref.object, dd55d44f4 Hans de Goede 2017-07-06 259 &vbox_bo_driver, dd55d44f4 Hans de Goede 2017-07-06 260 dev->anon_inode->i_mapping, dd55d44f4 Hans de Goede 2017-07-06 261 DRM_FILE_PAGE_OFFSET, true); dd55d44f4 Hans de Goede 2017-07-06 262 if (ret) { dd55d44f4 Hans de Goede 2017-07-06 263 DRM_ERROR("Error initialising bo driver; %d\n", ret); dd55d44f4 Hans de Goede 2017-07-06 264 goto err_ttm_global_release; dd55d44f4 Hans de Goede 2017-07-06 265 } dd55d44f4 Hans de Goede 2017-07-06 266 dd55d44f4 Hans de Goede 2017-07-06 267 ret = ttm_bo_init_mm(bdev, TTM_PL_VRAM, dd55d44f4 Hans de Goede 2017-07-06 268 vbox->available_vram_size >> PAGE_SHIFT); dd55d44f4 Hans de Goede 2017-07-06 269 if (ret) { dd55d44f4 Hans de Goede 2017-07-06 270 DRM_ERROR("Failed ttm VRAM init: %d\n", ret); dd55d44f4 Hans de Goede 2017-07-06 271 goto err_device_release; dd55d44f4 Hans de Goede 2017-07-06 272 } dd55d44f4 Hans de Goede 2017-07-06 273 dd55d44f4 Hans de Goede 2017-07-06 274 #ifdef DRM_MTRR_WC dd55d44f4 Hans de Goede 2017-07-06 275 vbox->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 0), dd55d44f4 Hans de Goede 2017-07-06 276 pci_resource_len(dev->pdev, 0), dd55d44f4 Hans de Goede 2017-07-06 277 DRM_MTRR_WC); dd55d44f4 Hans de Goede 2017-07-06 278 #else dd55d44f4 Hans de Goede 2017-07-06 279 vbox->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0), dd55d44f4 Hans de Goede 2017-07-06 280 pci_resource_len(dev->pdev, 0)); dd55d44f4 Hans de Goede 2017-07-06 281 #endif dd55d44f4 Hans de Goede 2017-07-06 282 return 0; dd55d44f4 Hans de Goede 2017-07-06 283 dd55d44f4 Hans de Goede 2017-07-06 284 err_device_release: dd55d44f4 Hans de Goede 2017-07-06 285 ttm_bo_device_release(&vbox->ttm.bdev); dd55d44f4 Hans de Goede 2017-07-06 286 err_ttm_global_release: dd55d44f4 Hans de Goede 2017-07-06 287 vbox_ttm_global_release(vbox); dd55d44f4 Hans de Goede 2017-07-06 288 return ret; dd55d44f4 Hans de Goede 2017-07-06 289 } dd55d44f4 Hans de Goede 2017-07-06 290 dd55d44f4 Hans de Goede 2017-07-06 291 void vbox_mm_fini(struct vbox_private *vbox) dd55d44f4 Hans de Goede 2017-07-06 292 { dd55d44f4 Hans de Goede 2017-07-06 293 #ifdef DRM_MTRR_WC dd55d44f4 Hans de Goede 2017-07-06 294 drm_mtrr_del(vbox->fb_mtrr, dd55d44f4 Hans de Goede 2017-07-06 295 pci_resource_start(vbox->dev->pdev, 0), dd55d44f4 Hans de Goede 2017-07-06 296 pci_resource_len(vbox->dev->pdev, 0), DRM_MTRR_WC); dd55d44f4 Hans de Goede 2017-07-06 297 #else dd55d44f4 Hans de Goede 2017-07-06 298 arch_phys_wc_del(vbox->fb_mtrr); dd55d44f4 Hans de Goede 2017-07-06 299 #endif dd55d44f4 Hans de Goede 2017-07-06 300 ttm_bo_device_release(&vbox->ttm.bdev); dd55d44f4 Hans de Goede 2017-07-06 301 vbox_ttm_global_release(vbox); dd55d44f4 Hans de Goede 2017-07-06 302 } dd55d44f4 Hans de Goede 2017-07-06 303 dd55d44f4 Hans de Goede 2017-07-06 304 void vbox_ttm_placement(struct vbox_bo *bo, int domain) dd55d44f4 Hans de Goede 2017-07-06 305 { dd55d44f4 Hans de Goede 2017-07-06 306 unsigned int i; dd55d44f4 Hans de Goede 2017-07-06 307 u32 c = 0; dd55d44f4 Hans de Goede 2017-07-06 308 dd55d44f4 Hans de Goede 2017-07-06 309 bo->placement.placement = bo->placements; dd55d44f4 Hans de Goede 2017-07-06 310 bo->placement.busy_placement = bo->placements; dd55d44f4 Hans de Goede 2017-07-06 311 dd55d44f4 Hans de Goede 2017-07-06 312 if (domain & TTM_PL_FLAG_VRAM) dd55d44f4 Hans de Goede 2017-07-06 313 bo->placements[c++].flags = dd55d44f4 Hans de Goede 2017-07-06 314 TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_VRAM; dd55d44f4 Hans de Goede 2017-07-06 315 if (domain & TTM_PL_FLAG_SYSTEM) dd55d44f4 Hans de Goede 2017-07-06 316 bo->placements[c++].flags = dd55d44f4 Hans de Goede 2017-07-06 317 TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; dd55d44f4 Hans de Goede 2017-07-06 318 if (!c) dd55d44f4 Hans de Goede 2017-07-06 319 bo->placements[c++].flags = dd55d44f4 Hans de Goede 2017-07-06 320 TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM; dd55d44f4 Hans de Goede 2017-07-06 321 dd55d44f4 Hans de Goede 2017-07-06 322 bo->placement.num_placement = c; dd55d44f4 Hans de Goede 2017-07-06 323 bo->placement.num_busy_placement = c; dd55d44f4 Hans de Goede 2017-07-06 324 dd55d44f4 Hans de Goede 2017-07-06 325 for (i = 0; i < c; ++i) { dd55d44f4 Hans de Goede 2017-07-06 326 bo->placements[i].fpfn = 0; dd55d44f4 Hans de Goede 2017-07-06 327 bo->placements[i].lpfn = 0; dd55d44f4 Hans de Goede 2017-07-06 328 } dd55d44f4 Hans de Goede 2017-07-06 329 } dd55d44f4 Hans de Goede 2017-07-06 330 dd55d44f4 Hans de Goede 2017-07-06 331 int vbox_bo_create(struct drm_device *dev, int size, int align, dd55d44f4 Hans de Goede 2017-07-06 332 u32 flags, struct vbox_bo **pvboxbo) dd55d44f4 Hans de Goede 2017-07-06 333 { dd55d44f4 Hans de Goede 2017-07-06 334 struct vbox_private *vbox = dev->dev_private; dd55d44f4 Hans de Goede 2017-07-06 335 struct vbox_bo *vboxbo; dd55d44f4 Hans de Goede 2017-07-06 336 size_t acc_size; dd55d44f4 Hans de Goede 2017-07-06 337 int ret; dd55d44f4 Hans de Goede 2017-07-06 338 dd55d44f4 Hans de Goede 2017-07-06 339 vboxbo = kzalloc(sizeof(*vboxbo), GFP_KERNEL); dd55d44f4 Hans de Goede 2017-07-06 340 if (!vboxbo) dd55d44f4 Hans de Goede 2017-07-06 341 return -ENOMEM; dd55d44f4 Hans de Goede 2017-07-06 342 dd55d44f4 Hans de Goede 2017-07-06 343 ret = drm_gem_object_init(dev, &vboxbo->gem, size); dd55d44f4 Hans de Goede 2017-07-06 344 if (ret) dd55d44f4 Hans de Goede 2017-07-06 345 goto err_free_vboxbo; dd55d44f4 Hans de Goede 2017-07-06 346 dd55d44f4 Hans de Goede 2017-07-06 347 vboxbo->bo.bdev = &vbox->ttm.bdev; dd55d44f4 Hans de Goede 2017-07-06 348 dd55d44f4 Hans de Goede 2017-07-06 349 vbox_ttm_placement(vboxbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); dd55d44f4 Hans de Goede 2017-07-06 350 dd55d44f4 Hans de Goede 2017-07-06 351 acc_size = ttm_bo_dma_acc_size(&vbox->ttm.bdev, size, dd55d44f4 Hans de Goede 2017-07-06 352 sizeof(struct vbox_bo)); dd55d44f4 Hans de Goede 2017-07-06 353 dd55d44f4 Hans de Goede 2017-07-06 354 ret = ttm_bo_init(&vbox->ttm.bdev, &vboxbo->bo, size, dd55d44f4 Hans de Goede 2017-07-06 355 ttm_bo_type_device, &vboxbo->placement, dd55d44f4 Hans de Goede 2017-07-06 356 align >> PAGE_SHIFT, false, NULL, acc_size, dd55d44f4 Hans de Goede 2017-07-06 357 NULL, NULL, vbox_bo_ttm_destroy); dd55d44f4 Hans de Goede 2017-07-06 358 if (ret) dd55d44f4 Hans de Goede 2017-07-06 359 goto err_free_vboxbo; dd55d44f4 Hans de Goede 2017-07-06 360 dd55d44f4 Hans de Goede 2017-07-06 361 *pvboxbo = vboxbo; dd55d44f4 Hans de Goede 2017-07-06 362 dd55d44f4 Hans de Goede 2017-07-06 363 return 0; dd55d44f4 Hans de Goede 2017-07-06 364 dd55d44f4 Hans de Goede 2017-07-06 365 err_free_vboxbo: dd55d44f4 Hans de Goede 2017-07-06 366 kfree(vboxbo); dd55d44f4 Hans de Goede 2017-07-06 367 return ret; dd55d44f4 Hans de Goede 2017-07-06 368 } dd55d44f4 Hans de Goede 2017-07-06 369 dd55d44f4 Hans de Goede 2017-07-06 370 static inline u64 vbox_bo_gpu_offset(struct vbox_bo *bo) dd55d44f4 Hans de Goede 2017-07-06 371 { dd55d44f4 Hans de Goede 2017-07-06 372 return bo->bo.offset; dd55d44f4 Hans de Goede 2017-07-06 373 } dd55d44f4 Hans de Goede 2017-07-06 374 dd55d44f4 Hans de Goede 2017-07-06 375 int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr) dd55d44f4 Hans de Goede 2017-07-06 376 { dd55d44f4 Hans de Goede 2017-07-06 377 int i, ret; dd55d44f4 Hans de Goede 2017-07-06 378 dd55d44f4 Hans de Goede 2017-07-06 379 if (bo->pin_count) { dd55d44f4 Hans de Goede 2017-07-06 380 bo->pin_count++; dd55d44f4 Hans de Goede 2017-07-06 381 if (gpu_addr) dd55d44f4 Hans de Goede 2017-07-06 382 *gpu_addr = vbox_bo_gpu_offset(bo); dd55d44f4 Hans de Goede 2017-07-06 383 dd55d44f4 Hans de Goede 2017-07-06 384 return 0; dd55d44f4 Hans de Goede 2017-07-06 385 } dd55d44f4 Hans de Goede 2017-07-06 386 dd55d44f4 Hans de Goede 2017-07-06 387 vbox_ttm_placement(bo, pl_flag); dd55d44f4 Hans de Goede 2017-07-06 388 dd55d44f4 Hans de Goede 2017-07-06 389 for (i = 0; i < bo->placement.num_placement; i++) dd55d44f4 Hans de Goede 2017-07-06 390 bo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT; dd55d44f4 Hans de Goede 2017-07-06 391 dd55d44f4 Hans de Goede 2017-07-06 @392 ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); dd55d44f4 Hans de Goede 2017-07-06 393 if (ret) dd55d44f4 Hans de Goede 2017-07-06 394 return ret; dd55d44f4 Hans de Goede 2017-07-06 395 dd55d44f4 Hans de Goede 2017-07-06 396 bo->pin_count = 1; dd55d44f4 Hans de Goede 2017-07-06 397 dd55d44f4 Hans de Goede 2017-07-06 398 if (gpu_addr) dd55d44f4 Hans de Goede 2017-07-06 399 *gpu_addr = vbox_bo_gpu_offset(bo); dd55d44f4 Hans de Goede 2017-07-06 400 dd55d44f4 Hans de Goede 2017-07-06 401 return 0; dd55d44f4 Hans de Goede 2017-07-06 402 } dd55d44f4 Hans de Goede 2017-07-06 403 :::::: The code at line 392 was first introduced by commit :::::: dd55d44f408419278c00887bfcb2261d0caae350 staging: vboxvideo: Add vboxvideo to drivers/staging :::::: TO: Hans de Goede <hdegoede@xxxxxxxxxx> :::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel