summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAmbika Prasad <ambikap@nvidia.com>2016-11-14 04:11:48 -0500
committerJinyoung Park <jinyoungp@nvidia.com>2018-05-04 01:20:24 -0400
commit811592571be7c196e31ec2093598005a5dcedbb6 (patch)
tree86b7fa2692a4768d5105dd3e6020fdc54473cfee /include
parent0d17c677c295b4708f096962eacd6dcdcd791222 (diff)
tegra-hv-net: Updated default mac address
- Updated deault mac address to a fixed private address. It is needed to fix telnet issue when only Linux VM is rebooted as other VM may still have old MAC address, cached earlier. - In case of valid mac address found in dt, copying mac address from dt to ndev - Also copied drivers/virt/tegra/syscalls.h to include/soc/tegra/virt/syscalls.h. Later drivers/virt/tegra/syscalls.h will be deleted. Bug 200244271 Change-Id: Ief5c0bdc2941a02f7eba05a599fd2600f7e6a170 Reviewed-on: http://git-master/r/1252622 Signed-off-by: Aniruddha Banerjee <aniruddhab@nvidia.com> Reviewed-on: http://git-master/r/1314845 GVS: Gerrit_Virtual_Submit Reviewed-by: Timo Alho <talho@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r--include/soc/tegra/virt/syscalls.h336
1 files changed, 336 insertions, 0 deletions
diff --git a/include/soc/tegra/virt/syscalls.h b/include/soc/tegra/virt/syscalls.h
new file mode 100644
index 000000000..32ad31297
--- /dev/null
+++ b/include/soc/tegra/virt/syscalls.h
@@ -0,0 +1,336 @@
1/*
2 * Copyright (C) 2014-2016, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Hypervisor interfaces
5 *
6 * This header is BSD licensed so anyone can use the definitions to implement
7 * compatible drivers/servers.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of NVIDIA CORPORATION nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef __VMM_SYSCALLS_H__
35#define __VMM_SYSCALLS_H__
36
37#define HVC_NR_READ_STAT 1
38#define HVC_NR_READ_IVC 2
39#define HVC_NR_READ_GID 3
40#define HVC_NR_RAISE_IRQ 4
41#define HVC_NR_READ_NGUESTS 5
42#define HVC_NR_READ_IPA_PA 6
43#define HVC_NR_READ_GUEST_RESET_MASK 7
44#define HVC_NR_ACK_GUEST_CLEANUP 8
45#define HVC_NR_READ_HYP_INFO 9
46#define HVC_NR_GUEST_RESET 10
47#define HVC_NR_SYSINFO_IPA 13
48
49#define GUEST_PRIMARY 0
50#define GUEST_IVC_SERVER 0
51
52#define NGUESTS_MAX 16
53
54#ifndef __ASSEMBLY__
55
56#if defined(__KERNEL__)
57#include <linux/types.h>
58#endif
59
60struct tegra_hv_queue_data {
61 uint32_t id; /* IVC id */
62 uint32_t peers[2];
63 uint32_t size;
64 uint32_t nframes;
65 uint32_t frame_size;
66 uint32_t offset;
67 uint16_t irq, raise_irq;
68};
69
70struct ivc_mempool {
71 uint64_t pa;
72 uint64_t size;
73 uint32_t id;
74 uint32_t peer_vmid;
75};
76
77struct ivc_shared_area {
78 uint64_t pa;
79 uint64_t size;
80 uint32_t guest;
81 uint16_t free_irq_start;
82 uint16_t free_irq_count;
83};
84
85struct ivc_info_page {
86 uint32_t nr_queues;
87 uint32_t nr_areas;
88 uint32_t nr_mempools;
89
90 /* The actual length of this array is nr_areas. */
91 struct ivc_shared_area areas[];
92
93 /*
94 * Following the shared array is an array of queue data structures with
95 * an entry per queue that is assigned to the guest. This array is
96 * terminated by an entry with no frames.
97 *
98 * struct tegra_hv_queue_data queue_data[nr_queues];
99 */
100
101 /*
102 * Following the queue data array is an array of mempool structures
103 * with an entry per mempool assigned to the guest.
104 *
105 * struct ivc_mempool[nr_mempools];
106 */
107};
108
109static inline struct ivc_shared_area *ivc_shared_area_addr(
110 const struct ivc_info_page *info, uint32_t area_num)
111{
112 return ((struct ivc_shared_area *) (((uintptr_t) info) + sizeof(*info)))
113 + area_num;
114}
115
116static inline const struct tegra_hv_queue_data *ivc_info_queue_array(
117 const struct ivc_info_page *info)
118{
119 return (struct tegra_hv_queue_data *)&info->areas[info->nr_areas];
120}
121
122static inline const struct ivc_mempool *ivc_info_mempool_array(
123 const struct ivc_info_page *info)
124{
125 return (struct ivc_mempool *)
126 &ivc_info_queue_array(info)[info->nr_queues];
127}
128
129struct hyp_ipa_pa_info {
130 uint64_t base; /* base of contiguous pa region */
131 uint64_t offset; /* offset for requested ipa address */
132 uint64_t size; /* size of pa region */
133};
134
135#define HVC_MAX_VCPU 128
136
137struct trapped_access {
138 uint64_t ipa;
139 uint32_t size;
140 int32_t write_not_read;
141 uint64_t data;
142 uint32_t guest_id;
143};
144
145struct hyp_server_page {
146 /* guest reset protocol */
147 uint32_t guest_reset_virq;
148 /* boot delay offsets per VM needed by monitor partition */
149 uint32_t boot_delay[NGUESTS_MAX];
150
151 uint32_t trap_virq;
152
153 /*
154 * Bitmap of VCPU indices in vcpu_trapped_accesses containing active
155 * trap information.
156 */
157 uint32_t trapped_vcpus[HVC_MAX_VCPU / 32];
158 struct trapped_access vcpu_trapped_accesses[HVC_MAX_VCPU];
159
160 /* hypervisor trace log */
161 uint64_t log_ipa;
162 uint64_t log_size;
163};
164
165/* For backwards compatibility, alias the old name for hyp_server_name. */
166#define hyp_info_page hyp_server_page
167
168#ifdef CONFIG_ARM64
169
170#define _X4_X17 "x4", "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", \
171"x13", "x14", "x15", "x16", "x17"
172
173static inline int hyp_read_gid(unsigned int *gid)
174{
175 register uint64_t r0 asm("x0");
176 register uint64_t r1 asm("x1");
177
178 asm("hvc %2"
179 : "=r"(r0), "=r"(r1)
180 : "i"(HVC_NR_READ_GID)
181 : "x2", "x3", _X4_X17);
182
183 *gid = r1;
184 return (int)r0;
185}
186
187static inline int hyp_read_nguests(unsigned int *nguests)
188{
189 register uint64_t r0 asm("x0");
190 register uint64_t r1 asm("x1");
191
192 asm("hvc %2"
193 : "=r"(r0), "=r"(r1)
194 : "i"(HVC_NR_READ_NGUESTS)
195 : "x2", "x3", _X4_X17);
196
197 *nguests = r1;
198 return (int)r0;
199}
200
201static inline int hyp_read_ivc_info(uint64_t *ivc_info_page_pa)
202{
203 register uint64_t r0 asm("x0");