[PATCH v7 01/15] gpu: host1x: Add DMA fence implementation

Dmitry Osipenko digetx at gmail.com
Tue Jun 15 21:47:34 UTC 2021


..
> diff --git a/drivers/gpu/host1x/fence.c b/drivers/gpu/host1x/fence.c
> new file mode 100644
> index 000000000000..2b0bb97f053f
> --- /dev/null
> +++ b/drivers/gpu/host1x/fence.c
> @@ -0,0 +1,184 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Syncpoint dma_fence implementation
> + *
> + * Copyright (c) 2020, NVIDIA Corporation.
> + */
> +
> +#include <linux/dma-fence.h>
> +#include <linux/file.h>
> +#include <linux/fs.h>
> +#include <linux/slab.h>
> +#include <linux/sync_file.h>

Stale headers

> +#include "fence.h"
> +#include "intr.h"
> +#include "syncpt.h"
> +
> +DEFINE_SPINLOCK(lock);

static

...
> +static bool host1x_syncpt_fence_enable_signaling(struct dma_fence *f)
> +{
> +	struct host1x_syncpt_fence *sf = to_host1x_fence(f);
> +	int err;
> +
> +	if (host1x_syncpt_is_expired(sf->sp, sf->threshold))
> +		return false;
> +
> +	dma_fence_get(f);
> +
> +	/*
> +	 * The dma_fence framework requires the fence driver to keep a
> +	 * reference to any fences for which 'enable_signaling' has been
> +	 * called (and that have not been signalled).
> +	 * 
> +	 * We provide a userspace API to create arbitrary syncpoint fences,
> +	 * so we cannot normally guarantee that all fences get signalled.
> +	 * As such, setup a timeout, so that long-lasting fences will get
> +	 * reaped eventually.
> +	 */
> +	schedule_delayed_work(&sf->timeout_work, msecs_to_jiffies(30000));

I don't see this API. Please always remove all dead code, make patches
minimal and functional.

...> +int host1x_fence_extract(struct dma_fence *fence, u32 *id, u32
*threshold)
> +{
> +	struct host1x_syncpt_fence *f;
> +
> +	if (fence->ops != &host1x_syncpt_fence_ops)
> +		return -EINVAL;
> +
> +	f = container_of(fence, struct host1x_syncpt_fence, base);
> +
> +	*id = f->sp->id;
> +	*threshold = f->threshold;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(host1x_fence_extract);

dead code


More information about the dri-devel mailing list