xref: /freebsd/sys/amd64/vmm/amd/amdv.c (revision 7661de35d15f582ab33e3bd6b8d909601557e436)
1 /*-
2  * Copyright (c) 2011 NetApp, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
31 
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/errno.h>
35 #include <sys/smp.h>
36 
37 #include <machine/vmm.h>
38 #include "io/iommu.h"
39 
40 static int
41 amdv_init(int ipinum)
42 {
43 
44 	printf("amdv_init: not implemented\n");
45 	return (ENXIO);
46 }
47 
48 static int
49 amdv_cleanup(void)
50 {
51 
52 	printf("amdv_cleanup: not implemented\n");
53 	return (ENXIO);
54 }
55 
56 static void
57 amdv_resume(void)
58 {
59 }
60 
61 static void *
62 amdv_vminit(struct vm *vm, struct pmap *pmap)
63 {
64 
65 	printf("amdv_vminit: not implemented\n");
66 	return (NULL);
67 }
68 
69 static int
70 amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap, void *cookie)
71 {
72 
73 	printf("amdv_vmrun: not implemented\n");
74 	return (ENXIO);
75 }
76 
77 static void
78 amdv_vmcleanup(void *arg)
79 {
80 
81 	printf("amdv_vmcleanup: not implemented\n");
82 	return;
83 }
84 
85 static int
86 amdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval)
87 {
88 
89 	printf("amdv_getreg: not implemented\n");
90 	return (EINVAL);
91 }
92 
93 static int
94 amdv_setreg(void *arg, int vcpu, int regnum, uint64_t val)
95 {
96 
97 	printf("amdv_setreg: not implemented\n");
98 	return (EINVAL);
99 }
100 
101 static int
102 amdv_getdesc(void *vmi, int vcpu, int num, struct seg_desc *desc)
103 {
104 
105 	printf("amdv_get_desc: not implemented\n");
106 	return (EINVAL);
107 }
108 
109 static int
110 amdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc)
111 {
112 
113 	printf("amdv_get_desc: not implemented\n");
114 	return (EINVAL);
115 }
116 
117 static int
118 amdv_getcap(void *arg, int vcpu, int type, int *retval)
119 {
120 
121 	printf("amdv_getcap: not implemented\n");
122 	return (EINVAL);
123 }
124 
125 static int
126 amdv_setcap(void *arg, int vcpu, int type, int val)
127 {
128 
129 	printf("amdv_setcap: not implemented\n");
130 	return (EINVAL);
131 }
132 
133 static struct vmspace *
134 amdv_vmspace_alloc(vm_offset_t min, vm_offset_t max)
135 {
136 
137 	printf("amdv_vmspace_alloc: not implemented\n");
138 	return (NULL);
139 }
140 
141 static void
142 amdv_vmspace_free(struct vmspace *vmspace)
143 {
144 
145 	printf("amdv_vmspace_free: not implemented\n");
146 	return;
147 }
148 
149 static struct vlapic *
150 amdv_vlapic_init(void *arg, int vcpuid)
151 {
152 
153 	panic("amdv_vlapic_init: not implmented");
154 }
155 
156 static void
157 amdv_vlapic_cleanup(void *arg, struct vlapic *vlapic)
158 {
159 
160 	panic("amdv_vlapic_cleanup: not implemented");
161 }
162 
163 struct vmm_ops vmm_ops_amd = {
164 	amdv_init,
165 	amdv_cleanup,
166 	amdv_resume,
167 	amdv_vminit,
168 	amdv_vmrun,
169 	amdv_vmcleanup,
170 	amdv_getreg,
171 	amdv_setreg,
172 	amdv_getdesc,
173 	amdv_setdesc,
174 	amdv_getcap,
175 	amdv_setcap,
176 	amdv_vmspace_alloc,
177 	amdv_vmspace_free,
178 	amdv_vlapic_init,
179 	amdv_vlapic_cleanup,
180 };
181 
182 static int
183 amd_iommu_init(void)
184 {
185 
186 	printf("amd_iommu_init: not implemented\n");
187 	return (ENXIO);
188 }
189 
190 static void
191 amd_iommu_cleanup(void)
192 {
193 
194 	printf("amd_iommu_cleanup: not implemented\n");
195 }
196 
197 static void
198 amd_iommu_enable(void)
199 {
200 
201 	printf("amd_iommu_enable: not implemented\n");
202 }
203 
204 static void
205 amd_iommu_disable(void)
206 {
207 
208 	printf("amd_iommu_disable: not implemented\n");
209 }
210 
211 static void *
212 amd_iommu_create_domain(vm_paddr_t maxaddr)
213 {
214 
215 	printf("amd_iommu_create_domain: not implemented\n");
216 	return (NULL);
217 }
218 
219 static void
220 amd_iommu_destroy_domain(void *domain)
221 {
222 
223 	printf("amd_iommu_destroy_domain: not implemented\n");
224 }
225 
226 static uint64_t
227 amd_iommu_create_mapping(void *domain, vm_paddr_t gpa, vm_paddr_t hpa,
228 			 uint64_t len)
229 {
230 
231 	printf("amd_iommu_create_mapping: not implemented\n");
232 	return (0);
233 }
234 
235 static uint64_t
236 amd_iommu_remove_mapping(void *domain, vm_paddr_t gpa, uint64_t len)
237 {
238 
239 	printf("amd_iommu_remove_mapping: not implemented\n");
240 	return (0);
241 }
242 
243 static void
244 amd_iommu_add_device(void *domain, int bus, int slot, int func)
245 {
246 
247 	printf("amd_iommu_add_device: not implemented\n");
248 }
249 
250 static void
251 amd_iommu_remove_device(void *domain, int bus, int slot, int func)
252 {
253 
254 	printf("amd_iommu_remove_device: not implemented\n");
255 }
256 
257 static void
258 amd_iommu_invalidate_tlb(void *domain)
259 {
260 
261 	printf("amd_iommu_invalidate_tlb: not implemented\n");
262 }
263 
264 struct iommu_ops iommu_ops_amd = {
265 	amd_iommu_init,
266 	amd_iommu_cleanup,
267 	amd_iommu_enable,
268 	amd_iommu_disable,
269 	amd_iommu_create_domain,
270 	amd_iommu_destroy_domain,
271 	amd_iommu_create_mapping,
272 	amd_iommu_remove_mapping,
273 	amd_iommu_add_device,
274 	amd_iommu_remove_device,
275 	amd_iommu_invalidate_tlb,
276 };
277