bhyverun_machdep.c (f82af74c76030029d4d8af95c29f2036a20796a4) bhyverun_machdep.c (b0936440b8fcee523c0b26fdbbef7c3b2b5098bf)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2011 NetApp, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

32#include <stdlib.h>
33
34#include <vmmapi.h>
35
36#include "acpi.h"
37#include "atkbdc.h"
38#include "bhyverun.h"
39#include "config.h"
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2011 NetApp, Inc.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

32#include <stdlib.h>
33
34#include <vmmapi.h>
35
36#include "acpi.h"
37#include "atkbdc.h"
38#include "bhyverun.h"
39#include "config.h"
40#include "debug.h"
40#include "e820.h"
41#include "fwctl.h"
42#include "ioapic.h"
43#include "inout.h"
44#include "kernemu_dev.h"
45#include "mptbl.h"
46#include "pci_irq.h"
47#include "pci_lpc.h"

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

65void
66bhyve_init_vcpu(struct vcpu *vcpu)
67{
68 int err, tmp;
69
70 if (get_config_bool_default("x86.vmexit_on_hlt", false)) {
71 err = vm_get_capability(vcpu, VM_CAP_HALT_EXIT, &tmp);
72 if (err < 0) {
41#include "e820.h"
42#include "fwctl.h"
43#include "ioapic.h"
44#include "inout.h"
45#include "kernemu_dev.h"
46#include "mptbl.h"
47#include "pci_irq.h"
48#include "pci_lpc.h"

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

66void
67bhyve_init_vcpu(struct vcpu *vcpu)
68{
69 int err, tmp;
70
71 if (get_config_bool_default("x86.vmexit_on_hlt", false)) {
72 err = vm_get_capability(vcpu, VM_CAP_HALT_EXIT, &tmp);
73 if (err < 0) {
73 fprintf(stderr, "VM exit on HLT not supported\n");
74 EPRINTLN("VM exit on HLT not supported");
74 exit(4);
75 }
76 vm_set_capability(vcpu, VM_CAP_HALT_EXIT, 1);
77 }
78
79 if (get_config_bool_default("x86.vmexit_on_pause", false)) {
80 /*
81 * pause exit support required for this mode
82 */
83 err = vm_get_capability(vcpu, VM_CAP_PAUSE_EXIT, &tmp);
84 if (err < 0) {
75 exit(4);
76 }
77 vm_set_capability(vcpu, VM_CAP_HALT_EXIT, 1);
78 }
79
80 if (get_config_bool_default("x86.vmexit_on_pause", false)) {
81 /*
82 * pause exit support required for this mode
83 */
84 err = vm_get_capability(vcpu, VM_CAP_PAUSE_EXIT, &tmp);
85 if (err < 0) {
85 fprintf(stderr,
86 "SMP mux requested, no pause support\n");
86 EPRINTLN("SMP mux requested, no pause support");
87 exit(4);
88 }
89 vm_set_capability(vcpu, VM_CAP_PAUSE_EXIT, 1);
90 }
91
92 if (get_config_bool_default("x86.x2apic", false))
93 err = vm_set_x2apic_state(vcpu, X2APIC_ENABLED);
94 else
95 err = vm_set_x2apic_state(vcpu, X2APIC_DISABLED);
96
97 if (err) {
87 exit(4);
88 }
89 vm_set_capability(vcpu, VM_CAP_PAUSE_EXIT, 1);
90 }
91
92 if (get_config_bool_default("x86.x2apic", false))
93 err = vm_set_x2apic_state(vcpu, X2APIC_ENABLED);
94 else
95 err = vm_set_x2apic_state(vcpu, X2APIC_DISABLED);
96
97 if (err) {
98 fprintf(stderr, "Unable to set x2apic state (%d)\n", err);
98 EPRINTLN("Unable to set x2apic state (%d)", err);
99 exit(4);
100 }
101
102 vm_set_capability(vcpu, VM_CAP_ENABLE_INVPCID, 1);
103
104 err = vm_set_capability(vcpu, VM_CAP_IPI_EXIT, 1);
105 assert(err == 0);
106}

--- 81 unchanged lines hidden ---
99 exit(4);
100 }
101
102 vm_set_capability(vcpu, VM_CAP_ENABLE_INVPCID, 1);
103
104 err = vm_set_capability(vcpu, VM_CAP_IPI_EXIT, 1);
105 assert(err == 0);
106}

--- 81 unchanged lines hidden ---