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

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe: Use proper vram offset

In xe_migrate functions, use proper vram io offset of the
tiles while calculating addresses.

Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Niranjana Vishwanathapura and committed by
Rodrigo Vivi
c33a7219 370997d1

+15 -11
+6 -6
drivers/gpu/drm/xe/xe_bo.c
··· 1206 1206 * XXX: This is in the VM bind data path, likely should calculate this once and 1207 1207 * store, with a recalculation if the BO is moved. 1208 1208 */ 1209 - static uint64_t vram_region_io_offset(struct xe_bo *bo) 1209 + uint64_t vram_region_io_offset(struct ttm_resource *res) 1210 1210 { 1211 - struct xe_device *xe = xe_bo_device(bo); 1212 - struct xe_gt *gt = mem_type_to_gt(xe, bo->ttm.resource->mem_type); 1211 + struct xe_device *xe = ttm_to_xe_device(res->bo->bdev); 1212 + struct xe_gt *gt = mem_type_to_gt(xe, res->mem_type); 1213 1213 1214 - if (bo->ttm.resource->mem_type == XE_PL_STOLEN) 1214 + if (res->mem_type == XE_PL_STOLEN) 1215 1215 return xe_ttm_stolen_gpu_offset(xe); 1216 1216 1217 1217 return gt->mem.vram.io_start - xe->mem.vram.io_start; ··· 1298 1298 XE_BUG_ON(!(place->flags & TTM_PL_FLAG_CONTIGUOUS)); 1299 1299 1300 1300 place->fpfn = (xe_bo_addr(bo, 0, PAGE_SIZE, &vram) - 1301 - vram_region_io_offset(bo)) >> PAGE_SHIFT; 1301 + vram_region_io_offset(bo->ttm.resource)) >> PAGE_SHIFT; 1302 1302 place->lpfn = place->fpfn + (bo->size >> PAGE_SHIFT); 1303 1303 1304 1304 spin_lock(&xe->pinned.lock); ··· 1442 1442 1443 1443 xe_res_first(bo->ttm.resource, page << PAGE_SHIFT, 1444 1444 page_size, &cur); 1445 - return cur.start + offset + vram_region_io_offset(bo); 1445 + return cur.start + offset + vram_region_io_offset(bo->ttm.resource); 1446 1446 } 1447 1447 } 1448 1448
+1
drivers/gpu/drm/xe/xe_bo.h
··· 224 224 bool mem_type_is_vram(u32 mem_type); 225 225 bool xe_bo_is_vram(struct xe_bo *bo); 226 226 bool xe_bo_is_stolen(struct xe_bo *bo); 227 + uint64_t vram_region_io_offset(struct ttm_resource *res); 227 228 228 229 bool xe_bo_can_migrate(struct xe_bo *bo, u32 mem_type); 229 230
+8 -5
drivers/gpu/drm/xe/xe_migrate.c
··· 392 392 393 393 static u32 pte_update_size(struct xe_migrate *m, 394 394 bool is_vram, 395 + struct ttm_resource *res, 395 396 struct xe_res_cursor *cur, 396 397 u64 *L0, u64 *L0_ofs, u32 *L0_pt, 397 398 u32 cmd_size, u32 pt_ofs, u32 avail_pts) ··· 418 417 cmds += cmd_size; 419 418 } else { 420 419 /* Offset into identity map. */ 421 - *L0_ofs = xe_migrate_vram_ofs(cur->start); 420 + *L0_ofs = xe_migrate_vram_ofs(cur->start + 421 + vram_region_io_offset(res)); 422 422 cmds += cmd_size; 423 423 } 424 424 ··· 469 467 addr |= GEN12_PTE_PS64; 470 468 } 471 469 470 + addr += vram_region_io_offset(bo->ttm.resource); 472 471 addr |= GEN12_PPGTT_PTE_LM; 473 472 } 474 473 addr |= PPAT_CACHED | GEN8_PAGE_PRESENT | GEN8_PAGE_RW; ··· 649 646 650 647 src_L0 = min(src_L0, dst_L0); 651 648 652 - batch_size += pte_update_size(m, src_is_vram, &src_it, &src_L0, 649 + batch_size += pte_update_size(m, src_is_vram, src, &src_it, &src_L0, 653 650 &src_L0_ofs, &src_L0_pt, 0, 0, 654 651 NUM_PT_PER_BLIT); 655 652 656 - batch_size += pte_update_size(m, dst_is_vram, &dst_it, &src_L0, 653 + batch_size += pte_update_size(m, dst_is_vram, dst, &dst_it, &src_L0, 657 654 &dst_L0_ofs, &dst_L0_pt, 0, 658 655 NUM_PT_PER_BLIT, NUM_PT_PER_BLIT); 659 656 660 657 if (copy_system_ccs) { 661 658 ccs_size = xe_device_ccs_bytes(xe, src_L0); 662 - batch_size += pte_update_size(m, false, &ccs_it, &ccs_size, 659 + batch_size += pte_update_size(m, false, NULL, &ccs_it, &ccs_size, 663 660 &ccs_ofs, &ccs_pt, 0, 664 661 2 * NUM_PT_PER_BLIT, 665 662 NUM_PT_PER_BLIT); ··· 882 879 883 880 /* Calculate final sizes and batch size.. */ 884 881 batch_size = 2 + 885 - pte_update_size(m, clear_vram, &src_it, 882 + pte_update_size(m, clear_vram, src, &src_it, 886 883 &clear_L0, &clear_L0_ofs, &clear_L0_pt, 887 884 emit_clear_cmd_len(xe), 0, 888 885 NUM_PT_PER_BLIT);