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