summaryrefslogtreecommitdiffstats
path: root/include/linux/tegra_gr_comm.h
blob: f1de97f4f614bc118f223967c96469c9da1610e0 (plain) (blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Tegra Graphics Virtualization Communication Framework
 *
 * Copyright (c) 2013-2018, NVIDIA Corporation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __TEGRA_GR_COMM_H
#define __TEGRA_GR_COMM_H

#include <linux/platform_device.h>

#define TEGRA_GR_COMM_ID_SELF (0xFF)

#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
int tegra_gr_comm_init(struct platform_device *pdev, u32 elems,
		const size_t *queue_sizes, u32 queue_start, u32 num_queues);
void tegra_gr_comm_deinit(u32 queue_start, u32 num_queues);
int tegra_gr_comm_send(u32 peer, u32 index, void *data,
		size_t size);
int tegra_gr_comm_recv(u32 index, void **handle, void **data,
		size_t *size, u32 *sender);
int tegra_gr_comm_sendrecv(u32 peer, u32 index, void **handle,
			void **data, size_t *size);
void tegra_gr_comm_release(void *handle);
u32 tegra_gr_comm_get_server_vmid(void);
void *tegra_gr_comm_oob_get_ptr(u32 peer, u32 index,
				void **ptr, size_t *size);
void tegra_gr_comm_oob_put_ptr(void *handle);
#else
static inline int tegra_gr_comm_init(struct platform_device *pdev,
				u32 elems,
				const size_t *queue_sizes, u32 queue_start,
				u32 num_queues)
{
	return -ENOSYS;
}

static inline void tegra_gr_comm_deinit(u32 queue_start,
					u32 num_queues)
{
}

static inline int tegra_gr_comm_send(u32 peer, u32 index,
				void *data, size_t size)
{
	return -ENOSYS;
}

static inline int tegra_gr_comm_recv(u32 index, void **handle,
				void **data, size_t *size, u32 *sender)
{
	return -ENOSYS;
}

static inline int tegra_gr_comm_sendrecv(u32 peer, u32 index,
					void **handle, void **data,
					size_t *size)
{
	return -ENOSYS;
}

static inline void tegra_gr_comm_release(void *handle) {}

static inline u32 tegra_gr_comm_get_server_vmid(void)
{
	return 0;
}

static inline void *tegra_gr_comm_oob_get_ptr(u32 peer,
					u32 index, void **ptr, size_t *size)
{
	return NULL;
}

static inline void tegra_gr_comm_oob_put_ptr(void *handle) {}
#endif

#endif