Commit c47794bd authored by Matthew Brost's avatar Matthew Brost Committed by Rodrigo Vivi

drm/xe: Set max pte size when skipping rebinds

When a rebind is skipped, we must set the max pte size of the newly
created vma to value of the old vma as we do not pte walk for the new
vma. Without this future rebinds may be incorrectly skipped due to the
wrong max pte size. Null binds are more likely to expose this bug as
larger ptes are more frequently used compared to normal bindings.
Reviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Testcase: dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_24
Reported-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Fixes: 8f33b4f0 ("drm/xe: Avoid doing rebinds")
Reference: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23045Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 31b57683
...@@ -2410,6 +2410,20 @@ static u64 xe_vma_max_pte_size(struct xe_vma *vma) ...@@ -2410,6 +2410,20 @@ static u64 xe_vma_max_pte_size(struct xe_vma *vma)
return SZ_4K; return SZ_4K;
} }
static u64 xe_vma_set_pte_size(struct xe_vma *vma, u64 size)
{
switch (size) {
case SZ_1G:
vma->gpuva.flags |= XE_VMA_PTE_1G;
break;
case SZ_2M:
vma->gpuva.flags |= XE_VMA_PTE_2M;
break;
}
return SZ_4K;
}
/* /*
* Parse operations list and create any resources needed for the operations * Parse operations list and create any resources needed for the operations
* prior to fully committing to the operations. This setup can fail. * prior to fully committing to the operations. This setup can fail.
...@@ -2520,6 +2534,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q, ...@@ -2520,6 +2534,7 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
IS_ALIGNED(xe_vma_end(vma), IS_ALIGNED(xe_vma_end(vma),
xe_vma_max_pte_size(old)); xe_vma_max_pte_size(old));
if (op->remap.skip_prev) { if (op->remap.skip_prev) {
xe_vma_set_pte_size(vma, xe_vma_max_pte_size(old));
op->remap.range -= op->remap.range -=
xe_vma_end(vma) - xe_vma_end(vma) -
xe_vma_start(old); xe_vma_start(old);
...@@ -2554,10 +2569,12 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q, ...@@ -2554,10 +2569,12 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct xe_exec_queue *q,
op->remap.skip_next = !xe_vma_is_userptr(old) && op->remap.skip_next = !xe_vma_is_userptr(old) &&
IS_ALIGNED(xe_vma_start(vma), IS_ALIGNED(xe_vma_start(vma),
xe_vma_max_pte_size(old)); xe_vma_max_pte_size(old));
if (op->remap.skip_next) if (op->remap.skip_next) {
xe_vma_set_pte_size(vma, xe_vma_max_pte_size(old));
op->remap.range -= op->remap.range -=
xe_vma_end(old) - xe_vma_end(old) -
xe_vma_start(vma); xe_vma_start(vma);
}
} }
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment