xref: /freebsd/sys/amd64/vmm/amd/amdv.c (revision 2f02600abfddfc4e9f20dd384a2e729b451e16bd)
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(void)
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_vminit(struct vm *vm, struct pmap *pmap)
58 {
59 
60 	printf("amdv_vminit: not implemented\n");
61 	return (NULL);
62 }
63 
64 static int
65 amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap)
66 {
67 
68 	printf("amdv_vmrun: not implemented\n");
69 	return (ENXIO);
70 }
71 
72 static void
73 amdv_vmcleanup(void *arg)
74 {
75 
76 	printf("amdv_vmcleanup: not implemented\n");
77 	return;
78 }
79 
80 static int
81 amdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval)
82 {
83 
84 	printf("amdv_getreg: not implemented\n");
85 	return (EINVAL);
86 }
87 
88 static int
89 amdv_setreg(void *arg, int vcpu, int regnum, uint64_t val)
90 {
91 
92 	printf("amdv_setreg: not implemented\n");
93 	return (EINVAL);
94 }
95 
96 static int
97 amdv_getdesc(void *vmi, int vcpu, int num, struct seg_desc *desc)
98 {
99 
100 	printf("amdv_get_desc: not implemented\n");
101 	return (EINVAL);
102 }
103 
104 static int
105 amdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc)
106 {
107 
108 	printf("amdv_get_desc: not implemented\n");
109 	return (EINVAL);
110 }
111 
112 static int
113 amdv_inject_event(void *vmi, int vcpu, int type, int vector,
114 		  uint32_t error_code, int error_code_valid)
115 {
116 
117 	printf("amdv_inject_event: not implemented\n");
118 	return (EINVAL);
119 }
120 
121 static int
122 amdv_getcap(void *arg, int vcpu, int type, int *retval)
123 {
124 
125 	printf("amdv_getcap: not implemented\n");
126 	return (EINVAL);
127 }
128 
129 static int
130 amdv_setcap(void *arg, int vcpu, int type, int val)
131 {
132 
133 	printf("amdv_setcap: not implemented\n");
134 	return (EINVAL);
135 }
136 
137 static struct vmspace *
138 amdv_vmspace_alloc(vm_offset_t min, vm_offset_t max)
139 {
140 
141 	printf("amdv_vmspace_alloc: not implemented\n");
142 	return (NULL);
143 }
144 
145 static void
146 amdv_vmspace_free(struct vmspace *vmspace)
147 {
148 
149 	printf("amdv_vmspace_free: not implemented\n");
150 	return;
151 }
152 
153 struct vmm_ops vmm_ops_amd = {
154 	amdv_init,
155 	amdv_cleanup,
156 	amdv_vminit,
157 	amdv_vmrun,
158 	amdv_vmcleanup,
159 	amdv_getreg,
160 	amdv_setreg,
161 	amdv_getdesc,
162 	amdv_setdesc,
163 	amdv_inject_event,
164 	amdv_getcap,
165 	amdv_setcap,
166 	amdv_vmspace_alloc,
167 	amdv_vmspace_free,
168 };
169 
170 static int
171 amd_iommu_init(void)
172 {
173 
174 	printf("amd_iommu_init: not implemented\n");
175 	return (ENXIO);
176 }
177 
178 static void
179 amd_iommu_cleanup(void)
180 {
181 
182 	printf("amd_iommu_cleanup: not implemented\n");
183 }
184 
185 static void
186 amd_iommu_enable(void)
187 {
188 
189 	printf("amd_iommu_enable: not implemented\n");
190 }
191 
192 static void
193 amd_iommu_disable(void)
194 {
195 
196 	printf("amd_iommu_disable: not implemented\n");
197 }
198 
199 static void *
200 amd_iommu_create_domain(vm_paddr_t maxaddr)
201 {
202 
203 	printf("amd_iommu_create_domain: not implemented\n");
204 	return (NULL);
205 }
206 
207 static void
208 amd_iommu_destroy_domain(void *domain)
209 {
210 
211 	printf("amd_iommu_destroy_domain: not implemented\n");
212 }
213 
214 static uint64_t
215 amd_iommu_create_mapping(void *domain, vm_paddr_t gpa, vm_paddr_t hpa,
216 			 uint64_t len)
217 {
218 
219 	printf("amd_iommu_create_mapping: not implemented\n");
220 	return (0);
221 }
222 
223 static uint64_t
224 amd_iommu_remove_mapping(void *domain, vm_paddr_t gpa, uint64_t len)
225 {
226 
227 	printf("amd_iommu_remove_mapping: not implemented\n");
228 	return (0);
229 }
230 
231 static void
232 amd_iommu_add_device(void *domain, int bus, int slot, int func)
233 {
234 
235 	printf("amd_iommu_add_device: not implemented\n");
236 }
237 
238 static void
239 amd_iommu_remove_device(void *domain, int bus, int slot, int func)
240 {
241 
242 	printf("amd_iommu_remove_device: not implemented\n");
243 }
244 
245 static void
246 amd_iommu_invalidate_tlb(void *domain)
247 {
248 
249 	printf("amd_iommu_invalidate_tlb: not implemented\n");
250 }
251 
252 struct iommu_ops iommu_ops_amd = {
253 	amd_iommu_init,
254 	amd_iommu_cleanup,
255 	amd_iommu_enable,
256 	amd_iommu_disable,
257 	amd_iommu_create_domain,
258 	amd_iommu_destroy_domain,
259 	amd_iommu_create_mapping,
260 	amd_iommu_remove_mapping,
261 	amd_iommu_add_device,
262 	amd_iommu_remove_device,
263 	amd_iommu_invalidate_tlb,
264 };
265