Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Fence mechanism for dma-buf to allow for asynchronous dma access
0004  *
0005  * Copyright (C) 2012 Canonical Ltd
0006  * Copyright (C) 2012 Texas Instruments
0007  *
0008  * Authors:
0009  * Rob Clark <robdclark@gmail.com>
0010  * Maarten Lankhorst <maarten.lankhorst@canonical.com>
0011  */
0012 
0013 #ifndef __LINUX_DMA_FENCE_H
0014 #define __LINUX_DMA_FENCE_H
0015 
0016 #include <linux/err.h>
0017 #include <linux/wait.h>
0018 #include <linux/list.h>
0019 #include <linux/bitops.h>
0020 #include <linux/kref.h>
0021 #include <linux/sched.h>
0022 #include <linux/printk.h>
0023 #include <linux/rcupdate.h>
0024 
0025 struct dma_fence;
0026 struct dma_fence_ops;
0027 struct dma_fence_cb;
0028 
0029 /**
0030  * struct dma_fence - software synchronization primitive
0031  * @refcount: refcount for this fence
0032  * @ops: dma_fence_ops associated with this fence
0033  * @rcu: used for releasing fence with kfree_rcu
0034  * @cb_list: list of all callbacks to call
0035  * @lock: spin_lock_irqsave used for locking
0036  * @context: execution context this fence belongs to, returned by
0037  *           dma_fence_context_alloc()
0038  * @seqno: the sequence number of this fence inside the execution context,
0039  * can be compared to decide which fence would be signaled later.
0040  * @flags: A mask of DMA_FENCE_FLAG_* defined below
0041  * @timestamp: Timestamp when the fence was signaled.
0042  * @error: Optional, only valid if < 0, must be set before calling
0043  * dma_fence_signal, indicates that the fence has completed with an error.
0044  *
0045  * the flags member must be manipulated and read using the appropriate
0046  * atomic ops (bit_*), so taking the spinlock will not be needed most
0047  * of the time.
0048  *
0049  * DMA_FENCE_FLAG_SIGNALED_BIT - fence is already signaled
0050  * DMA_FENCE_FLAG_TIMESTAMP_BIT - timestamp recorded for fence signaling
0051  * DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT - enable_signaling might have been called
0052  * DMA_FENCE_FLAG_USER_BITS - start of the unused bits, can be used by the
0053  * implementer of the fence for its own purposes. Can be used in different
0054  * ways by different fence implementers, so do not rely on this.
0055  *
0056  * Since atomic bitops are used, this is not guaranteed to be the case.
0057  * Particularly, if the bit was set, but dma_fence_signal was called right
0058  * before this bit was set, it would have been able to set the
0059  * DMA_FENCE_FLAG_SIGNALED_BIT, before enable_signaling was called.
0060  * Adding a check for DMA_FENCE_FLAG_SIGNALED_BIT after setting
0061  * DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT closes this race, and makes sure that
0062  * after dma_fence_signal was called, any enable_signaling call will have either
0063  * been completed, or never called at all.
0064  */
0065 struct dma_fence {
0066     spinlock_t *lock;
0067     const struct dma_fence_ops *ops;
0068     /*
0069      * We clear the callback list on kref_put so that by the time we
0070      * release the fence it is unused. No one should be adding to the
0071      * cb_list that they don't themselves hold a reference for.
0072      *
0073      * The lifetime of the timestamp is similarly tied to both the
0074      * rcu freelist and the cb_list. The timestamp is only set upon
0075      * signaling while simultaneously notifying the cb_list. Ergo, we
0076      * only use either the cb_list of timestamp. Upon destruction,
0077      * neither are accessible, and so we can use the rcu. This means
0078      * that the cb_list is *only* valid until the signal bit is set,
0079      * and to read either you *must* hold a reference to the fence,
0080      * and not just the rcu_read_lock.
0081      *
0082      * Listed in chronological order.
0083      */
0084     union {
0085         struct list_head cb_list;
0086         /* @cb_list replaced by @timestamp on dma_fence_signal() */
0087         ktime_t timestamp;
0088         /* @timestamp replaced by @rcu on dma_fence_release() */
0089         struct rcu_head rcu;
0090     };
0091     u64 context;
0092     u64 seqno;
0093     unsigned long flags;
0094     struct kref refcount;
0095     int error;
0096 };
0097 
0098 enum dma_fence_flag_bits {
0099     DMA_FENCE_FLAG_SIGNALED_BIT,
0100     DMA_FENCE_FLAG_TIMESTAMP_BIT,
0101     DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
0102     DMA_FENCE_FLAG_USER_BITS, /* must always be last member */
0103 };
0104 
0105 typedef void (*dma_fence_func_t)(struct dma_fence *fence,
0106                  struct dma_fence_cb *cb);
0107 
0108 /**
0109  * struct dma_fence_cb - callback for dma_fence_add_callback()
0110  * @node: used by dma_fence_add_callback() to append this struct to fence::cb_list
0111  * @func: dma_fence_func_t to call
0112  *
0113  * This struct will be initialized by dma_fence_add_callback(), additional
0114  * data can be passed along by embedding dma_fence_cb in another struct.
0115  */
0116 struct dma_fence_cb {
0117     struct list_head node;
0118     dma_fence_func_t func;
0119 };
0120 
0121 /**
0122  * struct dma_fence_ops - operations implemented for fence
0123  *
0124  */
0125 struct dma_fence_ops {
0126     /**
0127      * @use_64bit_seqno:
0128      *
0129      * True if this dma_fence implementation uses 64bit seqno, false
0130      * otherwise.
0131      */
0132     bool use_64bit_seqno;
0133 
0134     /**
0135      * @get_driver_name:
0136      *
0137      * Returns the driver name. This is a callback to allow drivers to
0138      * compute the name at runtime, without having it to store permanently
0139      * for each fence, or build a cache of some sort.
0140      *
0141      * This callback is mandatory.
0142      */
0143     const char * (*get_driver_name)(struct dma_fence *fence);
0144 
0145     /**
0146      * @get_timeline_name:
0147      *
0148      * Return the name of the context this fence belongs to. This is a
0149      * callback to allow drivers to compute the name at runtime, without
0150      * having it to store permanently for each fence, or build a cache of
0151      * some sort.
0152      *
0153      * This callback is mandatory.
0154      */
0155     const char * (*get_timeline_name)(struct dma_fence *fence);
0156 
0157     /**
0158      * @enable_signaling:
0159      *
0160      * Enable software signaling of fence.
0161      *
0162      * For fence implementations that have the capability for hw->hw
0163      * signaling, they can implement this op to enable the necessary
0164      * interrupts, or insert commands into cmdstream, etc, to avoid these
0165      * costly operations for the common case where only hw->hw
0166      * synchronization is required.  This is called in the first
0167      * dma_fence_wait() or dma_fence_add_callback() path to let the fence
0168      * implementation know that there is another driver waiting on the
0169      * signal (ie. hw->sw case).
0170      *
0171      * This function can be called from atomic context, but not
0172      * from irq context, so normal spinlocks can be used.
0173      *
0174      * A return value of false indicates the fence already passed,
0175      * or some failure occurred that made it impossible to enable
0176      * signaling. True indicates successful enabling.
0177      *
0178      * &dma_fence.error may be set in enable_signaling, but only when false
0179      * is returned.
0180      *
0181      * Since many implementations can call dma_fence_signal() even when before
0182      * @enable_signaling has been called there's a race window, where the
0183      * dma_fence_signal() might result in the final fence reference being
0184      * released and its memory freed. To avoid this, implementations of this
0185      * callback should grab their own reference using dma_fence_get(), to be
0186      * released when the fence is signalled (through e.g. the interrupt
0187      * handler).
0188      *
0189      * This callback is optional. If this callback is not present, then the
0190      * driver must always have signaling enabled.
0191      */
0192     bool (*enable_signaling)(struct dma_fence *fence);
0193 
0194     /**
0195      * @signaled:
0196      *
0197      * Peek whether the fence is signaled, as a fastpath optimization for
0198      * e.g. dma_fence_wait() or dma_fence_add_callback(). Note that this
0199      * callback does not need to make any guarantees beyond that a fence
0200      * once indicates as signalled must always return true from this
0201      * callback. This callback may return false even if the fence has
0202      * completed already, in this case information hasn't propogated throug
0203      * the system yet. See also dma_fence_is_signaled().
0204      *
0205      * May set &dma_fence.error if returning true.
0206      *
0207      * This callback is optional.
0208      */
0209     bool (*signaled)(struct dma_fence *fence);
0210 
0211     /**
0212      * @wait:
0213      *
0214      * Custom wait implementation, defaults to dma_fence_default_wait() if
0215      * not set.
0216      *
0217      * Deprecated and should not be used by new implementations. Only used
0218      * by existing implementations which need special handling for their
0219      * hardware reset procedure.
0220      *
0221      * Must return -ERESTARTSYS if the wait is intr = true and the wait was
0222      * interrupted, and remaining jiffies if fence has signaled, or 0 if wait
0223      * timed out. Can also return other error values on custom implementations,
0224      * which should be treated as if the fence is signaled. For example a hardware
0225      * lockup could be reported like that.
0226      */
0227     signed long (*wait)(struct dma_fence *fence,
0228                 bool intr, signed long timeout);
0229 
0230     /**
0231      * @release:
0232      *
0233      * Called on destruction of fence to release additional resources.
0234      * Can be called from irq context.  This callback is optional. If it is
0235      * NULL, then dma_fence_free() is instead called as the default
0236      * implementation.
0237      */
0238     void (*release)(struct dma_fence *fence);
0239 
0240     /**
0241      * @fence_value_str:
0242      *
0243      * Callback to fill in free-form debug info specific to this fence, like
0244      * the sequence number.
0245      *
0246      * This callback is optional.
0247      */
0248     void (*fence_value_str)(struct dma_fence *fence, char *str, int size);
0249 
0250     /**
0251      * @timeline_value_str:
0252      *
0253      * Fills in the current value of the timeline as a string, like the
0254      * sequence number. Note that the specific fence passed to this function
0255      * should not matter, drivers should only use it to look up the
0256      * corresponding timeline structures.
0257      */
0258     void (*timeline_value_str)(struct dma_fence *fence,
0259                    char *str, int size);
0260 };
0261 
0262 void dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
0263             spinlock_t *lock, u64 context, u64 seqno);
0264 
0265 void dma_fence_release(struct kref *kref);
0266 void dma_fence_free(struct dma_fence *fence);
0267 void dma_fence_describe(struct dma_fence *fence, struct seq_file *seq);
0268 
0269 /**
0270  * dma_fence_put - decreases refcount of the fence
0271  * @fence: fence to reduce refcount of
0272  */
0273 static inline void dma_fence_put(struct dma_fence *fence)
0274 {
0275     if (fence)
0276         kref_put(&fence->refcount, dma_fence_release);
0277 }
0278 
0279 /**
0280  * dma_fence_get - increases refcount of the fence
0281  * @fence: fence to increase refcount of
0282  *
0283  * Returns the same fence, with refcount increased by 1.
0284  */
0285 static inline struct dma_fence *dma_fence_get(struct dma_fence *fence)
0286 {
0287     if (fence)
0288         kref_get(&fence->refcount);
0289     return fence;
0290 }
0291 
0292 /**
0293  * dma_fence_get_rcu - get a fence from a dma_resv_list with
0294  *                     rcu read lock
0295  * @fence: fence to increase refcount of
0296  *
0297  * Function returns NULL if no refcount could be obtained, or the fence.
0298  */
0299 static inline struct dma_fence *dma_fence_get_rcu(struct dma_fence *fence)
0300 {
0301     if (kref_get_unless_zero(&fence->refcount))
0302         return fence;
0303     else
0304         return NULL;
0305 }
0306 
0307 /**
0308  * dma_fence_get_rcu_safe  - acquire a reference to an RCU tracked fence
0309  * @fencep: pointer to fence to increase refcount of
0310  *
0311  * Function returns NULL if no refcount could be obtained, or the fence.
0312  * This function handles acquiring a reference to a fence that may be
0313  * reallocated within the RCU grace period (such as with SLAB_TYPESAFE_BY_RCU),
0314  * so long as the caller is using RCU on the pointer to the fence.
0315  *
0316  * An alternative mechanism is to employ a seqlock to protect a bunch of
0317  * fences, such as used by struct dma_resv. When using a seqlock,
0318  * the seqlock must be taken before and checked after a reference to the
0319  * fence is acquired (as shown here).
0320  *
0321  * The caller is required to hold the RCU read lock.
0322  */
0323 static inline struct dma_fence *
0324 dma_fence_get_rcu_safe(struct dma_fence __rcu **fencep)
0325 {
0326     do {
0327         struct dma_fence *fence;
0328 
0329         fence = rcu_dereference(*fencep);
0330         if (!fence)
0331             return NULL;
0332 
0333         if (!dma_fence_get_rcu(fence))
0334             continue;
0335 
0336         /* The atomic_inc_not_zero() inside dma_fence_get_rcu()
0337          * provides a full memory barrier upon success (such as now).
0338          * This is paired with the write barrier from assigning
0339          * to the __rcu protected fence pointer so that if that
0340          * pointer still matches the current fence, we know we
0341          * have successfully acquire a reference to it. If it no
0342          * longer matches, we are holding a reference to some other
0343          * reallocated pointer. This is possible if the allocator
0344          * is using a freelist like SLAB_TYPESAFE_BY_RCU where the
0345          * fence remains valid for the RCU grace period, but it
0346          * may be reallocated. When using such allocators, we are
0347          * responsible for ensuring the reference we get is to
0348          * the right fence, as below.
0349          */
0350         if (fence == rcu_access_pointer(*fencep))
0351             return rcu_pointer_handoff(fence);
0352 
0353         dma_fence_put(fence);
0354     } while (1);
0355 }
0356 
0357 #ifdef CONFIG_LOCKDEP
0358 bool dma_fence_begin_signalling(void);
0359 void dma_fence_end_signalling(bool cookie);
0360 void __dma_fence_might_wait(void);
0361 #else
0362 static inline bool dma_fence_begin_signalling(void)
0363 {
0364     return true;
0365 }
0366 static inline void dma_fence_end_signalling(bool cookie) {}
0367 static inline void __dma_fence_might_wait(void) {}
0368 #endif
0369 
0370 int dma_fence_signal(struct dma_fence *fence);
0371 int dma_fence_signal_locked(struct dma_fence *fence);
0372 int dma_fence_signal_timestamp(struct dma_fence *fence, ktime_t timestamp);
0373 int dma_fence_signal_timestamp_locked(struct dma_fence *fence,
0374                       ktime_t timestamp);
0375 signed long dma_fence_default_wait(struct dma_fence *fence,
0376                    bool intr, signed long timeout);
0377 int dma_fence_add_callback(struct dma_fence *fence,
0378                struct dma_fence_cb *cb,
0379                dma_fence_func_t func);
0380 bool dma_fence_remove_callback(struct dma_fence *fence,
0381                    struct dma_fence_cb *cb);
0382 void dma_fence_enable_sw_signaling(struct dma_fence *fence);
0383 
0384 /**
0385  * dma_fence_is_signaled_locked - Return an indication if the fence
0386  *                                is signaled yet.
0387  * @fence: the fence to check
0388  *
0389  * Returns true if the fence was already signaled, false if not. Since this
0390  * function doesn't enable signaling, it is not guaranteed to ever return
0391  * true if dma_fence_add_callback(), dma_fence_wait() or
0392  * dma_fence_enable_sw_signaling() haven't been called before.
0393  *
0394  * This function requires &dma_fence.lock to be held.
0395  *
0396  * See also dma_fence_is_signaled().
0397  */
0398 static inline bool
0399 dma_fence_is_signaled_locked(struct dma_fence *fence)
0400 {
0401     if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
0402         return true;
0403 
0404     if (fence->ops->signaled && fence->ops->signaled(fence)) {
0405         dma_fence_signal_locked(fence);
0406         return true;
0407     }
0408 
0409     return false;
0410 }
0411 
0412 /**
0413  * dma_fence_is_signaled - Return an indication if the fence is signaled yet.
0414  * @fence: the fence to check
0415  *
0416  * Returns true if the fence was already signaled, false if not. Since this
0417  * function doesn't enable signaling, it is not guaranteed to ever return
0418  * true if dma_fence_add_callback(), dma_fence_wait() or
0419  * dma_fence_enable_sw_signaling() haven't been called before.
0420  *
0421  * It's recommended for seqno fences to call dma_fence_signal when the
0422  * operation is complete, it makes it possible to prevent issues from
0423  * wraparound between time of issue and time of use by checking the return
0424  * value of this function before calling hardware-specific wait instructions.
0425  *
0426  * See also dma_fence_is_signaled_locked().
0427  */
0428 static inline bool
0429 dma_fence_is_signaled(struct dma_fence *fence)
0430 {
0431     if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
0432         return true;
0433 
0434     if (fence->ops->signaled && fence->ops->signaled(fence)) {
0435         dma_fence_signal(fence);
0436         return true;
0437     }
0438 
0439     return false;
0440 }
0441 
0442 /**
0443  * __dma_fence_is_later - return if f1 is chronologically later than f2
0444  * @f1: the first fence's seqno
0445  * @f2: the second fence's seqno from the same context
0446  * @ops: dma_fence_ops associated with the seqno
0447  *
0448  * Returns true if f1 is chronologically later than f2. Both fences must be
0449  * from the same context, since a seqno is not common across contexts.
0450  */
0451 static inline bool __dma_fence_is_later(u64 f1, u64 f2,
0452                     const struct dma_fence_ops *ops)
0453 {
0454     /* This is for backward compatibility with drivers which can only handle
0455      * 32bit sequence numbers. Use a 64bit compare when the driver says to
0456      * do so.
0457      */
0458     if (ops->use_64bit_seqno)
0459         return f1 > f2;
0460 
0461     return (int)(lower_32_bits(f1) - lower_32_bits(f2)) > 0;
0462 }
0463 
0464 /**
0465  * dma_fence_is_later - return if f1 is chronologically later than f2
0466  * @f1: the first fence from the same context
0467  * @f2: the second fence from the same context
0468  *
0469  * Returns true if f1 is chronologically later than f2. Both fences must be
0470  * from the same context, since a seqno is not re-used across contexts.
0471  */
0472 static inline bool dma_fence_is_later(struct dma_fence *f1,
0473                       struct dma_fence *f2)
0474 {
0475     if (WARN_ON(f1->context != f2->context))
0476         return false;
0477 
0478     return __dma_fence_is_later(f1->seqno, f2->seqno, f1->ops);
0479 }
0480 
0481 /**
0482  * dma_fence_later - return the chronologically later fence
0483  * @f1: the first fence from the same context
0484  * @f2: the second fence from the same context
0485  *
0486  * Returns NULL if both fences are signaled, otherwise the fence that would be
0487  * signaled last. Both fences must be from the same context, since a seqno is
0488  * not re-used across contexts.
0489  */
0490 static inline struct dma_fence *dma_fence_later(struct dma_fence *f1,
0491                         struct dma_fence *f2)
0492 {
0493     if (WARN_ON(f1->context != f2->context))
0494         return NULL;
0495 
0496     /*
0497      * Can't check just DMA_FENCE_FLAG_SIGNALED_BIT here, it may never
0498      * have been set if enable_signaling wasn't called, and enabling that
0499      * here is overkill.
0500      */
0501     if (dma_fence_is_later(f1, f2))
0502         return dma_fence_is_signaled(f1) ? NULL : f1;
0503     else
0504         return dma_fence_is_signaled(f2) ? NULL : f2;
0505 }
0506 
0507 /**
0508  * dma_fence_get_status_locked - returns the status upon completion
0509  * @fence: the dma_fence to query
0510  *
0511  * Drivers can supply an optional error status condition before they signal
0512  * the fence (to indicate whether the fence was completed due to an error
0513  * rather than success). The value of the status condition is only valid
0514  * if the fence has been signaled, dma_fence_get_status_locked() first checks
0515  * the signal state before reporting the error status.
0516  *
0517  * Returns 0 if the fence has not yet been signaled, 1 if the fence has
0518  * been signaled without an error condition, or a negative error code
0519  * if the fence has been completed in err.
0520  */
0521 static inline int dma_fence_get_status_locked(struct dma_fence *fence)
0522 {
0523     if (dma_fence_is_signaled_locked(fence))
0524         return fence->error ?: 1;
0525     else
0526         return 0;
0527 }
0528 
0529 int dma_fence_get_status(struct dma_fence *fence);
0530 
0531 /**
0532  * dma_fence_set_error - flag an error condition on the fence
0533  * @fence: the dma_fence
0534  * @error: the error to store
0535  *
0536  * Drivers can supply an optional error status condition before they signal
0537  * the fence, to indicate that the fence was completed due to an error
0538  * rather than success. This must be set before signaling (so that the value
0539  * is visible before any waiters on the signal callback are woken). This
0540  * helper exists to help catching erroneous setting of #dma_fence.error.
0541  */
0542 static inline void dma_fence_set_error(struct dma_fence *fence,
0543                        int error)
0544 {
0545     WARN_ON(test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags));
0546     WARN_ON(error >= 0 || error < -MAX_ERRNO);
0547 
0548     fence->error = error;
0549 }
0550 
0551 signed long dma_fence_wait_timeout(struct dma_fence *,
0552                    bool intr, signed long timeout);
0553 signed long dma_fence_wait_any_timeout(struct dma_fence **fences,
0554                        uint32_t count,
0555                        bool intr, signed long timeout,
0556                        uint32_t *idx);
0557 
0558 /**
0559  * dma_fence_wait - sleep until the fence gets signaled
0560  * @fence: the fence to wait on
0561  * @intr: if true, do an interruptible wait
0562  *
0563  * This function will return -ERESTARTSYS if interrupted by a signal,
0564  * or 0 if the fence was signaled. Other error values may be
0565  * returned on custom implementations.
0566  *
0567  * Performs a synchronous wait on this fence. It is assumed the caller
0568  * directly or indirectly holds a reference to the fence, otherwise the
0569  * fence might be freed before return, resulting in undefined behavior.
0570  *
0571  * See also dma_fence_wait_timeout() and dma_fence_wait_any_timeout().
0572  */
0573 static inline signed long dma_fence_wait(struct dma_fence *fence, bool intr)
0574 {
0575     signed long ret;
0576 
0577     /* Since dma_fence_wait_timeout cannot timeout with
0578      * MAX_SCHEDULE_TIMEOUT, only valid return values are
0579      * -ERESTARTSYS and MAX_SCHEDULE_TIMEOUT.
0580      */
0581     ret = dma_fence_wait_timeout(fence, intr, MAX_SCHEDULE_TIMEOUT);
0582 
0583     return ret < 0 ? ret : 0;
0584 }
0585 
0586 struct dma_fence *dma_fence_get_stub(void);
0587 struct dma_fence *dma_fence_allocate_private_stub(void);
0588 u64 dma_fence_context_alloc(unsigned num);
0589 
0590 extern const struct dma_fence_ops dma_fence_array_ops;
0591 extern const struct dma_fence_ops dma_fence_chain_ops;
0592 
0593 /**
0594  * dma_fence_is_array - check if a fence is from the array subclass
0595  * @fence: the fence to test
0596  *
0597  * Return true if it is a dma_fence_array and false otherwise.
0598  */
0599 static inline bool dma_fence_is_array(struct dma_fence *fence)
0600 {
0601     return fence->ops == &dma_fence_array_ops;
0602 }
0603 
0604 /**
0605  * dma_fence_is_chain - check if a fence is from the chain subclass
0606  * @fence: the fence to test
0607  *
0608  * Return true if it is a dma_fence_chain and false otherwise.
0609  */
0610 static inline bool dma_fence_is_chain(struct dma_fence *fence)
0611 {
0612     return fence->ops == &dma_fence_chain_ops;
0613 }
0614 
0615 /**
0616  * dma_fence_is_container - check if a fence is a container for other fences
0617  * @fence: the fence to test
0618  *
0619  * Return true if this fence is a container for other fences, false otherwise.
0620  * This is important since we can't build up large fence structure or otherwise
0621  * we run into recursion during operation on those fences.
0622  */
0623 static inline bool dma_fence_is_container(struct dma_fence *fence)
0624 {
0625     return dma_fence_is_array(fence) || dma_fence_is_chain(fence);
0626 }
0627 
0628 #endif /* __LINUX_DMA_FENCE_H */