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>

@@ -215,13 +215,13 @@
         VM_EXITCODE_HLT,
         VM_EXITCODE_MTRAP,
         VM_EXITCODE_PAUSE,
         VM_EXITCODE_PAGING,
         VM_EXITCODE_INST_EMUL,
-        VM_EXITCODE_SPINUP_AP,
+        VM_EXITCODE_RUN_STATE,
         VM_EXITCODE_MMIO_EMUL,
-        VM_EXITCODE_RUNBLOCK,
+        VM_EXITCODE_DEPRECATED, /* formerly RUNBLOCK */
         VM_EXITCODE_IOAPIC_EOI,
         VM_EXITCODE_SUSPENDED,
         VM_EXITCODE_MMIO,
         VM_EXITCODE_TASK_SWITCH,
         VM_EXITCODE_MONITOR,

@@ -285,10 +285,22 @@
         int             errcode_valid;  /* push 'errcode' on the new stack */
         enum task_switch_reason reason;
         struct vm_guest_paging paging;
 };
 
+enum vcpu_run_state {
+        VRS_HALT                = 0,
+        VRS_INIT                = (1 << 0),
+        VRS_RUN                 = (1 << 1),
+
+        VRS_PEND_INIT           = (1 << 14),
+        VRS_PEND_SIPI           = (1 << 15),
+};
+#define VRS_MASK_VALID(v)       \
+        ((v) & (VRS_INIT | VRS_RUN | VRS_PEND_SIPI | VRS_PEND_SIPI))
+#define VRS_IS_VALID(v)         ((v) == VRS_MASK_VALID(v))
+
 struct vm_exit {
         enum vm_exitcode        exitcode;
         int                     inst_length;    /* 0 means unknown */
         uint64_t                rip;
         union {

@@ -346,14 +358,10 @@
                 struct {
                         uint32_t        code;           /* ecx value */
                         uint64_t        wval;
                 } msr;
                 struct {
-                        int             vcpu;
-                        uint64_t        rip;
-                } spinup_ap;
-                struct {
                         uint64_t        rflags;
                 } hlt;
                 struct {
                         int             vector;
                 } ioapic_eoi;

@@ -365,12 +373,12 @@
 };
 
 enum vm_entry_cmds {
         VEC_DEFAULT = 0,
         VEC_DISCARD_INSTR,      /* discard inst emul state */
-        VEC_COMPLETE_MMIO,      /* entry includes result for mmio emul */
-        VEC_COMPLETE_INOUT,     /* entry includes result for inout emul */
+        VEC_FULFILL_MMIO,       /* entry includes result for mmio emul */
+        VEC_FULFILL_INOUT,      /* entry includes result for inout emul */
 };
 
 struct vm_entry {
         int cpuid;
         uint_t cmd;             /* see: vm_entry_cmds */