Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src Pull up following revision(s) (requested by maxv in ticke...



details:   https://anonhg.NetBSD.org/src/rev/3c648db1d23e
branches:  netbsd-9
changeset: 460925:3c648db1d23e
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Nov 10 12:58:29 2019 +0000

description:
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/bsd.hostprog.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/postinstall.in: 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.
 - 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.
Three changes in libnvmm:
 - Add 'mach' and 'vcpu' backpointers in the nvmm_io and nvmm_mem
   structures.
 - Rename 'nvmm_callbacks' to 'nvmm_assist_callbacks'.
 - Rename and migrate NVMM_MACH_CONF_CALLBACKS to NVMM_VCPU_CONF_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
change.
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
qemu-nvmm.
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.
Sort SEE ALSO.
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
returns.
Forgot to put nvmmctl in the "nvmm" group.
Add nvmm group.

diffstat:

 distrib/sets/lists/base/md.amd64     |    3 +-
 distrib/sets/lists/debug/md.amd64    |    3 +-
 distrib/sets/lists/man/mi            |    5 +-
 etc/MAKEDEV.tmpl                     |    5 +-
 etc/group                            |    1 +
 lib/libnvmm/libnvmm.3                |  152 ++++++--
 lib/libnvmm/libnvmm.c                |   81 +++-
 lib/libnvmm/libnvmm_x86.c            |  585 +++++++++++++++++++++++-----------
 lib/libnvmm/nvmm.h                   |   52 +-
 share/mk/bsd.hostprog.mk             |    3 +-
 sys/dev/nvmm/nvmm.c                  |   96 ++++-
 sys/dev/nvmm/nvmm.h                  |   60 +--
 sys/dev/nvmm/nvmm_internal.h         |   15 +-
 sys/dev/nvmm/nvmm_ioctl.h            |   33 +-
 sys/dev/nvmm/x86/nvmm_x86.h          |  173 ++++++---
 sys/dev/nvmm/x86/nvmm_x86_svm.c      |  396 +++++++++++++----------
 sys/dev/nvmm/x86/nvmm_x86_vmx.c      |  476 +++++++++++++++++----------
 tests/lib/libnvmm/h_io_assist.c      |   20 +-
 tests/lib/libnvmm/h_mem_assist.c     |  406 +++++++++++++++---------
 tests/lib/libnvmm/h_mem_assist_asm.S |  119 +++++++-
 usr.sbin/Makefile                    |    4 +-
 usr.sbin/nvmmctl/Makefile            |   20 +
 usr.sbin/nvmmctl/nvmmctl.8           |   63 +++
 usr.sbin/nvmmctl/nvmmctl.c           |  180 ++++++++++
 usr.sbin/postinstall/postinstall.in  |    4 +-
 25 files changed, 2013 insertions(+), 942 deletions(-)

diffs (truncated from 5231 to 300 lines):

diff -r aeea29ad70bb -r 3c648db1d23e distrib/sets/lists/base/md.amd64
--- a/distrib/sets/lists/base/md.amd64  Wed Nov 06 10:19:30 2019 +0000
+++ b/distrib/sets/lists/base/md.amd64  Sun Nov 10 12:58:29 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.277.2.2 2019/09/01 10:36:25 martin Exp $
+# $NetBSD: md.amd64,v 1.277.2.3 2019/11/10 12:58:30 martin Exp $
 ./dev/lms0                                     base-obsolete           obsolete
 ./dev/mms0                                     base-obsolete           obsolete
 ./libexec/ld.elf_so-i386                       base-sys-shlib          compat,pic
@@ -71,3 +71,4 @@
 ./usr/mdec/pxeboot_ia32_com0.bin               base-obsolete           obsolete
 ./usr/sbin/acpidump                            base-sysutil-bin
 ./usr/sbin/amldb                               base-sysutil-bin
+./usr/sbin/nvmmctl                             base-sysutil-bin
diff -r aeea29ad70bb -r 3c648db1d23e distrib/sets/lists/debug/md.amd64
--- a/distrib/sets/lists/debug/md.amd64 Wed Nov 06 10:19:30 2019 +0000
+++ b/distrib/sets/lists/debug/md.amd64 Sun Nov 10 12:58:29 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.105 2019/02/05 13:00:03 maxv Exp $
+# $NetBSD: md.amd64,v 1.105.2.1 2019/11/10 12:58:31 martin Exp $
 ./usr/lib/i386/12.202++_g.a                    comp-c-debuglib         debuglib,compat,12.202xx
 ./usr/lib/i386/libi386_g.a                     comp-c-debuglib         debuglib,compat
 ./usr/lib/i386/libiberty_g.a                   comp-obsolete           obsolete
@@ -18,6 +18,7 @@
 ./usr/libdata/debug/usr/libexec/ld.elf_so-i386.debug   comp-sys-debug          debug,compat
 ./usr/libdata/debug/usr/sbin/acpidump.debug    comp-sysutil-debug      debug
 ./usr/libdata/debug/usr/sbin/amldb.debug       comp-sysutil-debug      debug
+./usr/libdata/debug/usr/sbin/nvmmctl.debug     comp-sysutil-debug      debug
 ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_wait.debug      tests-obsolete  obsolete
 ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_wait3.debug     tests-obsolete  obsolete
 ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_wait4.debug     tests-obsolete  obsolete
diff -r aeea29ad70bb -r 3c648db1d23e distrib/sets/lists/man/mi
--- a/distrib/sets/lists/man/mi Wed Nov 06 10:19:30 2019 +0000
+++ b/distrib/sets/lists/man/mi Sun Nov 10 12:58:29 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1649.2.2 2019/09/27 09:18:37 martin Exp $
+# $NetBSD: mi,v 1.1649.2.3 2019/11/10 12:58:31 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2868,6 +2868,7 @@
 ./usr/share/man/cat8/ntptime.0                 man-ntp-catman          .cat
 ./usr/share/man/cat8/ntptrace.0                        man-ntp-catman          .cat
 ./usr/share/man/cat8/nvmectl.0                 man-sysutil-catman      .cat
+./usr/share/man/cat8/nvmmctl.0                 man-sysutil-catman      .cat
 ./usr/share/man/cat8/ofctl.0                   man-sysutil-catman      .cat
 ./usr/share/man/cat8/ofppc/MAKEDEV.0           man-obsolete            obsolete
 ./usr/share/man/cat8/ofppc/makedev.0           man-obsolete            obsolete
@@ -5813,6 +5814,7 @@
 ./usr/share/man/html8/ntptime.html             man-ntp-htmlman         html
 ./usr/share/man/html8/ntptrace.html            man-ntp-htmlman         html
 ./usr/share/man/html8/nvmectl.html             man-sysutil-htmlman     html
+./usr/share/man/html8/nvmmctl.html             man-sysutil-htmlman     html
 ./usr/share/man/html8/ofctl.html               man-sysutil-htmlman     html
 ./usr/share/man/html8/oqmgr.html               man-postfix-htmlman     postfix,html
 ./usr/share/man/html8/pac.html                 man-sysutil-htmlman     html
@@ -8982,6 +8984,7 @@
 ./usr/share/man/man8/ntptime.8                 man-ntp-man             .man
 ./usr/share/man/man8/ntptrace.8                        man-ntp-man             .man
 ./usr/share/man/man8/nvmectl.8                 man-sysutil-man         .man
+./usr/share/man/man8/nvmmctl.8                 man-sysutil-man         .man
 ./usr/share/man/man8/ofctl.8                   man-sysutil-man         .man
 ./usr/share/man/man8/ofppc/MAKEDEV.8           man-obsolete            obsolete
 ./usr/share/man/man8/ofppc/makedev.8           man-obsolete            obsolete
diff -r aeea29ad70bb -r 3c648db1d23e etc/MAKEDEV.tmpl
--- a/etc/MAKEDEV.tmpl  Wed Nov 06 10:19:30 2019 +0000
+++ b/etc/MAKEDEV.tmpl  Sun Nov 10 12:58:29 2019 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#      $NetBSD: MAKEDEV.tmpl,v 1.205.2.1 2019/09/22 10:22:15 martin Exp $
+#      $NetBSD: MAKEDEV.tmpl,v 1.205.2.2 2019/11/10 12:58:31 martin Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -499,6 +499,7 @@
        g_gpio="%gid__gpio%"
        g_kmem="%gid_kmem%"
        g_ntpd="%gid_ntpd%"
+       g_nvmm="%gid_nvmm%"
        g_operator="%gid_operator%"
        g_wheel="%gid_wheel%"
        dialin=0
@@ -2222,7 +2223,7 @@
        ;;
 
 nvmm)
-       mkdev nvmm c %nvmm_chr% 0
+       mkdev nvmm c %nvmm_chr% 0 640 $g_nvmm
        ;;
 
 autofs)
diff -r aeea29ad70bb -r 3c648db1d23e etc/group
--- a/etc/group Wed Nov 06 10:19:30 2019 +0000
+++ b/etc/group Sun Nov 10 12:58:29 2019 +0000
@@ -29,6 +29,7 @@
 guest:*:31:root
 _unbound:*:32:
 _nsd:*:33:
+nvmm:*:34:root
 nobody:*:39:
 utmp:*:45:
 authpf:*:72:
diff -r aeea29ad70bb -r 3c648db1d23e lib/libnvmm/libnvmm.3
--- a/lib/libnvmm/libnvmm.3     Wed Nov 06 10:19:30 2019 +0000
+++ b/lib/libnvmm/libnvmm.3     Sun Nov 10 12:58:29 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: libnvmm.3,v 1.19 2019/06/08 07:27:44 maxv Exp $
+.\"    $NetBSD: libnvmm.3,v 1.19.4.1 2019/11/10 12:58:30 martin Exp $
 .\"
 .\" Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 30, 2019
+.Dd October 28, 2019
 .Dt LIBNVMM 3
 .Os
 .Sh NAME
@@ -38,6 +38,8 @@
 .Sh SYNOPSIS
 .In nvmm.h
 .Ft int
+.Fn nvmm_init "void"
+.Ft int
 .Fn nvmm_capability "struct nvmm_capability *cap"
 .Ft int
 .Fn nvmm_machine_create "struct nvmm_machine *mach"
@@ -52,6 +54,9 @@
 .Ft int
 .Fn nvmm_vcpu_destroy "struct nvmm_machine *mach" "struct nvmm_vcpu *vcpu"
 .Ft int
+.Fn nvmm_vcpu_configure "struct nvmm_machine *mach" "struct nvmm_vcpu *vcpu" \
+    "uint64_t op" "void *conf"
+.Ft int
 .Fn nvmm_vcpu_getstate "struct nvmm_machine *mach" "struct nvmm_vcpu *vcpu" \
     "uint64_t flags"
 .Ft int
@@ -95,6 +100,12 @@
 A virtual CPU is described by a public structure,
 .Cd nvmm_vcpu .
 .Pp
+.Fn nvmm_init
+initializes NVMM.
+See
+.Sx NVMM Initialization
+below for details.
+.Pp
 .Fn nvmm_capability
 gets the capabilities of NVMM.
 See
@@ -133,6 +144,16 @@
 in the machine
 .Fa mach .
 .Pp
+.Fn nvmm_vcpu_configure
+configures, on the VCPU
+.Fa vcpu
+of machine
+.Fa mach ,
+the parameter indicated in
+.Fa op .
+.Fa conf
+describes the value of the parameter.
+.Pp
 .Fn nvmm_vcpu_getstate
 gets the state of the virtual CPU identified by
 .Fa vcpu
@@ -264,6 +285,23 @@
 See
 .Sx Mem Assist
 below for details.
+.Ss NVMM Initialization
+NVMM initialization is performed by the
+.Fn nvmm_init
+function, which must be invoked by emulator software before any other NVMM
+function.
+.Pp
+.Fn nvmm_init
+opens the NVMM device, and expects to have the proper permissions to do so.
+In a default configuration, this implies being part of the "nvmm" group.
+If using a special configuration, emulator software should arrange to have the
+proper permissions before invoking
+.Fn nvmm_init ,
+and can drop them after the call has completed.
+.Pp
+It is to be noted that
+.Fn nvmm_init
+may perform non-re-entrant operations, and should be called only once.
 .Ss NVMM Capability
 The
 .Cd nvmm_capability
@@ -287,12 +325,29 @@
 field indicates the maximum number of virtual machines supported, while
 .Cd max_vcpus
 indicates the maximum number of VCPUs supported per virtual machine.
+.Ss Machine Ownership
+When a process creates a virtual machine via
+.Fn nvmm_machine_create ,
+it is considered the owner of this machine.
+No other processes than the owner can operate a virtual machine.
+.Pp
+When an owner exits, all the virtual machines associated with it are destroyed,
+if they were not already destroyed by the owner itself via
+.Fn nvmm_machine_destroy .
+.Pp
+Virtual machines are not inherited across
+.Xr fork 2
+operations.
 .Ss Machine Configuration
 Emulator software can configure several parameters of a virtual machine by using
-.Fn nvmm_machine_configure ,
+.Fn nvmm_machine_configure .
+Currently, no parameters are implemented.
+.Ss VCPU Configuration
+Emulator software can configure several parameters of a VCPU by using
+.Fn nvmm_vcpu_configure ,
 which can take the following operations:
 .Bd -literal
-#define NVMM_MACH_CONF_CALLBACKS       0
+#define NVMM_VCPU_CONF_CALLBACKS       0
        ...
 .Ed
 .Pp
@@ -386,8 +441,8 @@
 struct nvmm_vcpu {
        nvmm_cpuid_t cpuid;
        struct nvmm_vcpu_state *state;
-       struct nvmm_event *event;
-       struct nvmm_exit *exit;
+       struct nvmm_vcpu_event *event;
+       struct nvmm_vcpu_exit *exit;
 };
 .Ed
 .Pp
@@ -399,11 +454,11 @@
 .Pp
 A call to
 .Fn nvmm_vcpu_getstate
-will fetch the relevant parts of the VCPU state and put them in
+will fetch the desired parts of the VCPU state and put them in
 .Fa vcpu->state .
 A call to
 .Fn nvmm_vcpu_setstate
-will install in the VCPU the relevant parts of
+will install in the VCPU the desired parts of
 .Fa vcpu->state .
 A call to
 .Fn nvmm_vcpu_inject
@@ -421,27 +476,36 @@
 different threads.
 .Ss Exit Reasons
 The
-.Cd nvmm_exit
+.Cd nvmm_vcpu_exit
 structure is used to handle VM exits:
 .Bd -literal
-/* Exit Reasons */
-#define NVMM_EXIT_NONE         0x0000000000000000ULL
-#define NVMM_EXIT_MEMORY       0x0000000000000001ULL
-#define NVMM_EXIT_IO           0x0000000000000002ULL
-#define NVMM_EXIT_MSR          0x0000000000000003ULL
-#define NVMM_EXIT_INT_READY    0x0000000000000004ULL
-#define NVMM_EXIT_NMI_READY    0x0000000000000005ULL
-#define NVMM_EXIT_HALTED       0x0000000000000006ULL
-#define NVMM_EXIT_SHUTDOWN     0x0000000000000007ULL
-       ...
-#define NVMM_EXIT_INVALID      0xFFFFFFFFFFFFFFFFULL
+/* Generic. */
+#define NVMM_VCPU_EXIT_NONE            0x0000000000000000ULL
+#define NVMM_VCPU_EXIT_INVALID         0xFFFFFFFFFFFFFFFFULL
+/* x86: operations. */
+#define NVMM_VCPU_EXIT_MEMORY          0x0000000000000001ULL
+#define NVMM_VCPU_EXIT_IO              0x0000000000000002ULL
+/* x86: changes in VCPU state. */
+#define NVMM_VCPU_EXIT_SHUTDOWN                0x0000000000001000ULL
+#define NVMM_VCPU_EXIT_INT_READY       0x0000000000001001ULL
+#define NVMM_VCPU_EXIT_NMI_READY       0x0000000000001002ULL
+#define NVMM_VCPU_EXIT_HALTED          0x0000000000001003ULL
+#define NVMM_VCPU_EXIT_TPR_CHANGED     0x0000000000001004ULL
+/* x86: instructions. */
+#define NVMM_VCPU_EXIT_RDMSR           0x0000000000002000ULL
+#define NVMM_VCPU_EXIT_WRMSR           0x0000000000002001ULL
+#define NVMM_VCPU_EXIT_MONITOR         0x0000000000002002ULL
+#define NVMM_VCPU_EXIT_MWAIT           0x0000000000002003ULL
+#define NVMM_VCPU_EXIT_CPUID           0x0000000000002004ULL
 
-struct nvmm_exit {
+struct nvmm_vcpu_exit {
        uint64_t reason;
        union {
                ...
        } u;
-       uint64_t exitstate[8];
+       struct {
+               ...
+       } exitstate;
 };
 .Ed



Home | Main Index | Thread Index | Old Index