vmm.c (263290) | vmm.c (263744) |
---|---|
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 unchanged lines hidden (view full) --- 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 * | 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 unchanged lines hidden (view full) --- 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: head/sys/amd64/vmm/vmm.c 263290 2014-03-18 02:49:28Z neel $ | 26 * $FreeBSD: head/sys/amd64/vmm/vmm.c 263744 2014-03-25 19:20:34Z tychon $ |
27 */ 28 29#include <sys/cdefs.h> | 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 263290 2014-03-18 02:49:28Z neel $"); | 30__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 263744 2014-03-25 19:20:34Z tychon $"); |
31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/sysctl.h> 37#include <sys/malloc.h> 38#include <sys/pcpu.h> --- 24 unchanged lines hidden (view full) --- 63#include <machine/vmm.h> 64#include <machine/vmm_dev.h> 65 66#include "vmm_ktr.h" 67#include "vmm_host.h" 68#include "vmm_mem.h" 69#include "vmm_util.h" 70#include "vatpic.h" | 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/sysctl.h> 37#include <sys/malloc.h> 38#include <sys/pcpu.h> --- 24 unchanged lines hidden (view full) --- 63#include <machine/vmm.h> 64#include <machine/vmm_dev.h> 65 66#include "vmm_ktr.h" 67#include "vmm_host.h" 68#include "vmm_mem.h" 69#include "vmm_util.h" 70#include "vatpic.h" |
71#include "vatpit.h" |
|
71#include "vhpet.h" 72#include "vioapic.h" 73#include "vlapic.h" 74#include "vmm_msr.h" 75#include "vmm_ipi.h" 76#include "vmm_stat.h" 77#include "vmm_lapic.h" 78 --- 35 unchanged lines hidden (view full) --- 114#define VM_MAX_MEMORY_SEGMENTS 2 115 116struct vm { 117 void *cookie; /* processor-specific data */ 118 void *iommu; /* iommu-specific data */ 119 struct vhpet *vhpet; /* virtual HPET */ 120 struct vioapic *vioapic; /* virtual ioapic */ 121 struct vatpic *vatpic; /* virtual atpic */ | 72#include "vhpet.h" 73#include "vioapic.h" 74#include "vlapic.h" 75#include "vmm_msr.h" 76#include "vmm_ipi.h" 77#include "vmm_stat.h" 78#include "vmm_lapic.h" 79 --- 35 unchanged lines hidden (view full) --- 115#define VM_MAX_MEMORY_SEGMENTS 2 116 117struct vm { 118 void *cookie; /* processor-specific data */ 119 void *iommu; /* iommu-specific data */ 120 struct vhpet *vhpet; /* virtual HPET */ 121 struct vioapic *vioapic; /* virtual ioapic */ 122 struct vatpic *vatpic; /* virtual atpic */ |
123 struct vatpit *vatpit; /* virtual atpit */ |
|
122 struct vmspace *vmspace; /* guest's address space */ 123 struct vcpu vcpu[VM_MAXCPU]; 124 int num_mem_segs; 125 struct mem_seg mem_segs[VM_MAX_MEMORY_SEGMENTS]; 126 char name[VM_MAX_NAMELEN]; 127 128 /* 129 * Set of active vcpus. --- 214 unchanged lines hidden (view full) --- 344 vm = malloc(sizeof(struct vm), M_VM, M_WAITOK | M_ZERO); 345 strcpy(vm->name, name); 346 vm->vmspace = vmspace; 347 mtx_init(&vm->rendezvous_mtx, "vm rendezvous lock", 0, MTX_DEF); 348 vm->cookie = VMINIT(vm, vmspace_pmap(vmspace)); 349 vm->vioapic = vioapic_init(vm); 350 vm->vhpet = vhpet_init(vm); 351 vm->vatpic = vatpic_init(vm); | 124 struct vmspace *vmspace; /* guest's address space */ 125 struct vcpu vcpu[VM_MAXCPU]; 126 int num_mem_segs; 127 struct mem_seg mem_segs[VM_MAX_MEMORY_SEGMENTS]; 128 char name[VM_MAX_NAMELEN]; 129 130 /* 131 * Set of active vcpus. --- 214 unchanged lines hidden (view full) --- 346 vm = malloc(sizeof(struct vm), M_VM, M_WAITOK | M_ZERO); 347 strcpy(vm->name, name); 348 vm->vmspace = vmspace; 349 mtx_init(&vm->rendezvous_mtx, "vm rendezvous lock", 0, MTX_DEF); 350 vm->cookie = VMINIT(vm, vmspace_pmap(vmspace)); 351 vm->vioapic = vioapic_init(vm); 352 vm->vhpet = vhpet_init(vm); 353 vm->vatpic = vatpic_init(vm); |
354 vm->vatpit = vatpit_init(vm); |
|
352 353 for (i = 0; i < VM_MAXCPU; i++) { 354 vcpu_init(vm, i); 355 guest_msrs_init(vm, i); 356 } 357 358 vm_activate_cpu(vm, BSP); 359 --- 16 unchanged lines hidden (view full) --- 376{ 377 int i; 378 379 ppt_unassign_all(vm); 380 381 if (vm->iommu != NULL) 382 iommu_destroy_domain(vm->iommu); 383 | 355 356 for (i = 0; i < VM_MAXCPU; i++) { 357 vcpu_init(vm, i); 358 guest_msrs_init(vm, i); 359 } 360 361 vm_activate_cpu(vm, BSP); 362 --- 16 unchanged lines hidden (view full) --- 379{ 380 int i; 381 382 ppt_unassign_all(vm); 383 384 if (vm->iommu != NULL) 385 iommu_destroy_domain(vm->iommu); 386 |
387 vatpit_cleanup(vm->vatpit); |
|
384 vhpet_cleanup(vm->vhpet); 385 vatpic_cleanup(vm->vatpic); 386 vioapic_cleanup(vm->vioapic); 387 388 for (i = 0; i < vm->num_mem_segs; i++) 389 vm_free_mem_seg(vm, &vm->mem_segs[i]); 390 391 vm->num_mem_segs = 0; --- 1343 unchanged lines hidden (view full) --- 1735 vm_handle_rendezvous(vm, vcpuid); 1736} 1737 1738struct vatpic * 1739vm_atpic(struct vm *vm) 1740{ 1741 return (vm->vatpic); 1742} | 388 vhpet_cleanup(vm->vhpet); 389 vatpic_cleanup(vm->vatpic); 390 vioapic_cleanup(vm->vioapic); 391 392 for (i = 0; i < vm->num_mem_segs; i++) 393 vm_free_mem_seg(vm, &vm->mem_segs[i]); 394 395 vm->num_mem_segs = 0; --- 1343 unchanged lines hidden (view full) --- 1739 vm_handle_rendezvous(vm, vcpuid); 1740} 1741 1742struct vatpic * 1743vm_atpic(struct vm *vm) 1744{ 1745 return (vm->vatpic); 1746} |
1747 1748struct vatpit * 1749vm_atpit(struct vm *vm) 1750{ 1751 return (vm->vatpit); 1752} |
|