amdv.c revision 221828
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 36#include <machine/vmm.h> 37#include "io/iommu.h" 38 39static int 40amdv_init(void) 41{ 42 43 printf("amdv_init: not implemented\n"); 44 return (ENXIO); 45} 46 47static int 48amdv_cleanup(void) 49{ 50 51 printf("amdv_cleanup: not implemented\n"); 52 return (ENXIO); 53} 54 55static void * 56amdv_vminit(struct vm *vm) 57{ 58 59 printf("amdv_vminit: not implemented\n"); 60 return (NULL); 61} 62 63static int 64amdv_vmrun(void *arg, int vcpu, register_t rip, struct vm_exit *vmexit) 65{ 66 67 printf("amdv_vmrun: not implemented\n"); 68 return (ENXIO); 69} 70 71static void 72amdv_vmcleanup(void *arg) 73{ 74 75 printf("amdv_vmcleanup: not implemented\n"); 76 return; 77} 78 79static int 80amdv_vmmmap(void *arg, vm_paddr_t gpa, vm_paddr_t hpa, size_t length, 81 vm_memattr_t attr, int prot, boolean_t spok) 82{ 83 84 printf("amdv_vmmmap: not implemented\n"); 85 return (EINVAL); 86} 87 88static int 89amdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval) 90{ 91 92 printf("amdv_getreg: not implemented\n"); 93 return (EINVAL); 94} 95 96static int 97amdv_setreg(void *arg, int vcpu, int regnum, uint64_t val) 98{ 99 100 printf("amdv_setreg: not implemented\n"); 101 return (EINVAL); 102} 103 104static int 105amdv_getdesc(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 112static int 113amdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) 114{ 115 116 printf("amdv_get_desc: not implemented\n"); 117 return (EINVAL); 118} 119 120static int 121amdv_inject_event(void *vmi, int vcpu, int type, int vector, 122 uint32_t error_code, int error_code_valid) 123{ 124 125 printf("amdv_inject_event: not implemented\n"); 126 return (EINVAL); 127} 128 129static int 130amdv_nmi(void *arg, int vcpu) 131{ 132 133 printf("amdv_nmi: not implemented\n"); 134 return (EINVAL); 135} 136 137static int 138amdv_getcap(void *arg, int vcpu, int type, int *retval) 139{ 140 141 printf("amdv_getcap: not implemented\n"); 142 return (EINVAL); 143} 144 145static int 146amdv_setcap(void *arg, int vcpu, int type, int val) 147{ 148 149 printf("amdv_setcap: not implemented\n"); 150 return (EINVAL); 151} 152 153struct vmm_ops vmm_ops_amd = { 154 amdv_init, 155 amdv_cleanup, 156 amdv_vminit, 157 amdv_vmrun, 158 amdv_vmcleanup, 159 amdv_vmmmap, 160 amdv_getreg, 161 amdv_setreg, 162 amdv_getdesc, 163 amdv_setdesc, 164 amdv_inject_event, 165 amdv_nmi, 166 amdv_getcap, 167 amdv_setcap 168}; 169 170static int 171amd_iommu_init(void) 172{ 173 174 printf("amd_iommu_init: not implemented\n"); 175 return (ENXIO); 176} 177 178static void 179amd_iommu_cleanup(void) 180{ 181 182 printf("amd_iommu_cleanup: not implemented\n"); 183} 184 185static void 186amd_iommu_enable(void) 187{ 188 189 printf("amd_iommu_enable: not implemented\n"); 190} 191 192static void 193amd_iommu_disable(void) 194{ 195 196 printf("amd_iommu_disable: not implemented\n"); 197} 198 199static void * 200amd_iommu_create_domain(vm_paddr_t maxaddr) 201{ 202 203 printf("amd_iommu_create_domain: not implemented\n"); 204 return (NULL); 205} 206 207static void 208amd_iommu_destroy_domain(void *domain) 209{ 210 211 printf("amd_iommu_destroy_domain: not implemented\n"); 212} 213 214static uint64_t 215amd_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 223static void 224amd_iommu_add_device(void *domain, int bus, int slot, int func) 225{ 226 227 printf("amd_iommu_add_device: not implemented\n"); 228} 229 230static void 231amd_iommu_remove_device(void *domain, int bus, int slot, int func) 232{ 233 234 printf("amd_iommu_remove_device: not implemented\n"); 235} 236 237struct iommu_ops iommu_ops_amd = { 238 amd_iommu_init, 239 amd_iommu_cleanup, 240 amd_iommu_enable, 241 amd_iommu_disable, 242 amd_iommu_create_domain, 243 amd_iommu_destroy_domain, 244 amd_iommu_create_mapping, 245 amd_iommu_add_device, 246 amd_iommu_remove_device, 247}; 248