summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorPatrick Mooney <pmooney@pfmooney.com>2022-10-12 23:30:52 +0000
committerPatrick Mooney <pmooney@oxide.computer>2022-10-18 22:47:49 +0000
commitc8dbcfded5b1de68bc460772d0bcb2069476a77a (patch)
tree2135780f44ce7192e5d6d618e1fef790eed2bb59 /usr/src/cmd
parentf6cf983f623e39ff70cb2b1fb9da2bdfddee54e9 (diff)
downloadillumos-joyent-c8dbcfded5b1de68bc460772d0bcb2069476a77a.tar.gz
15078 bhyve should enable VM_CAP_HALT_EXIT by default
Reviewed by: Luqman Aden <luqman@oxide.computer> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Dan McDonald <danmcd@mnx.io>
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/bhyve/bhyverun.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/usr/src/cmd/bhyve/bhyverun.c b/usr/src/cmd/bhyve/bhyverun.c
index 3ad546ddb8..4d4c9578b9 100644
--- a/usr/src/cmd/bhyve/bhyverun.c
+++ b/usr/src/cmd/bhyve/bhyverun.c
@@ -1122,6 +1122,7 @@ static vmexit_handler_t handler[VM_EXITCODE_MAX] = {
#else
[VM_EXITCODE_RUN_STATE] = vmexit_run_state,
[VM_EXITCODE_PAGING] = vmexit_paging,
+ [VM_EXITCODE_HLT] = vmexit_hlt,
#endif
[VM_EXITCODE_SUSPENDED] = vmexit_suspend,
[VM_EXITCODE_TASK_SWITCH] = vmexit_task_switch,
@@ -1220,6 +1221,7 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu)
{
int err, tmp;
+#ifdef __FreeBSD__
if (get_config_bool_default("x86.vmexit_on_hlt", false)) {
err = vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, &tmp);
if (err < 0) {
@@ -1230,6 +1232,19 @@ fbsdrun_set_capabilities(struct vmctx *ctx, int cpu)
if (cpu == BSP)
handler[VM_EXITCODE_HLT] = vmexit_hlt;
}
+#else
+ /*
+ * We insist that vmexit-on-hlt is available on the host CPU, and enable
+ * it by default. Configuration of that feature is done with both of
+ * those facts in mind.
+ */
+ tmp = (int)get_config_bool_default("x86.vmexit_on_hlt", true);
+ err = vm_set_capability(ctx, cpu, VM_CAP_HALT_EXIT, tmp);
+ if (err < 0) {
+ fprintf(stderr, "VM exit on HLT not supported\n");
+ exit(4);
+ }
+#endif /* __FreeBSD__ */
if (get_config_bool_default("x86.vmexit_on_pause", false)) {
/*