drm/xe/vm: Update xe_vma_ops_incr_pt_update_ops to take an increment value
Prefetch for SVM ranges can have more than one operation to increment, hence modify the function to accept an increment value as input. v2: - Call xe_vma_ops_incr_pt_update_ops only once for REMAP (Matthew Brost) - Add check for 0 ops v3: - s/u8/int for inc_val and num_remap_ops (Matthew Brost) Suggested-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Acked-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Link: https://lore.kernel.org/r/20250513040228.470682-7-himal.prasad.ghimiray@intel.com Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
This commit is contained in:
+17
-11
@@ -806,13 +806,16 @@ static void xe_vma_ops_fini(struct xe_vma_ops *vops)
|
||||
kfree(vops->pt_update_ops[i].ops);
|
||||
}
|
||||
|
||||
static void xe_vma_ops_incr_pt_update_ops(struct xe_vma_ops *vops, u8 tile_mask)
|
||||
static void xe_vma_ops_incr_pt_update_ops(struct xe_vma_ops *vops, u8 tile_mask, int inc_val)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!inc_val)
|
||||
return;
|
||||
|
||||
for (i = 0; i < XE_MAX_TILES_PER_DEVICE; ++i)
|
||||
if (BIT(i) & tile_mask)
|
||||
++vops->pt_update_ops[i].num_ops;
|
||||
vops->pt_update_ops[i].num_ops += inc_val;
|
||||
}
|
||||
|
||||
static void xe_vm_populate_rebind(struct xe_vma_op *op, struct xe_vma *vma,
|
||||
@@ -842,7 +845,7 @@ static int xe_vm_ops_add_rebind(struct xe_vma_ops *vops, struct xe_vma *vma,
|
||||
|
||||
xe_vm_populate_rebind(op, vma, tile_mask);
|
||||
list_add_tail(&op->link, &vops->list);
|
||||
xe_vma_ops_incr_pt_update_ops(vops, tile_mask);
|
||||
xe_vma_ops_incr_pt_update_ops(vops, tile_mask, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -977,7 +980,7 @@ xe_vm_ops_add_range_rebind(struct xe_vma_ops *vops,
|
||||
|
||||
xe_vm_populate_range_rebind(op, vma, range, tile_mask);
|
||||
list_add_tail(&op->link, &vops->list);
|
||||
xe_vma_ops_incr_pt_update_ops(vops, tile_mask);
|
||||
xe_vma_ops_incr_pt_update_ops(vops, tile_mask, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1062,7 +1065,7 @@ xe_vm_ops_add_range_unbind(struct xe_vma_ops *vops,
|
||||
|
||||
xe_vm_populate_range_unbind(op, range);
|
||||
list_add_tail(&op->link, &vops->list);
|
||||
xe_vma_ops_incr_pt_update_ops(vops, range->tile_present);
|
||||
xe_vma_ops_incr_pt_update_ops(vops, range->tile_present, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2493,7 +2496,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
|
||||
!op->map.is_cpu_addr_mirror) ||
|
||||
op->map.invalidate_on_bind)
|
||||
xe_vma_ops_incr_pt_update_ops(vops,
|
||||
op->tile_mask);
|
||||
op->tile_mask, 1);
|
||||
break;
|
||||
}
|
||||
case DRM_GPUVA_OP_REMAP:
|
||||
@@ -2502,6 +2505,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
|
||||
gpuva_to_vma(op->base.remap.unmap->va);
|
||||
bool skip = xe_vma_is_cpu_addr_mirror(old);
|
||||
u64 start = xe_vma_start(old), end = xe_vma_end(old);
|
||||
int num_remap_ops = 0;
|
||||
|
||||
if (op->base.remap.prev)
|
||||
start = op->base.remap.prev->va.addr +
|
||||
@@ -2554,7 +2558,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
|
||||
(ULL)op->remap.start,
|
||||
(ULL)op->remap.range);
|
||||
} else {
|
||||
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
|
||||
num_remap_ops++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2583,11 +2587,13 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
|
||||
(ULL)op->remap.start,
|
||||
(ULL)op->remap.range);
|
||||
} else {
|
||||
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
|
||||
num_remap_ops++;
|
||||
}
|
||||
}
|
||||
if (!skip)
|
||||
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
|
||||
num_remap_ops++;
|
||||
|
||||
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask, num_remap_ops);
|
||||
break;
|
||||
}
|
||||
case DRM_GPUVA_OP_UNMAP:
|
||||
@@ -2599,7 +2605,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
|
||||
return -EBUSY;
|
||||
|
||||
if (!xe_vma_is_cpu_addr_mirror(vma))
|
||||
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
|
||||
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask, 1);
|
||||
break;
|
||||
case DRM_GPUVA_OP_PREFETCH:
|
||||
vma = gpuva_to_vma(op->base.prefetch.va);
|
||||
@@ -2611,7 +2617,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
|
||||
}
|
||||
|
||||
if (!xe_vma_is_cpu_addr_mirror(vma))
|
||||
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
|
||||
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask, 1);
|
||||
break;
|
||||
default:
|
||||
drm_warn(&vm->xe->drm, "NOT POSSIBLE");
|
||||
|
||||
Reference in New Issue
Block a user