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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/i86pc/sys/vmm_dev.h
          +++ new/usr/src/uts/i86pc/sys/vmm_dev.h
↓ open down ↓ 251 lines elided ↑ open up ↑
 252  252  
 253  253  struct vm_readwrite_kernemu_device {
 254  254          int             vcpuid;
 255  255          unsigned        access_width : 3;
 256  256          unsigned        _unused : 29;
 257  257          uint64_t        gpa;
 258  258          uint64_t        value;
 259  259  };
 260  260  _Static_assert(sizeof(struct vm_readwrite_kernemu_device) == 24, "ABI");
 261  261  
      262 +enum vcpu_reset_kind {
      263 +        VRK_RESET = 0,
      264 +        /*
      265 +         * The reset performed by an INIT IPI clears much of the CPU state, but
      266 +         * some portions are left untouched, unlike VRK_RESET, which represents
      267 +         * a "full" reset as if the system was freshly powered on.
      268 +         */
      269 +        VRK_INIT = 1,
      270 +};
      271 +
      272 +struct vm_vcpu_reset {
      273 +        int             vcpuid;
      274 +        uint32_t        kind;   /* contains: enum vcpu_reset_kind */
      275 +};
      276 +
      277 +struct vm_run_state {
      278 +        int             vcpuid;
      279 +        uint32_t        state;  /* of enum cpu_init_status type */
      280 +        uint8_t         sipi_vector;    /* vector of SIPI, if any */
      281 +        uint8_t         _pad[3];
      282 +};
      283 +
 262  284  #define VMMCTL_IOC_BASE         (('V' << 16) | ('M' << 8))
 263  285  #define VMM_IOC_BASE            (('v' << 16) | ('m' << 8))
 264  286  #define VMM_LOCK_IOC_BASE       (('v' << 16) | ('l' << 8))
 265  287  #define VMM_CPU_IOC_BASE        (('v' << 16) | ('p' << 8))
 266  288  
 267  289  /* Operations performed on the vmmctl device */
 268  290  #define VMM_CREATE_VM           (VMMCTL_IOC_BASE | 0x01)
 269  291  #define VMM_DESTROY_VM          (VMMCTL_IOC_BASE | 0x02)
 270  292  #define VMM_VM_SUPPORTED        (VMMCTL_IOC_BASE | 0x03)
 271  293  
↓ open down ↓ 12 lines elided ↑ open up ↑
 284  306  #define VM_PPTDEV_MSIX                  (VMM_CPU_IOC_BASE | 0x0c)
 285  307  #define VM_SET_X2APIC_STATE             (VMM_CPU_IOC_BASE | 0x0d)
 286  308  #define VM_GLA2GPA                      (VMM_CPU_IOC_BASE | 0x0e)
 287  309  #define VM_GLA2GPA_NOFAULT              (VMM_CPU_IOC_BASE | 0x0f)
 288  310  #define VM_ACTIVATE_CPU                 (VMM_CPU_IOC_BASE | 0x10)
 289  311  #define VM_SET_INTINFO                  (VMM_CPU_IOC_BASE | 0x11)
 290  312  #define VM_GET_INTINFO                  (VMM_CPU_IOC_BASE | 0x12)
 291  313  #define VM_RESTART_INSTRUCTION          (VMM_CPU_IOC_BASE | 0x13)
 292  314  #define VM_SET_KERNEMU_DEV              (VMM_CPU_IOC_BASE | 0x14)
 293  315  #define VM_GET_KERNEMU_DEV              (VMM_CPU_IOC_BASE | 0x15)
      316 +#define VM_RESET_CPU                    (VMM_CPU_IOC_BASE | 0x16)
      317 +#define VM_GET_RUN_STATE                (VMM_CPU_IOC_BASE | 0x17)
      318 +#define VM_SET_RUN_STATE                (VMM_CPU_IOC_BASE | 0x18)
 294  319  
 295  320  /* Operations requiring write-locking the VM */
 296  321  #define VM_REINIT               (VMM_LOCK_IOC_BASE | 0x01)
 297  322  #define VM_BIND_PPTDEV          (VMM_LOCK_IOC_BASE | 0x02)
 298  323  #define VM_UNBIND_PPTDEV        (VMM_LOCK_IOC_BASE | 0x03)
 299  324  #define VM_MAP_PPTDEV_MMIO      (VMM_LOCK_IOC_BASE | 0x04)
 300  325  #define VM_ALLOC_MEMSEG         (VMM_LOCK_IOC_BASE | 0x05)
 301  326  #define VM_MMAP_MEMSEG          (VMM_LOCK_IOC_BASE | 0x06)
 302  327  #define VM_PMTMR_LOCATE         (VMM_LOCK_IOC_BASE | 0x07)
 303  328  
↓ open down ↓ 48 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX