[RFC PATCH 2/6] dma-buf: dma-fence: Add flag for using 64-bit seqnos
From: Philipp Stanner
Date: Thu Oct 29 2026 - 06:08:26 EST
dma_fence_init() now has its own flag field for user options. Use this
field to enable 64-bit seqno support through a dedicated field.
Signed-off-by: Philipp Stanner <phasta@xxxxxxxxxx>
---
drivers/dma-buf/dma-fence.c | 8 +++++++-
include/linux/dma-fence.h | 4 +++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index a640fb99f942..b11ee52a40d8 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -1114,7 +1114,13 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops,
spinlock_t *lock, u64 context, u64 seqno,
unsigned long init_flags)
{
- __dma_fence_init(fence, ops, lock, context, seqno, 0);
+ unsigned long fence_flag_bits = 0;
+
+ /* Mapp the init_flags to the fence-internal flags. */
+ if (test_bit(DMA_FENCE_INIT_FLAG_SEQNO64, &init_flags))
+ set_bit(DMA_FENCE_FLAG_SEQNO64_BIT, &fence_flag_bits);
+
+ __dma_fence_init(fence, ops, lock, context, seqno, fence_flag_bits);
}
EXPORT_SYMBOL(dma_fence_init);
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 0cb425f7d5e9..6654bcc2441f 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -123,9 +123,11 @@ enum dma_fence_flag_bits {
*
* These flags can be passed in dma_fence_init().
*
- * DMA_FENCE_FLAG_SEQNO64_BIT - use 64-bit sequence numbers
+ * @DMA_FENCE_INIT_FLAG_SEQNO64: Use 64-bit sequence numbers.
*/
enum dma_fence_init_flags {
+ DMA_FENCE_INIT_FLAG_SEQNO64,
+
/* Must always be last member. */
DMA_FENCE_INIT_FLAG_NR_OF_FLAGs,
};
--
2.56.0