171static inline void drm_gpuva_invalidate(
struct drm_gpuva *
va,
bool invalidate)
176 va->flags &= ~DRM_GPUVA_INVALIDATED;
186static inline bool drm_gpuva_invalidated(
struct drm_gpuva *
va)
347 u64 start_offset,
u64 range,
348 u64 reserve_offset,
u64 reserve_range,
363 kref_get(&gpuvm->
kref);
384drm_gpuvm_resv_protected(
struct drm_gpuvm *gpuvm)
397drm_gpuvm_immediate_mode(
struct drm_gpuvm *gpuvm)
408#define drm_gpuvm_resv(gpuvm__) ((gpuvm__)->r_obj->resv)
418#define drm_gpuvm_resv_obj(gpuvm__) ((gpuvm__)->r_obj)
420#define drm_gpuvm_resv_held(gpuvm__) \
421 dma_resv_held(drm_gpuvm_resv(gpuvm__))
423#define drm_gpuvm_resv_assert_held(gpuvm__) \
424 dma_resv_assert_held(drm_gpuvm_resv(gpuvm__))
426#define drm_gpuvm_resv_held(gpuvm__) \
427 dma_resv_held(drm_gpuvm_resv(gpuvm__))
429#define drm_gpuvm_resv_assert_held(gpuvm__) \
430 dma_resv_assert_held(drm_gpuvm_resv(gpuvm__))
442drm_gpuvm_is_extobj(
struct drm_gpuvm *gpuvm,
451 if (
va && !list_is_last(&
va->rb.entry, &
va->vm->rb.list))
473#define drm_gpuvm_for_each_va_range(va__, gpuvm__, start__, end__) \
474 for (va__ = drm_gpuva_find_first((gpuvm__), (start__), (end__) - (start__)); \
475 va__ && (va__->va.addr < (end__)); \
476 va__ = __drm_gpuva_next(va__))
496#define drm_gpuvm_for_each_va_range_safe(va__, next__, gpuvm__, start__, end__) \
497 for (va__ = drm_gpuva_find_first((gpuvm__), (start__), (end__) - (start__)), \
498 next__ = __drm_gpuva_next(va__); \
499 va__ && (va__->va.addr < (end__)); \
500 va__ = next__, next__ = __drm_gpuva_next(va__))
510#define drm_gpuvm_for_each_va(va__, gpuvm__) \
511 list_for_each_entry(va__, &(gpuvm__)->rb.list, rb.entry)
523#define drm_gpuvm_for_each_va_safe(va__, next__, gpuvm__) \
524 list_for_each_entry_safe(va__, next__, &(gpuvm__)->rb.list, rb.entry)
590 unsigned int num_objs);
633 private_usage, extobj_usage);
756 kref_get(&vm_bo->
kref);
802#define drm_gpuvm_bo_for_each_va(va__, vm_bo__) \
803 list_for_each_entry(va__, &(vm_bo)->list.gpuva, gem.entry)
818#define drm_gpuvm_bo_for_each_va_safe(va__, next__, vm_bo__) \
819 list_for_each_entry_safe(va__, next__, &(vm_bo)->list.gpuva, gem.entry)
1031#define drm_gpuva_for_each_op(op, ops) list_for_each_entry(op, &(ops)->list, entry)
1042#define drm_gpuva_for_each_op_safe(op, next, ops) \
1043 list_for_each_entry_safe(op, next, &(ops)->list, entry)
1053#define drm_gpuva_for_each_op_from_reverse(op, ops) \
1054 list_for_each_entry_from_reverse(op, &(ops)->list, entry)
1063#define drm_gpuva_for_each_op_reverse(op, ops) \
1064 list_for_each_entry_reverse(op, &(ops)->list, entry)
1070#define drm_gpuva_first_op(ops) \
1071 list_first_entry(&(ops)->list, struct drm_gpuva_op, entry)
1077#define drm_gpuva_last_op(ops) \
1078 list_last_entry(&(ops)->list, struct drm_gpuva_op, entry)
1084#define drm_gpuva_prev_op(op) list_prev_entry(op, entry)
1090#define drm_gpuva_next_op(op) list_next_entry(op, entry)
1123static inline void drm_gpuva_init_from_op(
struct drm_gpuva *
va,
1260 struct drm_exec *exec,
unsigned int num_fences,
1264 u64 req_addr,
u64 req_range);
1289 u64 *start_addr,
u64 *range)
1292 op->prev->va.addr +
op->prev->va.range :
1293 op->unmap->va->va.addr;
1296 op->unmap->va->va.addr +
op->unmap->va->va.range;
#define list_next_entry(pos, member)
Definition list.h:27
uint8_t flags
Definition virtio.h:0
XEProcessList * list
Definition main.cpp:27
#define va_end(ap)
Definition acmsvcex.h:198
#define va_start(ap, A)
Definition acmsvcex.h:199
#define NULL
Definition actypes.h:561
void * fn
Definition audrv.c:980
#define BIT(nr)
Definition bitops.h:112
int map
Definition d_mode.c:31
dma_resv_usage
Definition dma-resv.h:71
struct drm_crtc struct drm_plane struct drm_plane const struct drm_crtc_funcs const char * name
Definition drm_crtc.h:1242
void drm_exec_fini(struct drm_exec *exec)
#define drm_gem_for_each_gpuvm_bo(entry__, obj__)
Definition drm_gem.h:682
#define drm_gem_gpuva_assert_lock_held(gpuvm, obj)
Definition drm_gem.h:655
int drm_gpuvm_sm_map_exec_lock(struct drm_gpuvm *gpuvm, struct drm_exec *exec, unsigned int num_fences, struct drm_gpuvm_map_req *req)
int drm_gpuva_insert(struct drm_gpuvm *gpuvm, struct drm_gpuva *va)
struct drm_gpuva * drm_gpuva_find_prev(struct drm_gpuvm *gpuvm, u64 start)
struct drm_gpuvm_bo * drm_gpuvm_bo_obtain_locked(struct drm_gpuvm *gpuvm, struct drm_gem_object *obj)
bool drm_gpuvm_bo_put(struct drm_gpuvm_bo *vm_bo)
int drm_gpuvm_prepare_vm(struct drm_gpuvm *gpuvm, struct drm_exec *exec, unsigned int num_fences)
void drm_gpuvm_bo_extobj_add(struct drm_gpuvm_bo *vm_bo)
struct drm_gpuvm_bo * drm_gpuvm_bo_obtain_prealloc(struct drm_gpuvm_bo *vm_bo)
void drm_gpuva_unmap(const struct drm_gpuva_op_unmap *op)
int drm_gpuvm_validate(struct drm_gpuvm *gpuvm, struct drm_exec *exec)
int drm_gpuvm_prepare_range(struct drm_gpuvm *gpuvm, struct drm_exec *exec, u64 addr, u64 range, unsigned int num_fences)
int drm_gpuvm_exec_lock(struct drm_gpuvm_exec *vm_exec)
struct drm_gpuva * drm_gpuva_find_first(struct drm_gpuvm *gpuvm, u64 addr, u64 range)
void drm_gpuvm_resv_add_fence(struct drm_gpuvm *gpuvm, struct drm_exec *exec, struct dma_fence *fence, enum dma_resv_usage private_usage, enum dma_resv_usage extobj_usage)
void drm_gpuva_map(struct drm_gpuvm *gpuvm, struct drm_gpuva *va, const struct drm_gpuva_op_map *op)
void drm_gpuva_link(struct drm_gpuva *va, struct drm_gpuvm_bo *vm_bo)
void drm_gpuva_unlink_defer(struct drm_gpuva *va)
void drm_gpuva_remap(struct drm_gpuva *prev, struct drm_gpuva *next, const struct drm_gpuva_op_remap *op)
drm_gpuvm_flags
Definition drm_gpuvm.h:194
@ DRM_GPUVM_IMMEDIATE_MODE
Definition drm_gpuvm.h:209
@ DRM_GPUVM_RESV_PROTECTED
Definition drm_gpuvm.h:199
@ DRM_GPUVM_USERBITS
Definition drm_gpuvm.h:214
int drm_gpuvm_exec_lock_array(struct drm_gpuvm_exec *vm_exec, struct drm_gem_object **objs, unsigned int num_objs)
struct drm_gpuva_ops * drm_gpuvm_bo_unmap_ops_create(struct drm_gpuvm_bo *vm_bo)
bool drm_gpuvm_range_valid(struct drm_gpuvm *gpuvm, u64 addr, u64 range)
void drm_gpuvm_put(struct drm_gpuvm *gpuvm)
struct drm_gpuva * drm_gpuva_find_next(struct drm_gpuvm *gpuvm, u64 end)
void drm_gpuva_ops_free(struct drm_gpuvm *gpuvm, struct drm_gpuva_ops *ops)
int drm_gpuvm_prepare_objects(struct drm_gpuvm *gpuvm, struct drm_exec *exec, unsigned int num_fences)
void drm_gpuvm_bo_deferred_cleanup(struct drm_gpuvm *gpuvm)
struct drm_gpuva * drm_gpuva_find(struct drm_gpuvm *gpuvm, u64 addr, u64 range)
void drm_gpuvm_init(struct drm_gpuvm *gpuvm, const char *name, enum drm_gpuvm_flags flags, struct drm_device *drm, struct drm_gem_object *r_obj, u64 start_offset, u64 range, u64 reserve_offset, u64 reserve_range, const struct drm_gpuvm_ops *ops)
struct drm_gpuva_ops * drm_gpuvm_madvise_ops_create(struct drm_gpuvm *gpuvm, const struct drm_gpuvm_map_req *req)
int drm_gpuvm_exec_lock_range(struct drm_gpuvm_exec *vm_exec, u64 addr, u64 range)
void drm_gpuva_remove(struct drm_gpuva *va)
int drm_gpuvm_sm_map(struct drm_gpuvm *gpuvm, void *priv, const struct drm_gpuvm_map_req *req)
struct drm_gpuvm_bo * drm_gpuvm_bo_create(struct drm_gpuvm *gpuvm, struct drm_gem_object *obj)
bool drm_gpuvm_bo_put_deferred(struct drm_gpuvm_bo *vm_bo)
struct drm_gpuvm_bo * drm_gpuvm_bo_find(struct drm_gpuvm *gpuvm, struct drm_gem_object *obj)
int drm_gpuvm_sm_unmap(struct drm_gpuvm *gpuvm, void *priv, u64 addr, u64 range)
int drm_gpuvm_sm_unmap_exec_lock(struct drm_gpuvm *gpuvm, struct drm_exec *exec, u64 req_addr, u64 req_range)
drm_gpuva_flags
Definition drm_gpuvm.h:45
@ DRM_GPUVA_USERBITS
Definition drm_gpuvm.h:63
@ DRM_GPUVA_SPARSE
Definition drm_gpuvm.h:58
@ DRM_GPUVA_INVALIDATED
Definition drm_gpuvm.h:51
struct drm_gpuva_ops * drm_gpuvm_prefetch_ops_create(struct drm_gpuvm *gpuvm, u64 addr, u64 range)
#define drm_gpuvm_resv(gpuvm__)
Definition drm_gpuvm.h:408
struct drm_gpuva_ops * drm_gpuvm_sm_unmap_ops_create(struct drm_gpuvm *gpuvm, u64 addr, u64 range)
struct drm_gpuva_ops * drm_gpuvm_sm_map_ops_create(struct drm_gpuvm *gpuvm, const struct drm_gpuvm_map_req *req)
void drm_gpuvm_bo_evict(struct drm_gpuvm_bo *vm_bo, bool evict)
bool drm_gpuvm_interval_empty(struct drm_gpuvm *gpuvm, u64 addr, u64 range)
drm_gpuva_op_type
Definition drm_gpuvm.h:826
@ DRM_GPUVA_OP_PREFETCH
Definition drm_gpuvm.h:845
@ DRM_GPUVA_OP_REMAP
Definition drm_gpuvm.h:835
@ DRM_GPUVA_OP_MAP
Definition drm_gpuvm.h:830
@ DRM_GPUVA_OP_DRIVER
Definition drm_gpuvm.h:850
@ DRM_GPUVA_OP_UNMAP
Definition drm_gpuvm.h:840
struct drm_gem_object * drm_gpuvm_resv_object_alloc(struct drm_device *drm)
void drm_gpuva_unlink(struct drm_gpuva *va)
const char va_list * va
Definition drm_print.h:222
void int node
Definition kthread.h:31
uint64_t u64
Definition kernel.h:17
int spinlock_t
Definition kernel.h:44
uint32_t u32
Definition kernel.h:16
void(* entry)(void *)
Definition process.h:101
Definition dma-fence.h:70
Definition drm_device.h:75
struct dma_resv * resv
Definition drm_gem.h:386
Definition drm_gpuvm.h:859
u64 addr
Definition drm_gpuvm.h:868
struct drm_gpuva_op_map::@45 gem
u64 range
Definition drm_gpuvm.h:873
struct drm_gpuva_op_map::@44 va
u64 offset
Definition drm_gpuvm.h:883
struct drm_gem_object * obj
Definition drm_gpuvm.h:888
Definition drm_gpuvm.h:963
struct drm_gpuva * va
Definition drm_gpuvm.h:967
Definition drm_gpuvm.h:940
struct drm_gpuva_op_map * next
Definition drm_gpuvm.h:949
struct drm_gpuva_op_map * prev
Definition drm_gpuvm.h:944
struct drm_gpuva_op_unmap * unmap
Definition drm_gpuvm.h:954
Definition drm_gpuvm.h:898
struct drm_gpuva * va
Definition drm_gpuvm.h:902
bool keep
Definition drm_gpuvm.h:914
Definition drm_gpuvm.h:977
struct list_head entry
Definition drm_gpuvm.h:984
enum drm_gpuva_op_type op
Definition drm_gpuvm.h:989
Definition drm_gpuvm.h:1017
struct list_head list
Definition drm_gpuvm.h:1021
Definition drm_gpuvm.h:74
struct list_head entry
Definition drm_gpuvm.h:123
struct drm_gem_object * obj
Definition drm_gpuvm.h:118
struct drm_gpuva::@36 gem
u64 addr
Definition drm_gpuvm.h:98
u64 range
Definition drm_gpuvm.h:103
u64 __subtree_last
Definition drm_gpuvm.h:147
u64 offset
Definition drm_gpuvm.h:113
struct drm_gpuvm_bo * vm_bo
Definition drm_gpuvm.h:84
struct drm_gpuvm * vm
Definition drm_gpuvm.h:78
enum drm_gpuva_flags flags
Definition drm_gpuvm.h:89
Definition drm_gpuvm.h:666
struct drm_gpuvm * vm
Definition drm_gpuvm.h:671
struct list_head evict
Definition drm_gpuvm.h:723
bool evicted
Definition drm_gpuvm.h:683
struct kref kref
Definition drm_gpuvm.h:688
struct drm_gpuvm_bo::@42::@43 entry
struct drm_gpuvm_bo::@42 list
struct drm_gem_object * obj
Definition drm_gpuvm.h:677
struct list_head gpuva
Definition drm_gpuvm.h:700
Definition drm_gpuvm.h:533
struct drm_exec exec
Definition drm_gpuvm.h:537
struct drm_gpuvm * vm
Definition drm_gpuvm.h:547
unsigned int num_fences
Definition drm_gpuvm.h:553
void * priv
Definition drm_gpuvm.h:569
struct drm_gpuvm_exec::@41 extra
u32 flags
Definition drm_gpuvm.h:542
Definition drm_gpuvm.h:1095
struct drm_gpuva_op_map map
Definition drm_gpuvm.h:1099
Definition drm_gpuvm.h:1139
int(* sm_step_map)(struct drm_gpuva_op *op, void *priv)
Definition drm_gpuvm.h:1217
int(* vm_bo_validate)(struct drm_gpuvm_bo *vm_bo, struct drm_exec *exec)
Definition drm_gpuvm.h:1205
void(* vm_bo_free)(struct drm_gpuvm_bo *vm_bo)
Definition drm_gpuvm.h:1194
int(* sm_step_unmap)(struct drm_gpuva_op *op, void *priv)
Definition drm_gpuvm.h:1250
void(* op_free)(struct drm_gpuva_op *op)
Definition drm_gpuvm.h:1170
void(* vm_free)(struct drm_gpuvm *gpuvm)
Definition drm_gpuvm.h:1146
int(* sm_step_remap)(struct drm_gpuva_op *op, void *priv)
Definition drm_gpuvm.h:1234
Definition drm_gpuvm.h:229
enum drm_gpuvm_flags flags
Definition drm_gpuvm.h:238
const struct drm_gpuvm_ops * ops
Definition drm_gpuvm.h:286
struct drm_gpuva kernel_alloc_node
Definition drm_gpuvm.h:281
u64 mm_range
Definition drm_gpuvm.h:253
spinlock_t lock
Definition drm_gpuvm.h:312
const char * name
Definition drm_gpuvm.h:233
struct list_head * local_list
Definition drm_gpuvm.h:307
struct kref kref
Definition drm_gpuvm.h:273
struct drm_gpuvm::@39 extobj
struct drm_gpuvm::@40 evict
struct drm_gem_object * r_obj
Definition drm_gpuvm.h:291
u64 mm_start
Definition drm_gpuvm.h:248
struct llist_head bo_defer
Definition drm_gpuvm.h:340
struct drm_device * drm
Definition drm_gpuvm.h:243
Definition rbtree_types.h:21
Definition rbtree_types.h:48