Print this page
13275 bhyve needs richer INIT/SIPI support
Reviewed by: Robert Mustacchi <rm@fingolfin.org>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>

*** 2736,2747 **** load_dr7(vmxctx->host_dr7); write_rflags(read_rflags() | vmxctx->host_tf); } static int ! vmx_run(void *arg, int vcpu, uint64_t rip, pmap_t pmap, ! struct vm_eventinfo *evinfo) { int rc, handled, launched; struct vmx *vmx; struct vm *vm; struct vmxctx *vmxctx; --- 2736,2746 ---- load_dr7(vmxctx->host_dr7); write_rflags(read_rflags() | vmxctx->host_tf); } static int ! vmx_run(void *arg, int vcpu, uint64_t rip, pmap_t pmap) { int rc, handled, launched; struct vmx *vmx; struct vm *vm; struct vmxctx *vmxctx;
*** 2832,2877 **** if (inject_state == EIS_CAN_INJECT) { inject_state = vmx_inject_vlapic(vmx, vcpu, vlapic); } /* ! * Check for vcpu suspension after injecting events because ! * vmx_inject_events() can suspend the vcpu due to a ! * triple fault. */ ! if (vcpu_suspended(evinfo)) { enable_intr(); - vm_exit_suspended(vmx->vm, vcpu, rip); break; } ! if (vcpu_runblocked(evinfo)) { enable_intr(); ! vm_exit_runblock(vmx->vm, vcpu, rip); break; } - if (vcpu_reqidle(evinfo)) { - enable_intr(); - vm_exit_reqidle(vmx->vm, vcpu, rip); - break; - } - - if (vcpu_should_yield(vm, vcpu)) { - enable_intr(); - vm_exit_astpending(vmx->vm, vcpu, rip); - vmx_astpending_trace(vmx, vcpu, rip); - handled = HANDLED; - break; - } - - if (vcpu_debugged(vm, vcpu)) { - enable_intr(); - vm_exit_debug(vmx->vm, vcpu, rip); - break; - } - /* * If subsequent activity queued events which require injection * handling, take another lap to handle them. */ if (vmx_inject_recheck(vmx, vcpu, inject_state)) { --- 2831,2854 ---- if (inject_state == EIS_CAN_INJECT) { inject_state = vmx_inject_vlapic(vmx, vcpu, vlapic); } /* ! * Check for vCPU bail-out conditions. This must be done after ! * vmx_inject_events() to detect a triple-fault condition. */ ! if (vcpu_entry_bailout_checks(vmx->vm, vcpu, rip)) { enable_intr(); break; } ! if (vcpu_run_state_pending(vm, vcpu)) { enable_intr(); ! vm_exit_run_state(vmx->vm, vcpu, rip); break; } /* * If subsequent activity queued events which require injection * handling, take another lap to handle them. */ if (vmx_inject_recheck(vmx, vcpu, inject_state)) {
*** 2983,3005 **** DTRACE_PROBE3(vmm__vexit, int, vcpu, uint64_t, rip, uint32_t, exit_reason); rip = vmexit->rip; } while (handled); ! /* ! * If a VM exit has been handled then the exitcode must be BOGUS ! * If a VM exit is not handled then the exitcode must not be BOGUS ! */ ! if ((handled && vmexit->exitcode != VM_EXITCODE_BOGUS) || ! (!handled && vmexit->exitcode == VM_EXITCODE_BOGUS)) { ! panic("Mismatch between handled (%d) and exitcode (%d)", ! handled, vmexit->exitcode); } - if (!handled) - vmm_stat_incr(vm, vcpu, VMEXIT_USERSPACE, 1); - VCPU_CTR1(vm, vcpu, "returning from vmx_run: exitcode %d", vmexit->exitcode); vmcs_clear(vmcs_pa); vmx_msr_guest_exit(vmx, vcpu); --- 2960,2975 ---- DTRACE_PROBE3(vmm__vexit, int, vcpu, uint64_t, rip, uint32_t, exit_reason); rip = vmexit->rip; } while (handled); ! /* If a VM exit has been handled then the exitcode must be BOGUS */ ! if (handled && vmexit->exitcode != VM_EXITCODE_BOGUS) { ! panic("Non-BOGUS exitcode (%d) unexpected for handled VM exit", ! vmexit->exitcode); } VCPU_CTR1(vm, vcpu, "returning from vmx_run: exitcode %d", vmexit->exitcode); vmcs_clear(vmcs_pa); vmx_msr_guest_exit(vmx, vcpu);
*** 3259,3269 **** } return (0); } static int ! vmx_setdesc(void *arg, int vcpu, int seg, struct seg_desc *desc) { int hostcpu, running; struct vmx *vmx = arg; uint32_t base, limit, access; --- 3229,3239 ---- } return (0); } static int ! vmx_setdesc(void *arg, int vcpu, int seg, const struct seg_desc *desc) { int hostcpu, running; struct vmx *vmx = arg; uint32_t base, limit, access;