xref: /freebsd/sys/amd64/vmm/amd/amdv.c (revision 98ed632c63bec8b8cfe7f8849f74ba15657bd06b)
1366f6083SPeter Grehan /*-
2366f6083SPeter Grehan  * Copyright (c) 2011 NetApp, Inc.
3366f6083SPeter Grehan  * All rights reserved.
4366f6083SPeter Grehan  *
5366f6083SPeter Grehan  * Redistribution and use in source and binary forms, with or without
6366f6083SPeter Grehan  * modification, are permitted provided that the following conditions
7366f6083SPeter Grehan  * are met:
8366f6083SPeter Grehan  * 1. Redistributions of source code must retain the above copyright
9366f6083SPeter Grehan  *    notice, this list of conditions and the following disclaimer.
10366f6083SPeter Grehan  * 2. Redistributions in binary form must reproduce the above copyright
11366f6083SPeter Grehan  *    notice, this list of conditions and the following disclaimer in the
12366f6083SPeter Grehan  *    documentation and/or other materials provided with the distribution.
13366f6083SPeter Grehan  *
14366f6083SPeter Grehan  * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15366f6083SPeter Grehan  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16366f6083SPeter Grehan  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17366f6083SPeter Grehan  * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18366f6083SPeter Grehan  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19366f6083SPeter Grehan  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20366f6083SPeter Grehan  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21366f6083SPeter Grehan  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22366f6083SPeter Grehan  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23366f6083SPeter Grehan  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24366f6083SPeter Grehan  * SUCH DAMAGE.
25366f6083SPeter Grehan  *
26366f6083SPeter Grehan  * $FreeBSD$
27366f6083SPeter Grehan  */
28366f6083SPeter Grehan 
29366f6083SPeter Grehan #include <sys/cdefs.h>
30366f6083SPeter Grehan __FBSDID("$FreeBSD$");
31366f6083SPeter Grehan 
32366f6083SPeter Grehan #include <sys/param.h>
33366f6083SPeter Grehan #include <sys/systm.h>
34366f6083SPeter Grehan #include <sys/errno.h>
35a5615c90SPeter Grehan #include <sys/smp.h>
36366f6083SPeter Grehan 
37366f6083SPeter Grehan #include <machine/vmm.h>
38366f6083SPeter Grehan #include "io/iommu.h"
39366f6083SPeter Grehan 
40366f6083SPeter Grehan static int
41366f6083SPeter Grehan amdv_init(void)
42366f6083SPeter Grehan {
43366f6083SPeter Grehan 
44366f6083SPeter Grehan 	printf("amdv_init: not implemented\n");
45366f6083SPeter Grehan 	return (ENXIO);
46366f6083SPeter Grehan }
47366f6083SPeter Grehan 
48366f6083SPeter Grehan static int
49366f6083SPeter Grehan amdv_cleanup(void)
50366f6083SPeter Grehan {
51366f6083SPeter Grehan 
52366f6083SPeter Grehan 	printf("amdv_cleanup: not implemented\n");
53366f6083SPeter Grehan 	return (ENXIO);
54366f6083SPeter Grehan }
55366f6083SPeter Grehan 
56366f6083SPeter Grehan static void *
57366f6083SPeter Grehan amdv_vminit(struct vm *vm)
58366f6083SPeter Grehan {
59366f6083SPeter Grehan 
60366f6083SPeter Grehan 	printf("amdv_vminit: not implemented\n");
61366f6083SPeter Grehan 	return (NULL);
62366f6083SPeter Grehan }
63366f6083SPeter Grehan 
64366f6083SPeter Grehan static int
65*98ed632cSNeel Natu amdv_vmrun(void *arg, int vcpu, register_t rip)
66366f6083SPeter Grehan {
67366f6083SPeter Grehan 
68366f6083SPeter Grehan 	printf("amdv_vmrun: not implemented\n");
69366f6083SPeter Grehan 	return (ENXIO);
70366f6083SPeter Grehan }
71366f6083SPeter Grehan 
72366f6083SPeter Grehan static void
73366f6083SPeter Grehan amdv_vmcleanup(void *arg)
74366f6083SPeter Grehan {
75366f6083SPeter Grehan 
76366f6083SPeter Grehan 	printf("amdv_vmcleanup: not implemented\n");
77366f6083SPeter Grehan 	return;
78366f6083SPeter Grehan }
79366f6083SPeter Grehan 
80366f6083SPeter Grehan static int
81366f6083SPeter Grehan amdv_vmmmap(void *arg, vm_paddr_t gpa, vm_paddr_t hpa, size_t length,
82366f6083SPeter Grehan 	    vm_memattr_t attr, int prot, boolean_t spok)
83366f6083SPeter Grehan {
84366f6083SPeter Grehan 
85366f6083SPeter Grehan 	printf("amdv_vmmmap: not implemented\n");
86366f6083SPeter Grehan 	return (EINVAL);
87366f6083SPeter Grehan }
88366f6083SPeter Grehan 
89366f6083SPeter Grehan static int
90366f6083SPeter Grehan amdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval)
91366f6083SPeter Grehan {
92366f6083SPeter Grehan 
93366f6083SPeter Grehan 	printf("amdv_getreg: not implemented\n");
94366f6083SPeter Grehan 	return (EINVAL);
95366f6083SPeter Grehan }
96366f6083SPeter Grehan 
97366f6083SPeter Grehan static int
98366f6083SPeter Grehan amdv_setreg(void *arg, int vcpu, int regnum, uint64_t val)
99366f6083SPeter Grehan {
100366f6083SPeter Grehan 
101366f6083SPeter Grehan 	printf("amdv_setreg: not implemented\n");
102366f6083SPeter Grehan 	return (EINVAL);
103366f6083SPeter Grehan }
104366f6083SPeter Grehan 
105366f6083SPeter Grehan static int
106366f6083SPeter Grehan amdv_getdesc(void *vmi, int vcpu, int num, struct seg_desc *desc)
107366f6083SPeter Grehan {
108366f6083SPeter Grehan 
109366f6083SPeter Grehan 	printf("amdv_get_desc: not implemented\n");
110366f6083SPeter Grehan 	return (EINVAL);
111366f6083SPeter Grehan }
112366f6083SPeter Grehan 
113366f6083SPeter Grehan static int
114366f6083SPeter Grehan amdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc)
115366f6083SPeter Grehan {
116366f6083SPeter Grehan 
117366f6083SPeter Grehan 	printf("amdv_get_desc: not implemented\n");
118366f6083SPeter Grehan 	return (EINVAL);
119366f6083SPeter Grehan }
120366f6083SPeter Grehan 
121366f6083SPeter Grehan static int
122366f6083SPeter Grehan amdv_inject_event(void *vmi, int vcpu, int type, int vector,
123366f6083SPeter Grehan 		  uint32_t error_code, int error_code_valid)
124366f6083SPeter Grehan {
125366f6083SPeter Grehan 
126366f6083SPeter Grehan 	printf("amdv_inject_event: not implemented\n");
127366f6083SPeter Grehan 	return (EINVAL);
128366f6083SPeter Grehan }
129366f6083SPeter Grehan 
130366f6083SPeter Grehan static int
131366f6083SPeter Grehan amdv_nmi(void *arg, int vcpu)
132366f6083SPeter Grehan {
133366f6083SPeter Grehan 
134366f6083SPeter Grehan 	printf("amdv_nmi: not implemented\n");
135366f6083SPeter Grehan         return (EINVAL);
136366f6083SPeter Grehan }
137366f6083SPeter Grehan 
138366f6083SPeter Grehan static int
139366f6083SPeter Grehan amdv_getcap(void *arg, int vcpu, int type, int *retval)
140366f6083SPeter Grehan {
141366f6083SPeter Grehan 
142366f6083SPeter Grehan 	printf("amdv_getcap: not implemented\n");
143366f6083SPeter Grehan 	return (EINVAL);
144366f6083SPeter Grehan }
145366f6083SPeter Grehan 
146366f6083SPeter Grehan static int
147366f6083SPeter Grehan amdv_setcap(void *arg, int vcpu, int type, int val)
148366f6083SPeter Grehan {
149366f6083SPeter Grehan 
150366f6083SPeter Grehan 	printf("amdv_setcap: not implemented\n");
151366f6083SPeter Grehan 	return (EINVAL);
152366f6083SPeter Grehan }
153366f6083SPeter Grehan 
154366f6083SPeter Grehan struct vmm_ops vmm_ops_amd = {
155366f6083SPeter Grehan 	amdv_init,
156366f6083SPeter Grehan 	amdv_cleanup,
157366f6083SPeter Grehan 	amdv_vminit,
158366f6083SPeter Grehan 	amdv_vmrun,
159366f6083SPeter Grehan 	amdv_vmcleanup,
160366f6083SPeter Grehan 	amdv_vmmmap,
161366f6083SPeter Grehan 	amdv_getreg,
162366f6083SPeter Grehan 	amdv_setreg,
163366f6083SPeter Grehan 	amdv_getdesc,
164366f6083SPeter Grehan 	amdv_setdesc,
165366f6083SPeter Grehan 	amdv_inject_event,
166366f6083SPeter Grehan 	amdv_nmi,
167366f6083SPeter Grehan 	amdv_getcap,
168366f6083SPeter Grehan 	amdv_setcap
169366f6083SPeter Grehan };
170366f6083SPeter Grehan 
171366f6083SPeter Grehan static int
172366f6083SPeter Grehan amd_iommu_init(void)
173366f6083SPeter Grehan {
174366f6083SPeter Grehan 
175366f6083SPeter Grehan 	printf("amd_iommu_init: not implemented\n");
176366f6083SPeter Grehan 	return (ENXIO);
177366f6083SPeter Grehan }
178366f6083SPeter Grehan 
179366f6083SPeter Grehan static void
180366f6083SPeter Grehan amd_iommu_cleanup(void)
181366f6083SPeter Grehan {
182366f6083SPeter Grehan 
183366f6083SPeter Grehan 	printf("amd_iommu_cleanup: not implemented\n");
184366f6083SPeter Grehan }
185366f6083SPeter Grehan 
186366f6083SPeter Grehan static void
187366f6083SPeter Grehan amd_iommu_enable(void)
188366f6083SPeter Grehan {
189366f6083SPeter Grehan 
190366f6083SPeter Grehan 	printf("amd_iommu_enable: not implemented\n");
191366f6083SPeter Grehan }
192366f6083SPeter Grehan 
193366f6083SPeter Grehan static void
194366f6083SPeter Grehan amd_iommu_disable(void)
195366f6083SPeter Grehan {
196366f6083SPeter Grehan 
197366f6083SPeter Grehan 	printf("amd_iommu_disable: not implemented\n");
198366f6083SPeter Grehan }
199366f6083SPeter Grehan 
200366f6083SPeter Grehan static void *
201366f6083SPeter Grehan amd_iommu_create_domain(vm_paddr_t maxaddr)
202366f6083SPeter Grehan {
203366f6083SPeter Grehan 
204366f6083SPeter Grehan 	printf("amd_iommu_create_domain: not implemented\n");
205366f6083SPeter Grehan 	return (NULL);
206366f6083SPeter Grehan }
207366f6083SPeter Grehan 
208366f6083SPeter Grehan static void
209366f6083SPeter Grehan amd_iommu_destroy_domain(void *domain)
210366f6083SPeter Grehan {
211366f6083SPeter Grehan 
212366f6083SPeter Grehan 	printf("amd_iommu_destroy_domain: not implemented\n");
213366f6083SPeter Grehan }
214366f6083SPeter Grehan 
215366f6083SPeter Grehan static uint64_t
216366f6083SPeter Grehan amd_iommu_create_mapping(void *domain, vm_paddr_t gpa, vm_paddr_t hpa,
217366f6083SPeter Grehan 			 uint64_t len)
218366f6083SPeter Grehan {
219366f6083SPeter Grehan 
220366f6083SPeter Grehan 	printf("amd_iommu_create_mapping: not implemented\n");
221366f6083SPeter Grehan 	return (0);
222366f6083SPeter Grehan }
223366f6083SPeter Grehan 
224366f6083SPeter Grehan static void
225366f6083SPeter Grehan amd_iommu_add_device(void *domain, int bus, int slot, int func)
226366f6083SPeter Grehan {
227366f6083SPeter Grehan 
228366f6083SPeter Grehan 	printf("amd_iommu_add_device: not implemented\n");
229366f6083SPeter Grehan }
230366f6083SPeter Grehan 
231366f6083SPeter Grehan static void
232366f6083SPeter Grehan amd_iommu_remove_device(void *domain, int bus, int slot, int func)
233366f6083SPeter Grehan {
234366f6083SPeter Grehan 
235366f6083SPeter Grehan 	printf("amd_iommu_remove_device: not implemented\n");
236366f6083SPeter Grehan }
237366f6083SPeter Grehan 
238366f6083SPeter Grehan struct iommu_ops iommu_ops_amd = {
239366f6083SPeter Grehan 	amd_iommu_init,
240366f6083SPeter Grehan 	amd_iommu_cleanup,
241366f6083SPeter Grehan 	amd_iommu_enable,
242366f6083SPeter Grehan 	amd_iommu_disable,
243366f6083SPeter Grehan 	amd_iommu_create_domain,
244366f6083SPeter Grehan 	amd_iommu_destroy_domain,
245366f6083SPeter Grehan 	amd_iommu_create_mapping,
246366f6083SPeter Grehan 	amd_iommu_add_device,
247366f6083SPeter Grehan 	amd_iommu_remove_device,
248366f6083SPeter Grehan };
249