Module Name:    src
Committed By:   martin
Date:           Sun Nov 10 12:58:31 UTC 2019

Modified Files:
        src/distrib/sets/lists/base [netbsd-9]: md.amd64
        src/distrib/sets/lists/debug [netbsd-9]: md.amd64
        src/distrib/sets/lists/man [netbsd-9]: mi
        src/etc [netbsd-9]: MAKEDEV.tmpl group
        src/lib/libnvmm [netbsd-9]: libnvmm.3 libnvmm.c libnvmm_x86.c nvmm.h
        src/share/mk [netbsd-9]:
        src/sys/dev/nvmm [netbsd-9]: nvmm.c nvmm.h nvmm_internal.h nvmm_ioctl.h
        src/sys/dev/nvmm/x86 [netbsd-9]: nvmm_x86.h nvmm_x86_svm.c
        src/tests/lib/libnvmm [netbsd-9]: h_io_assist.c h_mem_assist.c
        src/usr.sbin [netbsd-9]: Makefile
        src/usr.sbin/postinstall [netbsd-9]:
Added Files:
        src/usr.sbin/nvmmctl [netbsd-9]: Makefile nvmmctl.8 nvmmctl.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #405):

        usr.sbin/nvmmctl/nvmmctl.8: revision 1.2
        lib/libnvmm/libnvmm.3: revision 1.24
        sys/dev/nvmm/nvmm.h: revision 1.11
        lib/libnvmm/libnvmm.3: revision 1.25
        sys/dev/nvmm/x86/nvmm_x86.h: revision 1.16
        sys/dev/nvmm/nvmm.h: revision 1.12
        sys/dev/nvmm/x86/nvmm_x86.h: revision 1.17
        tests/lib/libnvmm/h_mem_assist.c: revision 1.12
        sys/dev/nvmm/x86/nvmm_x86.h: revision 1.18
        share/mk/ revision 1.82
        lib/libnvmm/libnvmm.c: revision 1.15
        distrib/sets/lists/base/md.amd64: revision 1.281
        tests/lib/libnvmm/h_mem_assist.c: revision 1.13
        lib/libnvmm/libnvmm.c: revision 1.16
        tests/lib/libnvmm/h_mem_assist.c: revision 1.14
        lib/libnvmm/libnvmm_x86.c: revision 1.32
        lib/libnvmm/libnvmm.c: revision 1.17
        tests/lib/libnvmm/h_mem_assist.c: revision 1.15
        lib/libnvmm/libnvmm_x86.c: revision 1.33
        lib/libnvmm/libnvmm.c: revision 1.18
        usr.sbin/nvmmctl/Makefile: revision 1.1
        tests/lib/libnvmm/h_mem_assist_asm.S: revision 1.7
        tests/lib/libnvmm/h_mem_assist.c: revision 1.16
        lib/libnvmm/libnvmm_x86.c: revision 1.34
        usr.sbin/nvmmctl/Makefile: revision 1.2
        tests/lib/libnvmm/h_mem_assist_asm.S: revision 1.8
        tests/lib/libnvmm/h_mem_assist.c: revision 1.17
        sys/dev/nvmm/nvmm_internal.h: revision 1.13
        lib/libnvmm/libnvmm_x86.c: revision 1.35
        lib/libnvmm/libnvmm_x86.c: revision 1.36
        usr.sbin/postinstall/ revision 1.8
        lib/libnvmm/libnvmm_x86.c: revision 1.37
        lib/libnvmm/libnvmm_x86.c: revision 1.38
        lib/libnvmm/libnvmm_x86.c: revision 1.39
        usr.sbin/Makefile: revision 1.282
        lib/libnvmm/nvmm.h: revision 1.13
        lib/libnvmm/nvmm.h: revision 1.14
        lib/libnvmm/nvmm.h: revision 1.15
        sys/dev/nvmm/nvmm.c: revision 1.23
        lib/libnvmm/nvmm.h: revision 1.16
        sys/dev/nvmm/nvmm.c: revision 1.24
        lib/libnvmm/nvmm.h: revision 1.17
        sys/dev/nvmm/nvmm.c: revision 1.25
        tests/lib/libnvmm/h_io_assist.c: revision 1.9
        etc/MAKEDEV.tmpl: revision 1.209
        tests/lib/libnvmm/h_io_assist.c: revision 1.10
        tests/lib/libnvmm/h_io_assist.c: revision 1.11
        etc/group: revision 1.35
        distrib/sets/lists/man/mi: revision 1.1660
        sys/dev/nvmm/x86/nvmm_x86_vmx.c: revision 1.40
        sys/dev/nvmm/x86/nvmm_x86_vmx.c: revision 1.41
        sys/dev/nvmm/x86/nvmm_x86_vmx.c: revision 1.42
        sys/dev/nvmm/x86/nvmm_x86_vmx.c: revision 1.43
        sys/dev/nvmm/x86/nvmm_x86_vmx.c: revision 1.44
        sys/dev/nvmm/x86/nvmm_x86_svm.c: revision 1.51
        sys/dev/nvmm/nvmm_ioctl.h: revision 1.8
        sys/dev/nvmm/x86/nvmm_x86_svm.c: revision 1.52
        sys/dev/nvmm/nvmm_ioctl.h: revision 1.9
        sys/dev/nvmm/x86/nvmm_x86_svm.c: revision 1.53
        usr.sbin/nvmmctl/nvmmctl.c: revision 1.1
        lib/libnvmm/libnvmm.3: revision 1.20
        distrib/sets/lists/debug/md.amd64: revision 1.106
        lib/libnvmm/libnvmm.3: revision 1.21
        lib/libnvmm/libnvmm.3: revision 1.22
        usr.sbin/nvmmctl/nvmmctl.8: revision 1.1
        lib/libnvmm/libnvmm.3: revision 1.23

Fix incorrect parsing: the R/M field uses a special GPR map when the
address size is 16 bits, regardless of the actual operating mode. With
this special map there can be two registers referenced at once, and
also disp16-only.
Implement this special behavior, and add associated tests. While here
simplify a few things.
With this in place, the Windows 95 installer initializes correctly.
Part of PR/54611.
add missing initializer
Implement XCHG, add associated tests, and add comments to explain. With
this in place the Windows 95 installer completes successfuly.
Part of PR/54611.
Improve nvmm_vcpu_dump().
Put back 'default', because llvm apparently doesn't realize that all cases
are covered in the switch.
Miscellaneous changes in NVMM, to address several inconsistencies and
issues in the libnvmm API.
   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_*
   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             enum -> bool              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.
   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.
Three changes in libnvmm:
 - Add 'mach' and 'vcpu' backpointers in the nvmm_io and nvmm_mem
 - Rename 'nvmm_callbacks' to 'nvmm_assist_callbacks'.
   it now becomes per-VCPU.
Update the libnvmm man page:
 - Sync the naming with reality.
 - Replace "relevant" by "desired" and "virtualizer" by "emulator", closer
   to what I meant.
 - Add a "VCPU Configuration" section.
 - Add a "Machine Ownership" section.
Add the "nvmm" group, and make nvmm_init() public. Sent to tech-kern@ a few
days ago.
Use the new PTE naming, and define CR3_FRAME_* separately. No functional
Add a new VCPU conf option, that allows userland to request VMEXITs after a
TPR change. This is supported on all Intel CPUs, and not-too-old AMD CPUs.
The reason for wanting this option is that certain OSes (like Win10 64bit)
manage interrupt priority in hardware via CR8 directly, and for these OSes,
the emulator may want to sync its internal TPR state on each change.
Add two new fields in cap.arch, to report the conf capabilities. Report TPR
only on Intel for now, not AMD, because I don't have a recent AMD CPU on
which to test.
Mask CPUID leaf 0x0A on Intel, because we don't want the guest to try (and
fail) to probe the PMC MSRs. This avoids "Unexpected WRMSR" warnings in
Add PCID support in the guests. This speeds up most 64bit guests, because
since Meltdown, everybody uses PCID (including NetBSD).
Change the way root_owner works: consider the calling process as root_owner
not if it has root privileges, but if the /dev/nvmm device was opened with
write permissions. Introduce the undocumented nvmm_root_init() function to
achieve that.
The goal is to simplify the logic and have more granularity, eg if we want
a monitoring agent to access VMs but don't want to give this agent real
root access on the system.
A few changes:
 - Use smaller types in struct nvmm_capability.
 - Use smaller type for nvmm_io.port.
 - Switch exitstate to a compacted structure.
Add nram in struct nvmm_ctl_mach_info.
Add nvmmctl, with two commands for now.
Macro tidyness.
should be fork(2), noticed by wiz
Add debug entry for newly introduced nvmmctl utility.
Annotate a covering switch as such to avoid warnings about missing
Forgot to put nvmmctl in the "nvmm" group.
Add nvmm group.

To generate a diff of this commit:
cvs rdiff -u -r1.277.2.2 -r1.277.2.3 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.105 -r1.105.2.1 src/distrib/sets/lists/debug/md.amd64
cvs rdiff -u -r1.1649.2.2 -r1.1649.2.3 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.205.2.1 -r1.205.2.2 src/etc/MAKEDEV.tmpl
cvs rdiff -u -r1.34 -r1.34.16.1 src/etc/group
cvs rdiff -u -r1.19 -r1.19.4.1 src/lib/libnvmm/libnvmm.3
cvs rdiff -u -r1.14 -r1.14.4.1 src/lib/libnvmm/libnvmm.c
cvs rdiff -u -r1.31 -r1.31.4.1 src/lib/libnvmm/libnvmm_x86.c
cvs rdiff -u -r1.12 -r1.12.4.1 src/lib/libnvmm/nvmm.h
cvs rdiff -u -r1.81 -r1.81.2.1 src/share/mk/
cvs rdiff -u -r1.22 -r1.22.2.1 src/sys/dev/nvmm/nvmm.c
cvs rdiff -u -r1.10 -r1.10.4.1 src/sys/dev/nvmm/nvmm.h
cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/dev/nvmm/nvmm_internal.h
cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/dev/nvmm/nvmm_ioctl.h
cvs rdiff -u -r1.15 -r1.15.4.1 src/sys/dev/nvmm/x86/nvmm_x86.h
cvs rdiff -u -r1.46.4.1 -r1.46.4.2 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.36.2.2 -r1.36.2.3 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c
cvs rdiff -u -r1.8 -r1.8.4.1 src/tests/lib/libnvmm/h_io_assist.c
cvs rdiff -u -r1.11 -r1.11.4.1 src/tests/lib/libnvmm/h_mem_assist.c
cvs rdiff -u -r1.6 -r1.6.4.1 src/tests/lib/libnvmm/h_mem_assist_asm.S
cvs rdiff -u -r1.280 -r1.280.2.1 src/usr.sbin/Makefile
cvs rdiff -u -r0 -r1.2.2.2 src/usr.sbin/nvmmctl/Makefile \
cvs rdiff -u -r0 -r1.1.2.2 src/usr.sbin/nvmmctl/nvmmctl.c
cvs rdiff -u -r1.5.2.1 -r1.5.2.2 src/usr.sbin/postinstall/

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to