amdv.c revision 266339
1139826Simp/*- 253541Sshin * Copyright (c) 2011 NetApp, Inc. 353541Sshin * All rights reserved. 453541Sshin * 553541Sshin * Redistribution and use in source and binary forms, with or without 653541Sshin * modification, are permitted provided that the following conditions 753541Sshin * are met: 853541Sshin * 1. Redistributions of source code must retain the above copyright 953541Sshin * notice, this list of conditions and the following disclaimer. 1053541Sshin * 2. Redistributions in binary form must reproduce the above copyright 1153541Sshin * notice, this list of conditions and the following disclaimer in the 1253541Sshin * documentation and/or other materials provided with the distribution. 1353541Sshin * 1453541Sshin * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND 1553541Sshin * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1653541Sshin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1753541Sshin * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE 1853541Sshin * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1953541Sshin * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2053541Sshin * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2153541Sshin * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2253541Sshin * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2353541Sshin * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2453541Sshin * SUCH DAMAGE. 2553541Sshin * 2653541Sshin * $FreeBSD: stable/10/sys/amd64/vmm/amd/amdv.c 266339 2014-05-17 19:11:08Z jhb $ 2753541Sshin */ 28174510Sobrien 29174510Sobrien#include <sys/cdefs.h> 3053541Sshin__FBSDID("$FreeBSD: stable/10/sys/amd64/vmm/amd/amdv.c 266339 2014-05-17 19:11:08Z jhb $"); 3153541Sshin 32139826Simp#include <sys/param.h> 3353541Sshin#include <sys/systm.h> 3453541Sshin#include <sys/errno.h> 3553541Sshin#include <sys/smp.h> 3653541Sshin 3753541Sshin#include <machine/vmm.h> 3853541Sshin#include "io/iommu.h" 3953541Sshin 4053541Sshinstatic int 4153541Sshinamdv_init(int ipinum) 4253541Sshin{ 4353541Sshin 4453541Sshin printf("amdv_init: not implemented\n"); 4553541Sshin return (ENXIO); 4653541Sshin} 4753541Sshin 4853541Sshinstatic int 4953541Sshinamdv_cleanup(void) 5053541Sshin{ 5153541Sshin 5253541Sshin printf("amdv_cleanup: not implemented\n"); 5353541Sshin return (ENXIO); 5453541Sshin} 5553541Sshin 5653541Sshinstatic void 5753541Sshinamdv_resume(void) 5853541Sshin{ 5953541Sshin} 6053541Sshin 6153541Sshinstatic void * 6253541Sshinamdv_vminit(struct vm *vm, struct pmap *pmap) 63174510Sobrien{ 64174510Sobrien 65174510Sobrien printf("amdv_vminit: not implemented\n"); 6655679Sshin return (NULL); 6762587Sitojun} 6855009Sshin 69148921Ssuzstatic int 70142215Sglebiusamdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap, void *cookie) 71163953Srrs{ 72178167Sqingli 7355009Sshin printf("amdv_vmrun: not implemented\n"); 7453541Sshin return (ENXIO); 7553541Sshin} 7653541Sshin 77185895Szecstatic void 7853541Sshinamdv_vmcleanup(void *arg) 7953541Sshin{ 8053541Sshin 8153541Sshin printf("amdv_vmcleanup: not implemented\n"); 8253541Sshin return; 8353541Sshin} 84181803Sbz 8553541Sshinstatic int 8653541Sshinamdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval) 8753541Sshin{ 8853541Sshin 89178167Sqingli printf("amdv_getreg: not implemented\n"); 90178167Sqingli return (EINVAL); 91178167Sqingli} 9253541Sshin 9353541Sshinstatic int 9453541Sshinamdv_setreg(void *arg, int vcpu, int regnum, uint64_t val) 9553541Sshin{ 9662587Sitojun 9753541Sshin printf("amdv_setreg: not implemented\n"); 9853541Sshin return (EINVAL); 9962587Sitojun} 10053541Sshin 10162587Sitojunstatic int 10253541Sshinamdv_getdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) 10353541Sshin{ 10453541Sshin 10553541Sshin printf("amdv_get_desc: not implemented\n"); 10653541Sshin return (EINVAL); 10753541Sshin} 10853541Sshin 10978064Sumestatic int 11053541Sshinamdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) 11153541Sshin{ 11253541Sshin 11353541Sshin printf("amdv_get_desc: not implemented\n"); 114142215Sglebius return (EINVAL); 115142215Sglebius} 116142215Sglebius 117142215Sglebiusstatic int 118163953Srrsamdv_inject_event(void *vmi, int vcpu, int type, int vector, 119163953Srrs uint32_t error_code, int error_code_valid) 120163953Srrs{ 121163953Srrs 122163953Srrs printf("amdv_inject_event: not implemented\n"); 123163953Srrs return (EINVAL); 124163953Srrs} 125163953Srrs 126171167Sgnnstatic int 127171133Sgnnamdv_getcap(void *arg, int vcpu, int type, int *retval) 128105199Ssam{ 129171167Sgnn 130105199Ssam printf("amdv_getcap: not implemented\n"); 13153541Sshin return (EINVAL); 132185571Sbz} 13353541Sshin 13453541Sshinstatic int 13553541Sshinamdv_setcap(void *arg, int vcpu, int type, int val) 13653541Sshin{ 13753541Sshin 13862587Sitojun printf("amdv_setcap: not implemented\n"); 139148917Sobrien return (EINVAL); 14053541Sshin} 14178064Sume 14278064Sumestatic struct vmspace * 14378064Sumeamdv_vmspace_alloc(vm_offset_t min, vm_offset_t max) 14453541Sshin{ 145152242Sru 146152242Sru printf("amdv_vmspace_alloc: not implemented\n"); 147152242Sru return (NULL); 148152242Sru} 149152242Sru 150152242Srustatic void 151152242Sruamdv_vmspace_free(struct vmspace *vmspace) 152152242Sru{ 15353541Sshin 154152242Sru printf("amdv_vmspace_free: not implemented\n"); 155152242Sru return; 156152242Sru} 157152242Sru 158152242Srustatic struct vlapic * 159152242Sruamdv_vlapic_init(void *arg, int vcpuid) 160152242Sru{ 161152242Sru 162152242Sru panic("amdv_vlapic_init: not implmented"); 16354263Sshin} 164152242Sru 165152242Srustatic void 166152242Sruamdv_vlapic_cleanup(void *arg, struct vlapic *vlapic) 167152242Sru{ 168152242Sru 169152242Sru panic("amdv_vlapic_cleanup: not implemented"); 170152242Sru} 171152242Sru 172152242Srustruct vmm_ops vmm_ops_amd = { 173152242Sru amdv_init, 174152242Sru amdv_cleanup, 175152242Sru amdv_resume, 17655679Sshin amdv_vminit, 177152242Sru amdv_vmrun, 178152242Sru amdv_vmcleanup, 17955679Sshin amdv_getreg, 180163953Srrs amdv_setreg, 181171260Sdelphij amdv_getdesc, 182171260Sdelphij amdv_setdesc, 183171260Sdelphij amdv_inject_event, 184171260Sdelphij amdv_getcap, 185171260Sdelphij amdv_setcap, 186171260Sdelphij amdv_vmspace_alloc, 187171260Sdelphij amdv_vmspace_free, 188163953Srrs amdv_vlapic_init, 189171260Sdelphij amdv_vlapic_cleanup, 190171260Sdelphij}; 191163953Srrs 192152242Srustatic int 193171260Sdelphijamd_iommu_init(void) 194171260Sdelphij{ 195171260Sdelphij 196171260Sdelphij printf("amd_iommu_init: not implemented\n"); 197171260Sdelphij return (ENXIO); 198171260Sdelphij} 199163953Srrs 200171260Sdelphijstatic void 201171260Sdelphijamd_iommu_cleanup(void) 202163953Srrs{ 203163953Srrs 204171260Sdelphij printf("amd_iommu_cleanup: not implemented\n"); 205171260Sdelphij} 206171260Sdelphij 207171260Sdelphijstatic void 208171260Sdelphijamd_iommu_enable(void) 209171260Sdelphij{ 210171260Sdelphij 211163953Srrs printf("amd_iommu_enable: not implemented\n"); 212171260Sdelphij} 213171260Sdelphij 214163953Srrsstatic void 215163953Srrsamd_iommu_disable(void) 216163953Srrs{ 217152242Sru 218152242Sru printf("amd_iommu_disable: not implemented\n"); 219152242Sru} 220152242Sru 221152242Srustatic void * 222152242Sruamd_iommu_create_domain(vm_paddr_t maxaddr) 223152242Sru{ 224152242Sru 225152242Sru printf("amd_iommu_create_domain: not implemented\n"); 22653541Sshin return (NULL); 227152242Sru} 228152242Sru 229152242Srustatic void 230152242Sruamd_iommu_destroy_domain(void *domain) 231152242Sru{ 232152242Sru 233152242Sru printf("amd_iommu_destroy_domain: not implemented\n"); 234152242Sru} 235152242Sru 236152242Srustatic uint64_t 237152242Sruamd_iommu_create_mapping(void *domain, vm_paddr_t gpa, vm_paddr_t hpa, 238152242Sru uint64_t len) 23953541Sshin{ 240152242Sru 241152242Sru printf("amd_iommu_create_mapping: not implemented\n"); 242152242Sru return (0); 243152242Sru} 244152242Sru 245152242Srustatic uint64_t 246152242Sruamd_iommu_remove_mapping(void *domain, vm_paddr_t gpa, uint64_t len) 24753541Sshin{ 248152242Sru 249152242Sru printf("amd_iommu_remove_mapping: not implemented\n"); 250152242Sru return (0); 251152242Sru} 252152242Sru 253152242Srustatic void 254152242Sruamd_iommu_add_device(void *domain, int bus, int slot, int func) 25553541Sshin{ 256152242Sru 257152242Sru printf("amd_iommu_add_device: not implemented\n"); 258152242Sru} 259152242Sru 260152242Srustatic void 261152242Sruamd_iommu_remove_device(void *domain, int bus, int slot, int func) 262152242Sru{ 26353541Sshin 264171167Sgnn printf("amd_iommu_remove_device: not implemented\n"); 265152242Sru} 266152242Sru 267152242Srustatic void 268152242Sruamd_iommu_invalidate_tlb(void *domain) 269152242Sru{ 270171133Sgnn 271152242Sru printf("amd_iommu_invalidate_tlb: not implemented\n"); 27253541Sshin} 273152242Sru 274152242Srustruct iommu_ops iommu_ops_amd = { 275152242Sru amd_iommu_init, 276152242Sru amd_iommu_cleanup, 277152242Sru amd_iommu_enable, 278171133Sgnn amd_iommu_disable, 279152242Sru amd_iommu_create_domain, 280152242Sru amd_iommu_destroy_domain, 28153541Sshin amd_iommu_create_mapping, 282152242Sru amd_iommu_remove_mapping, 283152242Sru amd_iommu_add_device, 284152242Sru amd_iommu_remove_device, 285152242Sru amd_iommu_invalidate_tlb, 286152242Sru}; 287171133Sgnn