summaryrefslogtreecommitdiff
path: root/gxp-dma-fence.h
blob: c7ad95e62e3fe9e19b44af4b758874fccfa34869 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * GXP support for DMA fence.
 *
 * Copyright (C) 2023 Google LLC
 */

#ifndef __GXP_DMA_FENCE_H__
#define __GXP_DMA_FENCE_H__

#include <gcip/gcip-dma-fence.h>

#include "gxp-vd.h"
#include "gxp.h"

/* Converts struct dma_fence to gxp_dma_fence. */
#define to_gxp_fence(fence)                                                    \
	container_of(to_gcip_fence(fence), struct gxp_dma_fence, gfence)

struct gxp_dma_fence {
	struct gcip_dma_fence gfence;
	/* The owner of this DMA fence */
	struct gxp_virtual_device *vd;
	/* List of DMA fences owned by the same VD. */
	struct list_head fence_list;
};

/*
 * Creates a DMA fence associates with @vd.
 *
 * @datap->fence is set to the fence FD on success.
 *
 * Returns 0 on success. Otherwise a negative errno.
 */
int gxp_dma_fence_create(struct gxp_dev *gxp, struct gxp_virtual_device *vd,
			 struct gxp_create_sync_fence_data *datap);

#endif /* __GXP_DMA_FENCE_H__ */