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>

@@ -1915,12 +1915,11 @@
 
 /*
  * Start vcpu with specified RIP.
  */
 static int
-svm_vmrun(void *arg, int vcpu, uint64_t rip, pmap_t pmap,
-    struct vm_eventinfo *evinfo)
+svm_vmrun(void *arg, int vcpu, uint64_t rip, pmap_t pmap)
 {
         struct svm_regctx *gctx;
         struct svm_softc *svm_sc;
         struct svm_vcpu *vcpustate;
         struct vmcb_state *state;

@@ -2008,41 +2007,25 @@
                  * safe (and prudent) to perform with interrupts disabled.
                  */
                 inject_state = svm_inject_vlapic(svm_sc, vcpu, vlapic,
                     inject_state);
 
-                if (vcpu_suspended(evinfo)) {
+                /*
+                 * Check for vCPU bail-out conditions.  This must be done after
+                 * svm_inject_events() to detect a triple-fault condition.
+                 */
+                if (vcpu_entry_bailout_checks(vm, vcpu, state->rip)) {
                         enable_gintr();
-                        vm_exit_suspended(vm, vcpu, state->rip);
                         break;
                 }
 
-                if (vcpu_runblocked(evinfo)) {
+                if (vcpu_run_state_pending(vm, vcpu)) {
                         enable_gintr();
-                        vm_exit_runblock(vm, vcpu, state->rip);
+                        vm_exit_run_state(vm, vcpu, state->rip);
                         break;
                 }
 
-                if (vcpu_reqidle(evinfo)) {
-                        enable_gintr();
-                        vm_exit_reqidle(vm, vcpu, state->rip);
-                        break;
-                }
-
-                /* We are asked to give the cpu by scheduler. */
-                if (vcpu_should_yield(vm, vcpu)) {
-                        enable_gintr();
-                        vm_exit_astpending(vm, vcpu, state->rip);
-                        break;
-                }
-
-                if (vcpu_debugged(vm, vcpu)) {
-                        enable_gintr();
-                        vm_exit_debug(vm, vcpu, state->rip);
-                        break;
-                }
-
                 /*
                  * If subsequent activity queued events which require injection
                  * handling, take another lap to handle them.
                  */
                 if (svm_inject_recheck(svm_sc, vcpu, inject_state)) {

@@ -2301,11 +2284,11 @@
 
         return (0);
 }
 
 static int
-svm_setdesc(void *arg, int vcpu, int reg, struct seg_desc *desc)
+svm_setdesc(void *arg, int vcpu, int reg, const struct seg_desc *desc)
 {
         struct vmcb *vmcb;
         struct svm_softc *sc;
         struct vmcb_segment *seg;