/** * xe_vm_has_scratch() - Whether the vm is configured for scratch PTEs * @vm: The vm * * Return: whether the vm populates unmapped areas with scratch PTEs
*/ staticinlinebool xe_vm_has_scratch(conststruct xe_vm *vm)
{ return vm->flags & XE_VM_FLAG_SCRATCH_PAGE;
}
/** * gpuvm_to_vm() - Return the embedding xe_vm from a struct drm_gpuvm pointer * @gpuvm: The struct drm_gpuvm pointer * * Return: Pointer to the embedding struct xe_vm.
*/ staticinlinestruct xe_vm *gpuvm_to_vm(struct drm_gpuvm *gpuvm)
{ return container_of(gpuvm, struct xe_vm, gpuvm);
}
/** * DOC: Provide accessors for vma members to facilitate easy change of * implementation.
*/ staticinline u64 xe_vma_start(struct xe_vma *vma)
{ return vma->gpuva.va.addr;
}
/** * xe_vm_reactivate_rebind() - Reactivate the rebind functionality on compute * vms. * @vm: The vm. * * If the rebind functionality on a compute vm was disabled due * to nothing to execute. Reactivate it and run the rebind worker. * This function should be called after submitting a batch to a compute vm.
*/ staticinlinevoid xe_vm_reactivate_rebind(struct xe_vm *vm)
{ if (xe_vm_in_preempt_fence_mode(vm) && vm->preempt.rebind_deactivated) {
vm->preempt.rebind_deactivated = false;
xe_vm_queue_rebind_worker(vm);
}
}
int xe_vma_userptr_pin_pages(struct xe_userptr_vma *uvma);
int xe_vma_userptr_check_repin(struct xe_userptr_vma *uvma);
bool xe_vm_validate_should_retry(struct drm_exec *exec, int err, ktime_t *end);
int xe_vm_lock_vma(struct drm_exec *exec, struct xe_vma *vma);
int xe_vm_validate_rebind(struct xe_vm *vm, struct drm_exec *exec, unsignedint num_fences);
/** * xe_vm_resv() - Return's the vm's reservation object * @vm: The vm * * Return: Pointer to the vm's reservation object.
*/ staticinlinestruct dma_resv *xe_vm_resv(struct xe_vm *vm)
{ return drm_gpuvm_resv(&vm->gpuvm);
}
void xe_vm_kill(struct xe_vm *vm, bool unlocked);
/** * xe_vm_assert_held(vm) - Assert that the vm's reservation object is held. * @vm: The vm
*/ #define xe_vm_assert_held(vm) dma_resv_assert_held(xe_vm_resv(vm))
/** * xe_vm_set_validating() - Register this task as currently making bos resident * @allow_res_evict: Allow eviction of buffer objects bound to @vm when * validating. * @vm: Pointer to the vm or NULL. * * Register this task as currently making bos resident for the vm. Intended * to avoid eviction by the same task of shared bos bound to the vm. * Call with the vm's resv lock held.
*/ staticinlinevoid xe_vm_set_validating(struct xe_vm *vm, bool allow_res_evict)
{ if (vm && !allow_res_evict) {
xe_vm_assert_held(vm); /* Pairs with READ_ONCE in xe_vm_is_validating() */
WRITE_ONCE(vm->validating, current);
}
}
/** * xe_vm_clear_validating() - Unregister this task as currently making bos resident * @vm: Pointer to the vm or NULL * @allow_res_evict: Eviction from @vm was allowed. Must be set to the same * value as for xe_vm_set_validation(). * * Register this task as currently making bos resident for the vm. Intended * to avoid eviction by the same task of shared bos bound to the vm. * Call with the vm's resv lock held.
*/ staticinlinevoid xe_vm_clear_validating(struct xe_vm *vm, bool allow_res_evict)
{ if (vm && !allow_res_evict) { /* Pairs with READ_ONCE in xe_vm_is_validating() */
WRITE_ONCE(vm->validating, NULL);
}
}
/** * xe_vm_is_validating() - Whether bos bound to the vm are currently being made resident * by the current task. * @vm: Pointer to the vm. * * If this function returns %true, we should be in a vm resv locked region, since * the current process is the same task that called xe_vm_set_validating(). * The function asserts that that's indeed the case. * * Return: %true if the task is currently making bos resident, %false otherwise.
*/ staticinlinebool xe_vm_is_validating(struct xe_vm *vm)
{ /* Pairs with WRITE_ONCE in xe_vm_is_validating() */ if (READ_ONCE(vm->validating) == current) {
xe_vm_assert_held(vm); returntrue;
} returnfalse;
}
/** * xe_vm_has_valid_gpu_mapping() - Advisory helper to check if VMA or SVM range has * a valid GPU mapping * @tile: The tile which the GPU mapping belongs to * @tile_present: Tile present mask * @tile_invalidated: Tile invalidated mask * * The READ_ONCEs pair with WRITE_ONCEs in either the TLB invalidation paths * (xe_vm.c, xe_svm.c) or the binding paths (xe_pt.c). These are not reliable * without the notifier lock in userptr or SVM cases, and not reliable without * the BO dma-resv lock in the BO case. As such, they should only be used in * opportunistic cases (e.g., skipping a page fault fix or not skipping a TLB * invalidation) where it is harmless. * * Return: True is there are valid GPU pages, False otherwise
*/ #define xe_vm_has_valid_gpu_mapping(tile, tile_present, tile_invalidated) \
((READ_ONCE(tile_present) & ~READ_ONCE(tile_invalidated)) & BIT((tile)->id))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.