Deleted Added
full compact
vmm.c (276098) vmm.c (276428)
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 276098 2014-12-23 02:14:49Z neel $
26 * $FreeBSD: head/sys/amd64/vmm/vmm.c 276428 2014-12-30 22:19:34Z neel $
27 */
28
29#include <sys/cdefs.h>
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 276098 2014-12-23 02:14:49Z neel $");
30__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 276428 2014-12-30 22:19:34Z neel $");
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>

--- 31 unchanged lines hidden (view full) ---

70#include "vmm_mem.h"
71#include "vmm_util.h"
72#include "vatpic.h"
73#include "vatpit.h"
74#include "vhpet.h"
75#include "vioapic.h"
76#include "vlapic.h"
77#include "vpmtmr.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>

--- 31 unchanged lines hidden (view full) ---

70#include "vmm_mem.h"
71#include "vmm_util.h"
72#include "vatpic.h"
73#include "vatpit.h"
74#include "vhpet.h"
75#include "vioapic.h"
76#include "vlapic.h"
77#include "vpmtmr.h"
78#include "vrtc.h"
78#include "vmm_ipi.h"
79#include "vmm_stat.h"
80#include "vmm_lapic.h"
81
82#include "io/ppt.h"
83#include "io/iommu.h"
84
85struct vlapic;

--- 45 unchanged lines hidden (view full) ---

131struct vm {
132 void *cookie; /* (i) cpu-specific data */
133 void *iommu; /* (x) iommu-specific data */
134 struct vhpet *vhpet; /* (i) virtual HPET */
135 struct vioapic *vioapic; /* (i) virtual ioapic */
136 struct vatpic *vatpic; /* (i) virtual atpic */
137 struct vatpit *vatpit; /* (i) virtual atpit */
138 struct vpmtmr *vpmtmr; /* (i) virtual ACPI PM timer */
79#include "vmm_ipi.h"
80#include "vmm_stat.h"
81#include "vmm_lapic.h"
82
83#include "io/ppt.h"
84#include "io/iommu.h"
85
86struct vlapic;

--- 45 unchanged lines hidden (view full) ---

132struct vm {
133 void *cookie; /* (i) cpu-specific data */
134 void *iommu; /* (x) iommu-specific data */
135 struct vhpet *vhpet; /* (i) virtual HPET */
136 struct vioapic *vioapic; /* (i) virtual ioapic */
137 struct vatpic *vatpic; /* (i) virtual atpic */
138 struct vatpit *vatpit; /* (i) virtual atpit */
139 struct vpmtmr *vpmtmr; /* (i) virtual ACPI PM timer */
140 struct vrtc *vrtc; /* (o) virtual RTC */
139 volatile cpuset_t active_cpus; /* (i) active vcpus */
140 int suspend; /* (i) stop VM execution */
141 volatile cpuset_t suspended_cpus; /* (i) suspended vcpus */
142 volatile cpuset_t halted_cpus; /* (x) cpus in a hard halt */
143 cpuset_t rendezvous_req_cpus; /* (x) rendezvous requested */
144 cpuset_t rendezvous_done_cpus; /* (x) rendezvous finished */
145 void *rendezvous_arg; /* (x) rendezvous func/arg */
146 vm_rendezvous_func_t rendezvous_func;

--- 223 unchanged lines hidden (view full) ---

370
371 vm->cookie = VMINIT(vm, vmspace_pmap(vm->vmspace));
372 vm->iommu = NULL;
373 vm->vioapic = vioapic_init(vm);
374 vm->vhpet = vhpet_init(vm);
375 vm->vatpic = vatpic_init(vm);
376 vm->vatpit = vatpit_init(vm);
377 vm->vpmtmr = vpmtmr_init(vm);
141 volatile cpuset_t active_cpus; /* (i) active vcpus */
142 int suspend; /* (i) stop VM execution */
143 volatile cpuset_t suspended_cpus; /* (i) suspended vcpus */
144 volatile cpuset_t halted_cpus; /* (x) cpus in a hard halt */
145 cpuset_t rendezvous_req_cpus; /* (x) rendezvous requested */
146 cpuset_t rendezvous_done_cpus; /* (x) rendezvous finished */
147 void *rendezvous_arg; /* (x) rendezvous func/arg */
148 vm_rendezvous_func_t rendezvous_func;

--- 223 unchanged lines hidden (view full) ---

372
373 vm->cookie = VMINIT(vm, vmspace_pmap(vm->vmspace));
374 vm->iommu = NULL;
375 vm->vioapic = vioapic_init(vm);
376 vm->vhpet = vhpet_init(vm);
377 vm->vatpic = vatpic_init(vm);
378 vm->vatpit = vatpit_init(vm);
379 vm->vpmtmr = vpmtmr_init(vm);
380 if (create)
381 vm->vrtc = vrtc_init(vm);
378
379 CPU_ZERO(&vm->active_cpus);
380
381 vm->suspend = 0;
382 CPU_ZERO(&vm->suspended_cpus);
383
384 for (i = 0; i < VM_MAXCPU; i++)
385 vcpu_init(vm, i, create);

--- 46 unchanged lines hidden (view full) ---

432{
433 int i;
434
435 ppt_unassign_all(vm);
436
437 if (vm->iommu != NULL)
438 iommu_destroy_domain(vm->iommu);
439
382
383 CPU_ZERO(&vm->active_cpus);
384
385 vm->suspend = 0;
386 CPU_ZERO(&vm->suspended_cpus);
387
388 for (i = 0; i < VM_MAXCPU; i++)
389 vcpu_init(vm, i, create);

--- 46 unchanged lines hidden (view full) ---

436{
437 int i;
438
439 ppt_unassign_all(vm);
440
441 if (vm->iommu != NULL)
442 iommu_destroy_domain(vm->iommu);
443
444 if (destroy)
445 vrtc_cleanup(vm->vrtc);
446 else
447 vrtc_reset(vm->vrtc);
440 vpmtmr_cleanup(vm->vpmtmr);
441 vatpit_cleanup(vm->vatpit);
442 vhpet_cleanup(vm->vhpet);
443 vatpic_cleanup(vm->vatpic);
444 vioapic_cleanup(vm->vioapic);
445
446 for (i = 0; i < VM_MAXCPU; i++)
447 vcpu_cleanup(vm, i, destroy);

--- 1769 unchanged lines hidden (view full) ---

2217
2218struct vpmtmr *
2219vm_pmtmr(struct vm *vm)
2220{
2221
2222 return (vm->vpmtmr);
2223}
2224
448 vpmtmr_cleanup(vm->vpmtmr);
449 vatpit_cleanup(vm->vatpit);
450 vhpet_cleanup(vm->vhpet);
451 vatpic_cleanup(vm->vatpic);
452 vioapic_cleanup(vm->vioapic);
453
454 for (i = 0; i < VM_MAXCPU; i++)
455 vcpu_cleanup(vm, i, destroy);

--- 1769 unchanged lines hidden (view full) ---

2225
2226struct vpmtmr *
2227vm_pmtmr(struct vm *vm)
2228{
2229
2230 return (vm->vpmtmr);
2231}
2232
2233struct vrtc *
2234vm_rtc(struct vm *vm)
2235{
2236
2237 return (vm->vrtc);
2238}
2239
2225enum vm_reg_name
2226vm_segment_name(int seg)
2227{
2228 static enum vm_reg_name seg_names[] = {
2229 VM_REG_GUEST_ES,
2230 VM_REG_GUEST_CS,
2231 VM_REG_GUEST_SS,
2232 VM_REG_GUEST_DS,

--- 130 unchanged lines hidden ---
2240enum vm_reg_name
2241vm_segment_name(int seg)
2242{
2243 static enum vm_reg_name seg_names[] = {
2244 VM_REG_GUEST_ES,
2245 VM_REG_GUEST_CS,
2246 VM_REG_GUEST_SS,
2247 VM_REG_GUEST_DS,

--- 130 unchanged lines hidden ---