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