NetBSD/src HUKikvJlib/libnvmm libnvmm.c libnvmm_x86.c, sys/dev/nvmm nvmm.c nvmm.h

   Miscellaneous changes in NVMM, to address several inconsistencies and
   issues in the libnvmm API.

    - Rename NVMM_CAPABILITY_VERSION to NVMM_KERN_VERSION, and check it in
      libnvmm. Introduce NVMM_USER_VERSION, for future use.

    - In libnvmm, open "/dev/nvmm" as read-only and with O_CLOEXEC. This is to
      avoid sharing the VMs with the children if the process forks. In the
      NVMM driver, force O_CLOEXEC on open().

    - Rename the following things for consistency:
          nvmm_exit*              -> nvmm_vcpu_exit*
          nvmm_event*             -> nvmm_vcpu_event*
          NVMM_EXIT_*             -> NVMM_VCPU_EXIT_*
          NVMM_EVENT_INTERRUPT_HW -> NVMM_VCPU_EVENT_INTR
          NVMM_EVENT_EXCEPTION    -> NVMM_VCPU_EVENT_EXCP
      Delete NVMM_EVENT_INTERRUPT_SW, unused already.

    - Slightly reorganize the MI/MD definitions, for internal clarity.

    - Split NVMM_VCPU_EXIT_MSR in two: NVMM_VCPU_EXIT_{RD,WR}MSR. Also provide
      separate u.rdmsr and u.wrmsr fields. This is more consistent with the
      other exit reasons.

    - Change the types of several variables:
          event.type                  enum -> u_int
          event.vector                uint64_t -> uint8_t
          exit.u.*msr.msr:            uint64_t -> uint32_t
          exit.u.io.type:             enum -> bool
          exit.u.io.seg:              int -> int8_t
          cap.arch.mxcsr_mask:        uint64_t -> uint32_t
          cap.arch.conf_cpuid_maxops: uint64_t -> uint32_t

    - Delete NVMM_VCPU_EXIT_MWAIT_COND, it is AMD-only and confusing, and we
      already intercept 'monitor' so it is never armed.

    - Introduce vmx_exit_insn() for NVMM-Intel, similar to svm_exit_insn().
      The 'npc' field wasn't getting filled properly during certain VMEXITs.

    - Introduce nvmm_vcpu_configure(). Similar to nvmm_machine_configure(),
      but as its name indicates, the configuration is per-VCPU and not per-VM.
      Migrate and rename NVMM_MACH_CONF_X86_CPUID to NVMM_VCPU_CONF_CPUID.
      This becomes per-VCPU, which makes more sense than per-VM.

    - Extend the NVMM_VCPU_CONF_CPUID conf to allow triggering VMEXITs on
      specific leaves. Until now we could only mask the leaves. An uint32_t
      is added in the structure:
        uint32_t mask:1;
        uint32_t exit:1;
        uint32_t rsvd:30;
      The two first bits select the desired behavior on the leaf. Specifying
      zero on both resets the leaf to the default behavior. The new
      NVMM_VCPU_EXIT_CPUID exit reason is added.
VersionDeltaFile
1.51+199-158sys/dev/nvmm/x86/nvmm_x86_svm.c
1.40+197-152sys/dev/nvmm/x86/nvmm_x86_vmx.c
1.16+97-51sys/dev/nvmm/x86/nvmm_x86.h
1.23+56-7sys/dev/nvmm/nvmm.c
1.11+11-41sys/dev/nvmm/nvmm.h
1.15+29-3lib/libnvmm/libnvmm.c
1.8+19-11sys/dev/nvmm/nvmm_ioctl.h
1.36+8-8lib/libnvmm/libnvmm_x86.c
1.13+10-5sys/dev/nvmm/nvmm_internal.h
1.9+7-7tests/lib/libnvmm/h_io_assist.c
1.15+6-6tests/lib/libnvmm/h_mem_assist.c
1.13+8-4lib/libnvmm/nvmm.h
+647-45312 files

UnifiedSplitRaw