162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Host1x context devices
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2020, NVIDIA Corporation.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __HOST1X_CONTEXT_H
962306a36Sopenharmony_ci#define __HOST1X_CONTEXT_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/mutex.h>
1262306a36Sopenharmony_ci#include <linux/refcount.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct host1x;
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciextern struct bus_type host1x_context_device_bus_type;
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_cistruct host1x_memory_context_list {
1962306a36Sopenharmony_ci	struct mutex lock;
2062306a36Sopenharmony_ci	struct host1x_memory_context *devs;
2162306a36Sopenharmony_ci	unsigned int len;
2262306a36Sopenharmony_ci};
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#ifdef CONFIG_IOMMU_API
2562306a36Sopenharmony_ciint host1x_memory_context_list_init(struct host1x *host1x);
2662306a36Sopenharmony_civoid host1x_memory_context_list_free(struct host1x_memory_context_list *cdl);
2762306a36Sopenharmony_ci#else
2862306a36Sopenharmony_cistatic inline int host1x_memory_context_list_init(struct host1x *host1x)
2962306a36Sopenharmony_ci{
3062306a36Sopenharmony_ci	return 0;
3162306a36Sopenharmony_ci}
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_cistatic inline void host1x_memory_context_list_free(struct host1x_memory_context_list *cdl)
3462306a36Sopenharmony_ci{
3562306a36Sopenharmony_ci}
3662306a36Sopenharmony_ci#endif
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#endif
39