~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/dma-fence-array.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * fence-array: aggregates fence to be waited together
  4  *
  5  * Copyright (C) 2016 Collabora Ltd
  6  * Copyright (C) 2016 Advanced Micro Devices, Inc.
  7  * Authors:
  8  *      Gustavo Padovan <gustavo@padovan.org>
  9  *      Christian König <christian.koenig@amd.com>
 10  */
 11 
 12 #ifndef __LINUX_DMA_FENCE_ARRAY_H
 13 #define __LINUX_DMA_FENCE_ARRAY_H
 14 
 15 #include <linux/dma-fence.h>
 16 #include <linux/irq_work.h>
 17 
 18 /**
 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
 22  */
 23 struct dma_fence_array_cb {
 24         struct dma_fence_cb cb;
 25         struct dma_fence_array *array;
 26 };
 27 
 28 /**
 29  * struct dma_fence_array - fence to represent an array of fences
 30  * @base: fence base class
 31  * @lock: spinlock for fence handling
 32  * @num_fences: number of fences in the array
 33  * @num_pending: fences in the array still pending
 34  * @fences: array of the fences
 35  * @work: internal irq_work function
 36  * @callbacks: array of callback helpers
 37  */
 38 struct dma_fence_array {
 39         struct dma_fence base;
 40 
 41         spinlock_t lock;
 42         unsigned num_fences;
 43         atomic_t num_pending;
 44         struct dma_fence **fences;
 45 
 46         struct irq_work work;
 47 
 48         struct dma_fence_array_cb callbacks[] __counted_by(num_fences);
 49 };
 50 
 51 /**
 52  * to_dma_fence_array - cast a fence to a dma_fence_array
 53  * @fence: fence to cast to a dma_fence_array
 54  *
 55  * Returns NULL if the fence is not a dma_fence_array,
 56  * or the dma_fence_array otherwise.
 57  */
 58 static inline struct dma_fence_array *
 59 to_dma_fence_array(struct dma_fence *fence)
 60 {
 61         if (!fence || !dma_fence_is_array(fence))
 62                 return NULL;
 63 
 64         return container_of(fence, struct dma_fence_array, base);
 65 }
 66 
 67 /**
 68  * dma_fence_array_for_each - iterate over all fences in array
 69  * @fence: current fence
 70  * @index: index into the array
 71  * @head: potential dma_fence_array object
 72  *
 73  * Test if @array is a dma_fence_array object and if yes iterate over all fences
 74  * in the array. If not just iterate over the fence in @array itself.
 75  *
 76  * For a deep dive iterator see dma_fence_unwrap_for_each().
 77  */
 78 #define dma_fence_array_for_each(fence, index, head)                    \
 79         for (index = 0, fence = dma_fence_array_first(head); fence;     \
 80              ++(index), fence = dma_fence_array_next(head, index))
 81 
 82 struct dma_fence_array *dma_fence_array_create(int num_fences,
 83                                                struct dma_fence **fences,
 84                                                u64 context, unsigned seqno,
 85                                                bool signal_on_any);
 86 
 87 bool dma_fence_match_context(struct dma_fence *fence, u64 context);
 88 
 89 struct dma_fence *dma_fence_array_first(struct dma_fence *head);
 90 struct dma_fence *dma_fence_array_next(struct dma_fence *head,
 91                                        unsigned int index);
 92 
 93 #endif /* __LINUX_DMA_FENCE_ARRAY_H */
 94 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php