| /linux/include/linux/ |
| H A D | dma-fence.h | 3 * Fence mechanism for dma-buf to allow for asynchronous dma access 33 * @refcount: refcount for this fence 34 * @ops: dma_fence_ops associated with this fence 35 * @rcu: used for releasing fence with kfree_rcu 39 * @context: execution context this fence belongs to, returned by 41 * @seqno: the sequence number of this fence inside the execution context, 42 * can be compared to decide which fence would be signaled later. 44 * @timestamp: Timestamp when the fence was signaled. 46 * dma_fence_signal, indicates that the fence has completed with an error. 52 * DMA_FENCE_FLAG_INITIALIZED_BIT - fence was initialized [all …]
|
| H A D | dma-fence-chain.h | 3 * fence-chain: chain fences together in a timeline 13 #include <linux/dma-fence.h> 18 * struct dma_fence_chain - fence to represent an node of a fence chain 19 * @base: fence base class 20 * @prev: previous fence of the chain 22 * @fence: encapsulated fence 28 struct dma_fence *fence; member 34 * complection of the fence chain. Never used at the same time 52 * to_dma_fence_chain - cast a fence to a dma_fence_chain 53 * @fence: fence to cast to a dma_fence_array [all …]
|
| H A D | dma-fence-array.h | 3 * fence-array: aggregates fence to be waited together 15 #include <linux/dma-fence.h> 19 * struct dma_fence_array_cb - callback helper for fence array 20 * @cb: fence callback structure for signaling 21 * @array: reference to the parent fence array object 29 * struct dma_fence_array - fence to represent an array of fences 30 * @base: fence base class 50 * to_dma_fence_array - cast a fence to a dma_fence_array 51 * @fence: fence to cast to a dma_fence_array 53 * Returns NULL if the fence is not a dma_fence_array, [all …]
|
| /linux/drivers/gpu/drm/i915/ |
| H A D | i915_sw_fence.c | 8 #include <linux/dma-fence.h> 49 static inline void debug_fence_init(struct i915_sw_fence *fence) in debug_fence_init() argument 51 debug_object_init(fence, &i915_sw_fence_debug_descr); in debug_fence_init() 54 static inline __maybe_unused void debug_fence_init_onstack(struct i915_sw_fence *fence) in debug_fence_init_onstack() argument 56 debug_object_init_on_stack(fence, &i915_sw_fence_debug_descr); in debug_fence_init_onstack() 59 static inline void debug_fence_activate(struct i915_sw_fence *fence) in debug_fence_activate() argument 61 debug_object_activate(fence, &i915_sw_fence_debug_descr); in debug_fence_activate() 64 static inline void debug_fence_set_state(struct i915_sw_fence *fence, in debug_fence_set_state() argument 67 debug_object_active_state(fence, &i915_sw_fence_debug_descr, old, new); in debug_fence_set_state() 70 static inline void debug_fence_deactivate(struct i915_sw_fence *fence) in debug_fence_deactivate() argument [all …]
|
| H A D | i915_sw_fence.h | 12 #include <linux/dma-fence.h> 42 void __i915_sw_fence_init(struct i915_sw_fence *fence, 47 #define i915_sw_fence_init(fence, fn) \ argument 52 __i915_sw_fence_init((fence), (fn), #fence, &__key); \ 55 #define i915_sw_fence_init(fence, fn) \ argument 58 __i915_sw_fence_init((fence), (fn), NULL, NULL); \ 62 void i915_sw_fence_reinit(struct i915_sw_fence *fence); 65 void i915_sw_fence_fini(struct i915_sw_fence *fence); 67 static inline void i915_sw_fence_fini(struct i915_sw_fence *fence) {} in i915_sw_fence_fini() argument 70 void i915_sw_fence_commit(struct i915_sw_fence *fence); [all …]
|
| H A D | i915_deps.c | 6 #include <linux/dma-fence.h> 18 * the migration fence with the unbind fences if these are coalesced 33 /* Min number of fence pointers in the array when an allocation occurs. */ 61 * This function drops all fence references taken, conditionally frees and 75 static int i915_deps_grow(struct i915_deps *deps, struct dma_fence *fence, in i915_deps_grow() argument 96 deps->fences[deps->num_deps++] = dma_fence_get(fence); in i915_deps_grow() 100 if (ctx->no_wait_gpu && !dma_fence_is_signaled(fence)) { in i915_deps_grow() 105 ret = dma_fence_wait(fence, ctx->interruptible); in i915_deps_grow() 109 ret = fence->error; in i915_deps_grow() 127 * encounters an error during the wait or a fence error, the wait for [all …]
|
| H A D | i915_active.h | 21 * "fence registers" but pipeline synchronisation objects ala GL_ARB_sync. 30 * In order to use a fence, the object must track the fence it needs to 34 * complete, or waiting for the last GPU user of a "fence register". The 38 * track the most recent fence request, typically this is done as part of 48 void i915_active_noop(struct dma_fence *fence, struct dma_fence_cb *cb); 53 * @fence: initial fence to track, can be NULL 58 * an activity tracker, that is for tracking the last known active fence 59 * associated with it. When the last fence becomes idle, when it is retired 64 void *fence, in __i915_active_fence_init() argument 67 RCU_INIT_POINTER(active->fence, fence); in __i915_active_fence_init() [all …]
|
| H A D | i915_active.c | 45 return IS_ERR(rcu_access_pointer(active->fence)); in is_barrier() 138 GEM_BUG_ON(rcu_access_pointer(ref->excl.fence)); in __active_retire() 206 return (struct dma_fence ** __force)&active->fence; in __active_fence_slot() 210 active_fence_cb(struct dma_fence *fence, struct dma_fence_cb *cb) in active_fence_cb() argument 215 return try_cmpxchg(__active_fence_slot(active), &fence, NULL); in active_fence_cb() 219 node_retire(struct dma_fence *fence, struct dma_fence_cb *cb) in node_retire() argument 221 if (active_fence_cb(fence, cb)) in node_retire() 226 excl_retire(struct dma_fence *fence, struct dma_fence_cb *cb) in excl_retire() argument 228 if (active_fence_cb(fence, cb)) in excl_retire() 434 struct dma_fence *fence = &rq->fence; in i915_active_add_request() local [all …]
|
| /linux/drivers/dma-buf/ |
| H A D | dma-fence.c | 3 * Fence mechanism for dma-buf and to allow for asynchronous dma access 16 #include <linux/dma-fence.h> 30 * fence context counter: each execution context should have its own 31 * fence context, this allows checking if fences belong to the same 44 * A fence is initialized using dma_fence_init() and completed using 59 * fence to be updated. 68 * DOC: fence cross-driver contract 94 * This means any code required for fence completion cannot acquire a 99 * callbacks. This means any code required for fence completion cannot 104 * for fence completion cannot allocate memory with GFP_NOFS or GFP_NOIO. [all …]
|
| H A D | sync_file.c | 8 #include <linux/dma-fence-unwrap.h> 58 * @fence: fence to add to the sync_fence 60 * Creates a sync_file containg @fence. This function acquires and additional 61 * reference of @fence for the newly-created &sync_file, if it succeeds. The 65 struct sync_file *sync_file_create(struct dma_fence *fence) in sync_file_create() argument 73 sync_file->fence = dma_fence_get(fence); in sync_file_create() 97 * sync_file_get_fence - get the fence related to the sync_file fd 98 * @fd: sync_file fd to get the fence from 100 * Ensures @fd references a valid sync_file and returns a fence that 101 * represents all fence in the sync_file. On error NULL is returned. [all …]
|
| /linux/drivers/gpu/drm/vmwgfx/ |
| H A D | vmwgfx_fence.c | 23 struct vmw_fence_obj fence; member 27 * struct vmw_event_fence_action - fence callback that delivers a DRM event. 33 * current time tv_sec val when the fence signals. 35 * be assigned the current time tv_usec val when the fence signals. 48 fman_from_fence(struct vmw_fence_obj *fence) in fman_from_fence() argument 50 return container_of(fence->base.extern_lock, struct vmw_fence_manager, in fman_from_fence() 56 struct vmw_fence_obj *fence = in vmw_fence_obj_destroy() local 58 struct vmw_fence_manager *fman = fman_from_fence(fence); in vmw_fence_obj_destroy() 60 if (!list_empty(&fence->head)) { in vmw_fence_obj_destroy() 61 /* The fence manager still has an implicit reference to this in vmw_fence_obj_destroy() [all …]
|
| /linux/drivers/gpu/drm/radeon/ |
| H A D | radeon_fence.c | 50 * for GPU/CPU synchronization. When the fence is written, 51 * it is expected that all buffers associated with that fence 59 * radeon_fence_write - write a fence value 63 * @ring: ring index the fence is associated with 65 * Writes a fence value to memory or a scratch register (all asics). 80 * radeon_fence_read - read a fence value 83 * @ring: ring index the fence is associated with 85 * Reads a fence value from memory or a scratch register (all asics). 86 * Returns the value of the fence read from memory or register. 124 * radeon_fence_emit - emit a fence on the requested ring [all …]
|
| H A D | radeon_sync.c | 55 * radeon_sync_fence - use the semaphore to sync to a fence 57 * @sync: sync object to add fence to 58 * @fence: fence to sync to 60 * Sync to the fence using the semaphore objects 63 struct radeon_fence *fence) in radeon_sync_fence() argument 67 if (!fence) in radeon_sync_fence() 70 other = sync->sync_to[fence->ring]; in radeon_sync_fence() 71 sync->sync_to[fence->ring] = radeon_fence_later(fence, other); in radeon_sync_fence() 73 if (fence->is_vm_update) { in radeon_sync_fence() 75 sync->last_vm_update = radeon_fence_later(fence, other); in radeon_sync_fence() [all …]
|
| /linux/drivers/gpu/drm/vgem/ |
| H A D | vgem_fence.c | 38 static const char *vgem_fence_get_driver_name(struct dma_fence *fence) in vgem_fence_get_driver_name() argument 43 static const char *vgem_fence_get_timeline_name(struct dma_fence *fence) in vgem_fence_get_timeline_name() argument 50 struct vgem_fence *fence = container_of(base, typeof(*fence), base); in vgem_fence_release() local 52 timer_delete_sync(&fence->timer); in vgem_fence_release() 53 dma_fence_free(&fence->base); in vgem_fence_release() 64 struct vgem_fence *fence = timer_container_of(fence, t, timer); in vgem_fence_timeout() local 66 dma_fence_signal(&fence->base); in vgem_fence_timeout() 72 struct vgem_fence *fence; in vgem_fence_create() local 74 fence = kzalloc_obj(*fence); in vgem_fence_create() 75 if (!fence) in vgem_fence_create() [all …]
|
| /linux/drivers/gpu/drm/xe/ |
| H A D | xe_tlb_inval.c | 32 static void xe_tlb_inval_fence_fini(struct xe_tlb_inval_fence *fence) in xe_tlb_inval_fence_fini() argument 34 if (WARN_ON_ONCE(!fence->tlb_inval)) in xe_tlb_inval_fence_fini() 37 xe_pm_runtime_put(fence->tlb_inval->xe); in xe_tlb_inval_fence_fini() 38 fence->tlb_inval = NULL; /* fini() should be called once */ in xe_tlb_inval_fence_fini() 42 xe_tlb_inval_fence_signal(struct xe_tlb_inval_fence *fence) in xe_tlb_inval_fence_signal() argument 44 struct xe_tlb_inval *tlb_inval = fence->tlb_inval; in xe_tlb_inval_fence_signal() 45 bool stack = test_bit(FENCE_STACK_BIT, &fence->base.flags); in xe_tlb_inval_fence_signal() 47 lockdep_assert_held(&fence->tlb_inval->pending_lock); in xe_tlb_inval_fence_signal() 49 list_del(&fence->link); in xe_tlb_inval_fence_signal() 52 trace_xe_tlb_inval_fence_signal(fence->tlb_inval->xe, fence); in xe_tlb_inval_fence_signal() [all …]
|
| H A D | xe_hw_fence_types.h | 9 #include <linux/dma-fence.h> 19 * struct xe_hw_fence_irq - hardware fence IRQ handler 31 /** @enabled: fence signaling enabled */ 38 * struct xe_hw_fence_ctx - hardware fence context 40 * The context for a hardware fence. 1 to 1 relationship with xe_engine. Points 44 /** @gt: GT structure of hardware fence context */ 46 /** @irq: fence irq handler */ 48 /** @dma_fence_ctx: dma fence context for hardware fence */ 50 /** @next_seqno: next seqno for hardware fence */ 52 /** @name: name of hardware fence context */ [all …]
|
| /linux/drivers/gpu/drm/ |
| H A D | drm_syncobj.c | 3 * Parts ported from amdgpu (fence wait code). 41 * - Import and export a syncobj's underlying fence to/from a sync file 42 * - Reset a syncobj (set its fence to NULL) 43 * - Signal a syncobj (set a trivially signaled fence) 44 * - Wait for a syncobj's fence to appear and be signaled 57 * to an already signaled fence depending on whether the 63 * the syncobj, the syncobj's fence is replaced with a fence which will be 67 * struct &dma_fence_chain pointing to the DRM driver's fence and also 68 * pointing to the previous fence that was in the syncobj. The new struct 69 * &dma_fence_chain fence replace the syncobj's fence and will be signaled by [all …]
|
| /linux/drivers/gpu/drm/i915/selftests/ |
| H A D | lib_sw_fence.c | 27 /* Small library of different fence types useful for writing tests */ 30 nop_fence_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state) in nop_fence_notify() argument 35 void __onstack_fence_init(struct i915_sw_fence *fence, in __onstack_fence_init() argument 39 debug_fence_init_onstack(fence); in __onstack_fence_init() 41 __init_waitqueue_head(&fence->wait, name, key); in __onstack_fence_init() 42 atomic_set(&fence->pending, 1); in __onstack_fence_init() 43 fence->error = 0; in __onstack_fence_init() 44 fence->fn = nop_fence_notify; in __onstack_fence_init() 47 void onstack_fence_fini(struct i915_sw_fence *fence) in onstack_fence_fini() argument 49 if (!fence->fn) in onstack_fence_fini() [all …]
|
| /linux/drivers/gpu/drm/amd/amdgpu/ |
| H A D | amdgpu_userq_fence.c | 27 #include <linux/dma-fence-unwrap.h> 149 struct dma_fence *fence; in amdgpu_userq_fence_driver_process() local 169 fence = &userq_fence->base; in amdgpu_userq_fence_driver_process() 171 dma_fence_signal(fence); in amdgpu_userq_fence_driver_process() 176 dma_fence_put(fence); in amdgpu_userq_fence_driver_process() 189 struct amdgpu_userq_fence *fence, *tmp; in amdgpu_userq_fence_driver_destroy() local 195 list_for_each_entry_safe(fence, tmp, &fence_drv->fences, link) { in amdgpu_userq_fence_driver_destroy() 196 f = &fence->base; in amdgpu_userq_fence_driver_destroy() 203 list_del(&fence->link); in amdgpu_userq_fence_driver_destroy() 269 struct amdgpu_userq_fence *fence, in amdgpu_userq_fence_init() argument [all …]
|
| /linux/tools/testing/selftests/sync/ |
| H A D | sync_stress_consumer.c | 40 static int busy_wait_on_fence(int fence) in busy_wait_on_fence() argument 45 error = sync_fence_count_with_status(fence, FENCE_STATUS_ERROR); in busy_wait_on_fence() 46 ASSERT(error == 0, "Error occurred on fence\n"); in busy_wait_on_fence() 47 active = sync_fence_count_with_status(fence, in busy_wait_on_fence() 66 int fence, valid, i; in mpsc_producer_thread() local 72 fence = sw_sync_fence_create(consumer_timeline, "fence", i); in mpsc_producer_thread() 73 valid = sw_sync_fence_is_valid(fence); in mpsc_producer_thread() 74 ASSERT(valid, "Failure creating fence\n"); in mpsc_producer_thread() 78 * means of waiting on the fence in mpsc_producer_thread() 82 ASSERT(sync_wait(fence, -1) > 0, in mpsc_producer_thread() [all …]
|
| H A D | sync_stress_merge.c | 43 int fence, tmpfence, merged, valid; in test_merge_stress_random_merge() local 51 fence = sw_sync_fence_create(timelines[0], "fence", 0); in test_merge_stress_random_merge() 52 valid = sw_sync_fence_is_valid(fence); in test_merge_stress_random_merge() 53 ASSERT(valid, "Failure creating fence\n"); in test_merge_stress_random_merge() 75 tmpfence = sw_sync_fence_create(timeline, "fence", sync_point); in test_merge_stress_random_merge() 76 merged = sync_merge("merge", tmpfence, fence); in test_merge_stress_random_merge() 78 sw_sync_fence_destroy(fence); in test_merge_stress_random_merge() 79 fence = merged; in test_merge_stress_random_merge() 82 ASSERT(valid, "Failure creating fence i\n"); in test_merge_stress_random_merge() 90 /* Confirm our map matches the fence. */ in test_merge_stress_random_merge() [all …]
|
| /linux/drivers/gpu/drm/msm/ |
| H A D | msm_fence.c | 7 #include <linux/dma-fence.h> 34 /* If deadline fence has already passed, nothing to do: */ in deadline_work() 61 * Start out close to the 32b fence rollover point, so we can in msm_fence_context_alloc() 62 * catch bugs with fence comparisons. in msm_fence_context_alloc() 82 bool msm_fence_completed(struct msm_fence_context *fctx, uint32_t fence) in msm_fence_completed() argument 88 return (int32_t)(fctx->completed_fence - fence) >= 0 || in msm_fence_completed() 89 (int32_t)(*fctx->fenceptr - fence) >= 0; in msm_fence_completed() 93 void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence) in msm_update_fence() argument 98 if (fence_after(fence, fctx->completed_fence)) in msm_update_fence() 99 fctx->completed_fence = fence; in msm_update_fence() [all …]
|
| H A D | msm_fence.h | 13 * struct msm_fence_context - fence context for gpu 15 * Each ringbuffer has a single fence context, with the GPU writing an 16 * incrementing fence seqno at the end of each submit 21 /** @name: human readable name for fence timeline */ 29 * Last assigned fence, incremented each time a fence is created 30 * on this fence context. If last_fence == completed_fence, 36 * The last completed fence, updated from the CPU after interrupt 42 * The address that the GPU directly writes with completed fence 44 * this to see if a fence has already signaled but the CPU hasn't 50 * @spinlock: fence context spinlock [all …]
|
| /linux/drivers/gpu/drm/virtio/ |
| H A D | virtgpu_fence.c | 45 /* leaked fence outside driver before completing in virtio_gpu_fence_signaled() 64 struct virtio_gpu_fence *fence = kzalloc_obj(struct virtio_gpu_fence); in virtio_gpu_fence_alloc() local 66 if (!fence) in virtio_gpu_fence_alloc() 67 return fence; in virtio_gpu_fence_alloc() 69 fence->drv = drv; in virtio_gpu_fence_alloc() 70 fence->ring_idx = ring_idx; in virtio_gpu_fence_alloc() 71 fence->emit_fence_info = !(base_fence_ctx == drv->context); in virtio_gpu_fence_alloc() 73 /* This only partially initializes the fence because the seqno is in virtio_gpu_fence_alloc() 74 * unknown yet. The fence must not be used outside of the driver in virtio_gpu_fence_alloc() 78 dma_fence_init(&fence->f, &virtio_gpu_fence_ops, &drv->lock, in virtio_gpu_fence_alloc() [all …]
|
| /linux/drivers/gpu/drm/xe/tests/ |
| H A D | xe_migrate.c | 16 static bool sanity_fence_failed(struct xe_device *xe, struct dma_fence *fence, in sanity_fence_failed() argument 21 if (IS_ERR(fence)) { in sanity_fence_failed() 22 KUNIT_FAIL(test, "Failed to create fence for %s: %li\n", str, in sanity_fence_failed() 23 PTR_ERR(fence)); in sanity_fence_failed() 26 if (!fence) in sanity_fence_failed() 29 ret = dma_fence_wait_timeout(fence, false, 5 * HZ); in sanity_fence_failed() 31 KUNIT_FAIL(test, "Fence timed out for %s: %li\n", str, ret); in sanity_fence_failed() 46 struct dma_fence *fence; in run_sanity_job() local 55 fence = dma_fence_get(&job->drm.s_fence->finished); in run_sanity_job() 58 if (sanity_fence_failed(xe, fence, str, test)) in run_sanity_job() [all …]
|