CVS commit: src/lib/libnvmm
Module Name:src Committed By: msaitoh Date: Fri Dec 10 11:08:46 UTC 2021 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: s/premissions/permissions/ To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm.3 diff -u src/lib/libnvmm/libnvmm.3:1.27 src/lib/libnvmm/libnvmm.3:1.28 --- src/lib/libnvmm/libnvmm.3:1.27 Sat Sep 5 07:22:25 2020 +++ src/lib/libnvmm/libnvmm.3 Fri Dec 10 11:08:45 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnvmm.3,v 1.27 2020/09/05 07:22:25 maxv Exp $ +.\" $NetBSD: libnvmm.3,v 1.28 2021/12/10 11:08:45 msaitoh Exp $ .\" .\" Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net .\" All rights reserved. @@ -26,7 +26,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd February 9, 2020 +.Dd December 10, 2021 .Dt LIBNVMM 3 .Os .Sh NAME @@ -246,7 +246,7 @@ the guest virtual address given in .Fa gva into a guest physical address returned in .Fa gpa . -The associated page premissions are returned in +The associated page permissions are returned in .Fa prot . .Fa gva must be page-aligned. @@ -258,7 +258,7 @@ the guest physical address indicated in .Fa gpa into a host virtual address returned in .Fa hva . -The associated page premissions are returned in +The associated page permissions are returned in .Fa prot . .Fa gpa must be page-aligned.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: msaitoh Date: Fri Dec 10 11:08:46 UTC 2021 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: s/premissions/permissions/ To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: joerg Date: Mon Oct 28 18:12:17 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Annotate a covering switch as such to avoid warnings about missing returns. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: joerg Date: Mon Oct 28 18:12:17 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Annotate a covering switch as such to avoid warnings about missing returns. To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm_x86.c diff -u src/lib/libnvmm/libnvmm_x86.c:1.38 src/lib/libnvmm/libnvmm_x86.c:1.39 --- src/lib/libnvmm/libnvmm_x86.c:1.38 Sun Oct 27 08:30:05 2019 +++ src/lib/libnvmm/libnvmm_x86.c Mon Oct 28 18:12:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: libnvmm_x86.c,v 1.38 2019/10/27 08:30:05 maxv Exp $ */ +/* $NetBSD: libnvmm_x86.c,v 1.39 2019/10/28 18:12:17 joerg Exp $ */ /* * Copyright (c) 2018-2019 The NetBSD Foundation, Inc. @@ -2251,6 +2251,7 @@ get_disp_type(struct x86_instr *instr) default: /* llvm */ return DISP_NONE; } + __unreachable(); } static int
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Mon Oct 28 14:20:28 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: should be fork(2), noticed by wiz To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Mon Oct 28 14:20:28 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: should be fork(2), noticed by wiz To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm.3 diff -u src/lib/libnvmm/libnvmm.3:1.24 src/lib/libnvmm/libnvmm.3:1.25 --- src/lib/libnvmm/libnvmm.3:1.24 Mon Oct 28 13:43:42 2019 +++ src/lib/libnvmm/libnvmm.3 Mon Oct 28 14:20:28 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnvmm.3,v 1.24 2019/10/28 13:43:42 wiz Exp $ +.\" $NetBSD: libnvmm.3,v 1.25 2019/10/28 14:20:28 maxv Exp $ .\" .\" Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -336,7 +336,7 @@ if they were not already destroyed by th .Fn nvmm_machine_destroy . .Pp Virtual machines are not inherited across -.Xr fork 9 +.Xr fork 2 operations. .Ss Machine Configuration Emulator software can configure several parameters of a virtual machine by using
CVS commit: src/lib/libnvmm
Module Name:src Committed By: wiz Date: Mon Oct 28 13:43:42 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: Macro tidyness. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm.3 diff -u src/lib/libnvmm/libnvmm.3:1.23 src/lib/libnvmm/libnvmm.3:1.24 --- src/lib/libnvmm/libnvmm.3:1.23 Mon Oct 28 08:30:49 2019 +++ src/lib/libnvmm/libnvmm.3 Mon Oct 28 13:43:42 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnvmm.3,v 1.23 2019/10/28 08:30:49 maxv Exp $ +.\" $NetBSD: libnvmm.3,v 1.24 2019/10/28 13:43:42 wiz Exp $ .\" .\" Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -344,7 +344,8 @@ Emulator software can configure several 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: +.Fn nvmm_vcpu_configure , +which can take the following operations: .Bd -literal #define NVMM_VCPU_CONF_CALLBACKS 0 ...
CVS commit: src/lib/libnvmm
Module Name:src Committed By: wiz Date: Mon Oct 28 13:43:42 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: Macro tidyness. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Sun Oct 27 08:30:05 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Use the new PTE naming, and define CR3_FRAME_* separately. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Sun Oct 27 08:30:05 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Use the new PTE naming, and define CR3_FRAME_* separately. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm_x86.c diff -u src/lib/libnvmm/libnvmm_x86.c:1.37 src/lib/libnvmm/libnvmm_x86.c:1.38 --- src/lib/libnvmm/libnvmm_x86.c:1.37 Wed Oct 23 12:02:55 2019 +++ src/lib/libnvmm/libnvmm_x86.c Sun Oct 27 08:30:05 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: libnvmm_x86.c,v 1.37 2019/10/23 12:02:55 maxv Exp $ */ +/* $NetBSD: libnvmm_x86.c,v 1.38 2019/10/27 08:30:05 maxv Exp $ */ /* * Copyright (c) 2018-2019 The NetBSD Foundation, Inc. @@ -116,7 +116,7 @@ nvmm_vcpu_dump(struct nvmm_machine *mach #define pte32_l1idx(va) (((va) & PTE32_L1_MASK) >> PTE32_L1_SHIFT) #define pte32_l2idx(va) (((va) & PTE32_L2_MASK) >> PTE32_L2_SHIFT) -#define CR3_FRAME_32BIT PG_FRAME +#define CR3_FRAME_32BIT __BITS(31, 12) typedef uint32_t pte_32bit_t; @@ -138,36 +138,36 @@ x86_gva_to_gpa_32bit(struct nvmm_machine return -1; pdir = (pte_32bit_t *)L2hva; pte = pdir[pte32_l2idx(gva)]; - if ((pte & PG_V) == 0) + if ((pte & PTE_P) == 0) return -1; - if ((pte & PG_u) == 0) + if ((pte & PTE_U) == 0) *prot &= ~NVMM_PROT_USER; - if ((pte & PG_KW) == 0) + if ((pte & PTE_W) == 0) *prot &= ~NVMM_PROT_WRITE; - if ((pte & PG_PS) && !has_pse) + if ((pte & PTE_PS) && !has_pse) return -1; - if (pte & PG_PS) { + if (pte & PTE_PS) { *gpa = (pte & PTE32_L2_FRAME); *gpa = *gpa + (gva & PTE32_L1_MASK); return 0; } /* Parse L1. */ - L1gpa = (pte & PG_FRAME); + L1gpa = (pte & PTE_FRAME); if (nvmm_gpa_to_hva(mach, L1gpa, &L1hva, &pageprot) == -1) return -1; pdir = (pte_32bit_t *)L1hva; pte = pdir[pte32_l1idx(gva)]; - if ((pte & PG_V) == 0) + if ((pte & PTE_P) == 0) return -1; - if ((pte & PG_u) == 0) + if ((pte & PTE_U) == 0) *prot &= ~NVMM_PROT_USER; - if ((pte & PG_KW) == 0) + if ((pte & PTE_W) == 0) *prot &= ~NVMM_PROT_WRITE; - if (pte & PG_PS) + if (pte & PTE_PS) return -1; - *gpa = (pte & PG_FRAME); + *gpa = (pte & PTE_FRAME); return 0; } @@ -211,51 +211,51 @@ x86_gva_to_gpa_32bit_pae(struct nvmm_mac return -1; pdir = (pte_32bit_pae_t *)L3hva; pte = pdir[pte32_pae_l3idx(gva)]; - if ((pte & PG_V) == 0) + if ((pte & PTE_P) == 0) return -1; - if (pte & PG_NX) + if (pte & PTE_NX) *prot &= ~NVMM_PROT_EXEC; - if (pte & PG_PS) + if (pte & PTE_PS) return -1; /* Parse L2. */ - L2gpa = (pte & PG_FRAME); + L2gpa = (pte & PTE_FRAME); if (nvmm_gpa_to_hva(mach, L2gpa, &L2hva, &pageprot) == -1) return -1; pdir = (pte_32bit_pae_t *)L2hva; pte = pdir[pte32_pae_l2idx(gva)]; - if ((pte & PG_V) == 0) + if ((pte & PTE_P) == 0) return -1; - if ((pte & PG_u) == 0) + if ((pte & PTE_U) == 0) *prot &= ~NVMM_PROT_USER; - if ((pte & PG_KW) == 0) + if ((pte & PTE_W) == 0) *prot &= ~NVMM_PROT_WRITE; - if (pte & PG_NX) + if (pte & PTE_NX) *prot &= ~NVMM_PROT_EXEC; - if (pte & PG_PS) { + if (pte & PTE_PS) { *gpa = (pte & PTE32_PAE_L2_FRAME); *gpa = *gpa + (gva & PTE32_PAE_L1_MASK); return 0; } /* Parse L1. */ - L1gpa = (pte & PG_FRAME); + L1gpa = (pte & PTE_FRAME); if (nvmm_gpa_to_hva(mach, L1gpa, &L1hva, &pageprot) == -1) return -1; pdir = (pte_32bit_pae_t *)L1hva; pte = pdir[pte32_pae_l1idx(gva)]; - if ((pte & PG_V) == 0) + if ((pte & PTE_P) == 0) return -1; - if ((pte & PG_u) == 0) + if ((pte & PTE_U) == 0) *prot &= ~NVMM_PROT_USER; - if ((pte & PG_KW) == 0) + if ((pte & PTE_W) == 0) *prot &= ~NVMM_PROT_WRITE; - if (pte & PG_NX) + if (pte & PTE_NX) *prot &= ~NVMM_PROT_EXEC; - if (pte & PG_PS) + if (pte & PTE_PS) return -1; - *gpa = (pte & PG_FRAME); + *gpa = (pte & PTE_FRAME); return 0; } @@ -281,7 +281,7 @@ x86_gva_to_gpa_32bit_pae(struct nvmm_mac #define pte64_l3idx(va) (((va) & PTE64_L3_MASK) >> PTE64_L3_SHIFT) #define pte64_l4idx(va) (((va) & PTE64_L4_MASK) >> PTE64_L4_SHIFT) -#define CR3_FRAME_64BIT PG_FRAME +#define CR3_FRAME_64BIT __BITS(51, 12) typedef uint64_t pte_64bit_t; @@ -314,75 +314,75 @@ x86_gva_to_gpa_64bit(struct nvmm_machine return -1; pdir = (pte_64bit_t *)L4hva; pte = pdir[pte64_l4idx(gva)]; - if ((pte & PG_V) == 0) + if ((pte & PTE_P) == 0) return -1; - if ((pte & PG_u) == 0) + if ((pte & PTE_U) == 0) *prot &= ~NVMM_PROT_USER; - if ((pte & PG_KW) == 0) + if ((pte & PTE_W) == 0) *prot &= ~NVMM_PROT_WRITE; - if (pte & PG_NX) + if (pte & PTE_NX) *prot &= ~NVMM_PROT_EXEC; - if (pte & PG_PS) + if (pte & PTE_PS) return -1; /* Parse L3. */ - L3gpa = (pte & PG_FRAME); + L3gpa = (pte & PTE_FRAME); if (nvmm_gpa_to_hva(mach, L3gpa, &L3hva, &pageprot) == -1) return -1; pdir = (pte_64bit_t *)L3hva; pte = p
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Fri Oct 25 09:09:24 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm.3 diff -u src/lib/libnvmm/libnvmm.3:1.19 src/lib/libnvmm/libnvmm.3:1.20 --- src/lib/libnvmm/libnvmm.3:1.19 Sat Jun 8 07:27:44 2019 +++ src/lib/libnvmm/libnvmm.3 Fri Oct 25 09:09:24 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnvmm.3,v 1.19 2019/06/08 07:27:44 maxv Exp $ +.\" $NetBSD: libnvmm.3,v 1.20 2019/10/25 09:09:24 maxv 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 25, 2019 .Dt LIBNVMM 3 .Os .Sh NAME @@ -52,6 +52,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 @@ -133,6 +136,16 @@ destroys the virtual CPU identified by 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 @@ -287,12 +300,28 @@ For example, the 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 9 +operations. .Ss Machine Configuration Emulator software can configure several parameters of a virtual machine by using -.Fn nvmm_machine_configure , -which can take the following operations: +.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 +415,8 @@ A VCPU is described by a public structur 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 +428,11 @@ they are initialized to special values b .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,22 +450,28 @@ Emulator software should not modify the 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 0xULL -#define NVMM_EXIT_MEMORY 0x0001ULL -#define NVMM_EXIT_IO 0x0002ULL -#define NVMM_EXIT_MSR 0x0003ULL -#define NVMM_EXIT_INT_READY 0x0004ULL -#define NVMM_EXIT_NMI_READY 0x0005ULL -#define NVMM_EXIT_HALTED 0x0006ULL -#define NVMM_EXIT_SHUTDOWN 0x0007ULL - ... -#define NVMM_EXIT_INVALID 0xULL +/* Generic. */ +#define NVMM_VCPU_EXIT_NONE 0xULL +#define NVMM_VCPU_EXIT_INVALID 0xULL +/* x86: operations. */ +#define NVMM_VCPU_EXIT_MEMORY 0x0001ULL +#define NVMM_VCPU_EXIT_IO 0x0002ULL +/* x86: changes in VCPU state. */ +#define NVMM_VCPU_EXIT_SHUTDOWN 0x1000ULL +#define NVMM_VCPU_EXIT_INT_READY 0x1001ULL +#define NVMM_VCPU_EXIT_NMI_READY 0x1002ULL +#define NVMM_VCPU_EXIT_HALTED 0x1003ULL +/* x86
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Fri Oct 25 09:09:24 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Sat Oct 19 19:45:10 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Put back 'default', because llvm apparently doesn't realize that all cases are covered in the switch. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm_x86.c diff -u src/lib/libnvmm/libnvmm_x86.c:1.34 src/lib/libnvmm/libnvmm_x86.c:1.35 --- src/lib/libnvmm/libnvmm_x86.c:1.34 Mon Oct 14 10:43:40 2019 +++ src/lib/libnvmm/libnvmm_x86.c Sat Oct 19 19:45:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: libnvmm_x86.c,v 1.34 2019/10/14 10:43:40 maxv Exp $ */ +/* $NetBSD: libnvmm_x86.c,v 1.35 2019/10/19 19:45:10 maxv Exp $ */ /* * Copyright (c) 2018-2019 The NetBSD Foundation, Inc. @@ -2240,6 +2240,7 @@ get_disp_type(struct x86_instr *instr) } return DISP_4; case 0b11: /* direct */ + default: /* llvm */ return DISP_NONE; } }
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Sat Oct 19 19:45:10 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Put back 'default', because llvm apparently doesn't realize that all cases are covered in the switch. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Mon Oct 14 10:43:40 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Improve nvmm_vcpu_dump(). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm_x86.c diff -u src/lib/libnvmm/libnvmm_x86.c:1.33 src/lib/libnvmm/libnvmm_x86.c:1.34 --- src/lib/libnvmm/libnvmm_x86.c:1.33 Mon Oct 14 10:39:24 2019 +++ src/lib/libnvmm/libnvmm_x86.c Mon Oct 14 10:43:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: libnvmm_x86.c,v 1.33 2019/10/14 10:39:24 maxv Exp $ */ +/* $NetBSD: libnvmm_x86.c,v 1.34 2019/10/14 10:43:40 maxv Exp $ */ /* * Copyright (c) 2018-2019 The NetBSD Foundation, Inc. @@ -70,20 +70,28 @@ nvmm_vcpu_dump(struct nvmm_machine *mach return -1; printf("+ VCPU id=%d\n", (int)vcpu->cpuid); - printf("| -> RIP=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RIP]); - printf("| -> RSP=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RSP]); printf("| -> RAX=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RAX]); - printf("| -> RBX=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RBX]); printf("| -> RCX=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RCX]); + printf("| -> RDX=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RDX]); + printf("| -> RBX=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RBX]); + printf("| -> RSP=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RSP]); + printf("| -> RBP=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RBP]); + printf("| -> RSI=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RSI]); + printf("| -> RDI=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RDI]); + printf("| -> RIP=%"PRIx64"\n", state->gprs[NVMM_X64_GPR_RIP]); printf("| -> RFLAGS=%p\n", (void *)state->gprs[NVMM_X64_GPR_RFLAGS]); for (i = 0; i < NVMM_X64_NSEG; i++) { attr = (uint16_t *)&state->segs[i].attrib; - printf("| -> %s: sel=0x%x base=%"PRIx64", limit=%x, attrib=%x\n", + printf("| -> %s: sel=0x%x base=%"PRIx64", limit=%x, " + "attrib=%x [type=%d,l=%d,def=%d]\n", segnames[i], state->segs[i].selector, state->segs[i].base, state->segs[i].limit, - *attr); + *attr, + state->segs[i].attrib.type, + state->segs[i].attrib.l, + state->segs[i].attrib.def); } printf("| -> MSR_EFER=%"PRIx64"\n", state->msrs[NVMM_X64_MSR_EFER]); printf("| -> CR0=%"PRIx64"\n", state->crs[NVMM_X64_CR_CR0]);
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Mon Oct 14 10:43:40 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Improve nvmm_vcpu_dump(). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Sat May 11 07:44:00 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: Replace "VMM" by "emulator", clearer. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Sat May 11 07:44:00 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: Replace "VMM" by "emulator", clearer. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm.3 diff -u src/lib/libnvmm/libnvmm.3:1.17 src/lib/libnvmm/libnvmm.3:1.18 --- src/lib/libnvmm/libnvmm.3:1.17 Sat May 11 07:40:38 2019 +++ src/lib/libnvmm/libnvmm.3 Sat May 11 07:44:00 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnvmm.3,v 1.17 2019/05/11 07:40:38 maxv Exp $ +.\" $NetBSD: libnvmm.3,v 1.18 2019/05/11 07:44:00 maxv Exp $ .\" .\" Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -86,13 +86,13 @@ "struct nvmm_exit *exit" .Sh DESCRIPTION .Nm -provides a library for VMM software to handle hardware-accelerated virtual +provides a library for emulator software to handle hardware-accelerated virtual machines in .Nx . A virtual machine is described by an opaque structure, .Cd nvmm_machine . -VMM software should not attempt to modify this structure directly, and should -use the API provided by +Emulator software should not attempt to modify this structure directly, and +should use the API provided by .Nm to manage virtual machines. .Pp @@ -268,8 +268,8 @@ below for details. .Ss NVMM Capability The .Cd nvmm_capability -structure helps VMM software identify the capabilities offered by NVMM on the -host: +structure helps emulator software identify the capabilities offered by NVMM on +the host: .Bd -literal struct nvmm_capability { uint64_t version; @@ -289,7 +289,7 @@ field indicates the maximum number of vi .Cd max_vcpus indicates the maximum number of VCPUs supported per virtual machine. .Ss Machine Configuration -VMM software can configure several parameters of a virtual machine by using +Emulator software can configure several parameters of a virtual machine by using .Fn nvmm_machine_configure , which can take the following operations: .Bd -literal @@ -300,10 +300,10 @@ which can take the following operations: The higher fields depend on the architecture. .Ss Guest-Host Mappings Each virtual machine has an associated guest physical memory. -VMM software is allowed to modify this guest physical memory by mapping +Emulator software is allowed to modify this guest physical memory by mapping it into some parts of its virtual address space. .Pp -VMM software should follow the following steps to achieve that: +Emulator software should follow the following steps to achieve that: .Pp .Bl -bullet -offset indent -compact .It @@ -346,7 +346,7 @@ will be reflected in the host's .Fa hva , and vice versa. .Pp -It is illegal for VMM software to use +It is illegal for emulator software to use .Fn munmap on an area that was mapped via .Fn nvmm_hva_map . @@ -415,10 +415,10 @@ contains a partial, implementation-speci to retrieve certain state values. .Pp It is possible that a VM exit was caused by a reason internal to the host -kernel, and that VMM software should not be concerned with. +kernel, and that emulator software should not be concerned with. In this case, the exit reason is set to .Cd NVMM_EXIT_NONE . -This gives a chance for VMM software to halt the VM in its tracks. +This gives a chance for emulator software to halt the VM in its tracks. .Pp Refer to functional examples to see precisely how to handle VM exits. .Ss Event Injection @@ -464,7 +464,7 @@ the event is a non-maskable interrupt (N in-NMI context. .El .Pp -VMM software can manage interrupt and NMI window-exiting via the +Emulator software can manage interrupt and NMI window-exiting via the .Va intr component of the VCPU state. When such window-exiting is enabled, NVMM will cause a VM exit with reason @@ -476,7 +476,7 @@ of interrupts. .Ss Assist Callbacks In order to assist emulation of certain operations, .Nm -requires VMM software to register, via +requires emulator software to register, via .Fn nvmm_machine_configure , a set of callbacks described in the following structure: .Bd -literal @@ -493,15 +493,15 @@ each time or .Fn nvmm_assist_mem are invoked. -VMM software that does not intend to use either of these assists can put +Emulator software that does not intend to use either of these assists can put .Dv NULL in the callbacks. .Ss I/O Assist When a VM exit occurs with reason .Cd NVMM_EXIT_IO , -it is necessary for VMM software to emulate the associated I/O operation. +it is necessary for emulator software to emulate the associated I/O operation. .Nm -provides an easy way for VMM software to perform that. +provides an easy way for emulator software to perform that. .Pp .Fn nvmm_assist_io will call the registered @@ -545,9 +545,10 @@ will indicate the size of the access. .Ss Mem Assist When a VM exit occurs with re
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Sat May 11 07:40:38 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: Sync with reality. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libnvmm/libnvmm.3 diff -u src/lib/libnvmm/libnvmm.3:1.16 src/lib/libnvmm/libnvmm.3:1.17 --- src/lib/libnvmm/libnvmm.3:1.16 Mon Apr 29 19:03:17 2019 +++ src/lib/libnvmm/libnvmm.3 Sat May 11 07:40:38 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: libnvmm.3,v 1.16 2019/04/29 19:03:17 maxv Exp $ +.\" $NetBSD: libnvmm.3,v 1.17 2019/05/11 07:40:38 maxv 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 April 29, 2019 +.Dd May 11, 2019 .Dt LIBNVMM 3 .Os .Sh NAME @@ -78,8 +78,6 @@ .Ft int .Fn nvmm_gpa_to_hva "struct nvmm_machine *mach" "gpaddr_t gpa" \ "uintptr_t *hva" "nvmm_prot_t *prot" -.Ft void -.Fn nvmm_callbacks_register "const struct nvmm_callbacks *cbs" .Ft int .Fn nvmm_assist_io "struct nvmm_machine *mach" "nvmm_cpuid_t cpuid" \ "struct nvmm_exit *exit" @@ -246,11 +244,6 @@ The associated page premissions are retu .Fa gpa must be page-aligned. .Pp -.Fn nvmm_callbacks_register -registers in -.Nm -the callbacks descriptor passed as argument. -.Pp .Fn nvmm_assist_io emulates the I/O operation described in .Fa exit @@ -295,6 +288,16 @@ For example, the 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 Configuration +VMM software can configure several parameters of a virtual machine by using +.Fn nvmm_machine_configure , +which can take the following operations: +.Bd -literal +#define NVMM_MACH_CONF_CALLBACKS 0 + ... +.Ed +.Pp +The higher fields depend on the architecture. .Ss Guest-Host Mappings Each virtual machine has an associated guest physical memory. VMM software is allowed to modify this guest physical memory by mapping @@ -474,7 +477,7 @@ of interrupts. In order to assist emulation of certain operations, .Nm requires VMM software to register, via -.Fn nvmm_callbacks_register , +.Fn nvmm_machine_configure , a set of callbacks described in the following structure: .Bd -literal struct nvmm_callbacks {
CVS commit: src/lib/libnvmm
Module Name:src Committed By: maxv Date: Sat May 11 07:40:38 UTC 2019 Modified Files: src/lib/libnvmm: libnvmm.3 Log Message: Sync with reality. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libnvmm/libnvmm.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/lib/libnvmm
Le 17/11/2018 à 17:22, Paul Goyette a écrit : > Could we please get a nvmm(4) man page sometime soon? Thanks! The main NVMM man page is libnvmm(3), but I'll make a nvmm(4) for convenience.
Re: CVS commit: src/lib/libnvmm
Could we please get a nvmm(4) man page sometime soon? Thanks! On Sat, 17 Nov 2018, Maxime Villard wrote: Module Name:src Committed By: maxv Date: Sat Nov 17 16:11:33 UTC 2018 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Don't forget to set 'prot' when the guest has paging disabled. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. !DSPAM:5bf03dbd294241074356799! +--+--++ | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com | | Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org | +--+--++
Re: CVS commit: src/lib/libnvmm
It looked like it was building a 32bit version of the library too, which might have been the source of the build failure. I'm not sure if that changed since.
Re: CVS commit: src/lib/libnvmm
Le 11/11/2018 à 01:06, Maya Rashish a écrit : Module Name:src Committed By: maya Date: Sun Nov 11 00:06:48 UTC 2018 Modified Files: src/lib/libnvmm: libnvmm_x86.c Log Message: Add missing include for struct nvmm_x64_state (Pointed out by the clang build) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/lib/libnvmm/libnvmm_x86.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. ? libnvmm_x86.c includes "nvmm.h", which includes 40 #ifdef __x86_64__ 41 #include 42 #endif Is there rather a problem with the ifdef? It's the second time someone tells me libnvmm doesn't build, yet on my machine it builds.