CVS commit: src/sys/dev/nvmm

2021-04-12 Thread matthew green
Module Name:src Committed By: mrg Date: Mon Apr 12 09:22:58 UTC 2021 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: be sure to only access vcpu if it was initialised. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/nvmm/nvmm.c Please not

CVS commit: src/sys/dev/nvmm

2021-03-26 Thread Reinoud Zandijk
Module Name:src Committed By: reinoud Date: Fri Mar 26 15:59:53 UTC 2021 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm.h nvmm_internal.h src/sys/dev/nvmm/x86: nvmm_x86.h nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Implement nvmm_vcpu::stop, a race-free exit from nvm

CVS commit: src/sys/dev/nvmm/x86

2020-09-08 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Sep 8 17:00:07 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: nvmm-x86-vmx: improve the handling of CR0 - CR0_ET is hard-wired to 1 in the cpu, so force CR0_ET to 1 in the shadow. - Clarify.

CVS commit: src/sys/dev/nvmm/x86

2020-09-08 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Sep 8 17:02:03 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: nvmm-x86: avoid hogging behavior observed recently When the FPU code got rewritten in NetBSD, the dependency on IPL_HIGH

CVS commit: src/sys/dev/nvmm

2020-09-08 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Sep 8 16:58:38 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_ioctl.h src/sys/dev/nvmm/x86: nvmm_x86.c nvmm_x86_svm.c Log Message: nvmm: cosmetic changes - Style. - Explicitly include ioccom.h. To generate

CVS commit: src/sys/dev/nvmm/x86

2020-09-04 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Fri Sep 4 17:09:03 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c Log Message: nvmm-x86: improve the CPUID emulation - Mask DTES64, DS_CPL, CID, SDBG, xTPR, PN. - B10, B20 and IA64 do not exist, so just remove them.

CVS commit: src/sys/dev/nvmm

2020-09-04 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Fri Sep 4 17:08:01 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: nvmm: more __read_mostly To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/nvmm/nvmm.c Please note that diffs are not publ

CVS commit: src/sys/dev/nvmm/x86

2020-09-04 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Fri Sep 4 17:07:33 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: nvmm-x86-vmx: improve the handling of CR0 - Flush the guest TLB when certain CR0 bits change. - If the guest updates a static bit in C

CVS commit: src/sys/dev/nvmm/x86

2020-09-04 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Fri Sep 4 17:06:23 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: nvmm-x86-svm: check the SVM revision Only revision 1 exists, but check it, for future-proofness. To generate a diff of this commit: cv

CVS commit: src/sys/dev/nvmm

2020-08-29 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Aug 29 07:14:17 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: nvmm: explicitly include atomic.h To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/nvmm/nvmm.c Please note that diffs are

CVS commit: src/sys/dev/nvmm/x86

2020-08-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 26 16:33:03 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: nvmm-x86-svm: improve the handling of MSR_EFER Intercept reads of it as well, just to mask EFER_SVME, which the guest doesn't need to se

CVS commit: src/sys/dev/nvmm/x86

2020-08-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 26 16:32:03 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: nvmm-x86: improve the handling of RFLAGS.RF - When injecting certain exceptions, set RF. For us to have an up-to-date

CVS commit: src/sys/dev/nvmm/x86

2020-08-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 26 16:30:50 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: nvmm-x86-vmx: improve the handling of CR4 - Filter out certain features we don't want the guest to enable. This is for general corre

CVS commit: src/sys/dev/nvmm

2020-08-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 26 16:29:49 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm_ioctl.h Log Message: nvmm: slightly clarify To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/nvmm/nvmm_ioctl.h Please note that diffs are

CVS commit: src/sys/dev/nvmm/x86

2020-08-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 26 16:29:20 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: nvmm-x86-svm: don't forget to intercept INVD INVD executed in the guest can be dangerous for the host, due to CPU caches being flushed w

CVS commit: src/sys/dev/nvmm

2020-08-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 26 16:28:17 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: nvmm: misc improvements - use mach->ncpus to get the number of vcpus, now that we have it - don't forget to decrement mach->ncpus when a machine g

CVS commit: src/sys/dev/nvmm/x86

2020-08-22 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Aug 22 11:01:10 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: nvmm-x86-vmx: fix detection of the BIOS lock If it's locked, ensure it's locked with VMX enabled. If it's not locked, then lock it ourse

CVS commit: src/sys/dev/nvmm/x86

2020-08-22 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Aug 22 11:00:01 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c Log Message: nvmm-x86: hide more CPUID flags, mostly related to perf monitors To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/

CVS commit: src/sys/dev/nvmm/x86

2020-08-22 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Aug 22 10:59:05 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: nvmm-x86-svm: dedup code To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/dev/nvmm/x86/nvmm_x86_svm.c Please note

CVS commit: src/sys/dev/nvmm/x86

2020-08-20 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Aug 20 11:09:56 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c nvmm_x86.h nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: nvmm-x86: improve the CPUID emulation - x86-svm: explicitly handle 0x8007 and 0x80

CVS commit: src/sys/dev/nvmm/x86

2020-08-20 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Aug 20 11:07:43 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c Log Message: nvmm-x86: advertise the SERIALIZE instruction, available on future CPUs To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/s

CVS commit: src/sys/dev/nvmm/x86

2020-08-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Aug 18 17:08:05 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: nvmm-x86-svm: improve the CPUID emulation Limit the hypervisor range, and properly handle each basic leaf until 0xD. To generate a dif

CVS commit: src/sys/dev/nvmm

2020-08-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Aug 18 17:04:38 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: nvmm: use relaxed atomics to read nmachines To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/nvmm/nvmm.c Please note that

CVS commit: src/sys/dev/nvmm

2020-08-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Aug 18 17:03:58 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: nvmm: localify a variable that doesn't need to be global To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/nvmm/nvmm.c Ple

CVS commit: src/sys/dev/nvmm/x86

2020-08-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Aug 18 17:03:10 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: nvmm-x86: also flush the guest TLB when CR4.{PCIDE,SMEP} changes To generate a diff of this commit: cvs rdiff -u -r1.67

CVS commit: src/sys/dev/nvmm/x86

2020-08-11 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Aug 11 15:48:42 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svmfunc.S nvmm_x86_vmxfunc.S Log Message: Micro-optimize: use pushq instead of pushw. To avoid LCP stalls and unaligned stack accesses. To generate a diff

CVS commit: src/sys/dev/nvmm/x86

2020-08-11 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Aug 11 15:31:52 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Improve the CPUID emulation on nvmm-intel: - Limit the highest extended leaf. - Limit 0x0007 to ECX=0, for future-proofness. To

CVS commit: src/sys/dev/nvmm/x86

2020-08-11 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Aug 11 15:27:46 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Improve emulation of MSR_IA32_ARCH_CAPABILITIES: publish only the *_NO bits. Initially they were the only ones there, but Intel then adde

CVS commit: src/sys/dev/nvmm/x86

2020-08-11 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Aug 11 15:23:10 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c Log Message: Hide OSPKE. NFC since the host never uses PKU, but still. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/nvmm/x8

CVS commit: src/sys/dev/nvmm

2020-08-05 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 5 16:36:34 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.h Log Message: Add CTASSERT. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/nvmm/nvmm.h Please note that diffs are not public domain;

CVS commit: src/sys/dev/nvmm/x86

2020-08-05 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 5 15:38:28 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c Log Message: Improve the CPUID emulation: - Hide SGX*, PKU, WAITPKG, and SKINIT, because they are not supported. - Hide HLE and RTM, part of TSX. Becau

CVS commit: src/sys/dev/nvmm/x86

2020-08-05 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 5 15:22:25 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Add new field definitions, and intercept everything, for future-proofness. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.6

CVS commit: src/sys/dev/nvmm/x86

2020-08-05 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 5 15:20:09 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Add new field definitions. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c Please no

CVS commit: src/sys/dev/nvmm/x86

2020-08-05 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 5 15:16:51 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c Log Message: Make it easier to understand what's going on, no functional change. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/de

CVS commit: src/sys/dev/nvmm/x86

2020-08-05 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 5 10:31:37 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Use ULL, to make it clear we are unsigned. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/dev/nvmm/x86/nvmm_x86_

CVS commit: src/sys/dev/nvmm/x86

2020-08-05 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Aug 5 10:20:50 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Simplify, remove unnecessary #ifdef DIAGNOSTIC around KASSERTs. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/d

CVS commit: src/sys/dev/nvmm

2020-08-01 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Aug 1 08:18:37 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm.h nvmm_internal.h Log Message: Put the few x86-specific structures under #ifdef __x86_64__, for clarity. To generate a diff of this commit: cvs rdiff -u -r

CVS commit: src/sys/dev/nvmm/x86

2020-07-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun Jul 19 06:56:10 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Switch to fpu_kern_enter/leave, to prevent clobbering, now that the kernel itself uses the fpu. To generate a diff of th

CVS commit: src/sys/dev/nvmm/x86

2020-07-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun Jul 19 06:36:38 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_svmfunc.S nvmm_x86_vmx.c nvmm_x86_vmxfunc.S Log Message: The TLB flush IPIs do not respect the IPL, so enforcing IPL_HIGH has no

CVS commit: src/sys/dev/nvmm/x86

2020-07-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Jul 18 20:56:53 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Now that the IDT is per-CPU, it must be saved/restored on each CPU independently. To generate a diff of this commit: cvs rdiff -u -r1.6

CVS commit: src/sys/dev/nvmm

2020-07-03 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Fri Jul 3 16:09:55 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_internal.h src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Print the backend name when attaching. To generate a diff of this commi

CVS commit: src/sys/dev/nvmm/x86

2020-06-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Jun 18 16:31:15 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: style To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c Please note that diffs are not

CVS commit: src/sys/dev/nvmm

2020-05-24 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun May 24 08:08:49 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_internal.h src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Gather the conditions to return from the VCPU loops in nvmm_return_needed

CVS commit: src/sys/dev/nvmm

2020-05-21 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu May 21 07:43:23 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: Complete rev1.26: reset nvmm_impl to NULL in nvmm_fini(). To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/nvmm/nvmm.c Pl

CVS commit: src/sys/dev/nvmm/x86

2020-05-21 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu May 21 07:36:16 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Improve the CPUID emulation on nvmm-intel: limit the highest basic and hypervisor leaves. To generate a diff of this commit: cvs rdiff

CVS commit: src/sys/dev/nvmm/x86

2020-05-09 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun May 10 06:24:16 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Respect the convention for the hypervisor information: return the highest hypervisor leaf in 0x4000.EAX. To generate

CVS commit: src/sys/dev/nvmm/x86

2020-05-09 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat May 9 16:18:57 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Improve the CPUID emulation of basic leaves: - Hide DCA and PQM, they cannot be used in guests. - On Intel, e

CVS commit: src/sys/dev/nvmm

2020-05-09 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat May 9 08:39:07 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_internal.h src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: On Intel CPUs, CPUID leaf 0xB, too, provides topology information, so filter it correctl

CVS commit: src/sys/dev/nvmm/x86

2020-04-30 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Apr 30 16:56:24 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: If we were processing a software int/excp, and got a VMEXIT in the middle, we must also reflect the instruction length, otherwise the nex

CVS commit: src/sys/dev/nvmm

2020-04-30 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Apr 30 16:50:18 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: When the identification fails, print the reason. To generate a diff of this commit: cvs

CVS commit: src/sys/dev/nvmm

2020-04-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun Apr 26 19:31:36 UTC 2020 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: In nvmm_open(), make sure an implementation was found. This fixes an initialization bug triggerable in certain conditions. If you build nvmm inside

CVS commit: src/sys/dev/nvmm/x86

2020-03-12 Thread Tobias Nygren
Module Name:src Committed By: tnn Date: Thu Mar 12 13:01:59 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: vmx_vmptrst(): only used when DIAGNOSTIC To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/dev/nvmm/x86/nvmm_x86_vmx

CVS commit: src/sys/dev/nvmm/x86

2020-01-09 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Jan 9 16:27:57 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Registering the host's CR0 is done outside of the VCPU loop, so it must be cleared because it is also cleared inside the loop. Not clear

CVS commit: src/sys/dev/nvmm/x86

2020-01-09 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Jan 9 16:20:12 UTC 2020 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Mmh, as noted in PR/54847, this should be uint64_t, not uint16_t. Harmless because we use only the two lowest bits anyway. I believe thi

CVS commit: src/sys/dev/nvmm/x86

2019-12-10 Thread Andrew Doran
Module Name:src Committed By: ad Date: Tue Dec 10 18:06:50 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: pg->phys_addr > VM_PAGE_TO_PHYS(pg) To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/nvmm/x86/nvm

CVS commit: src/sys/dev/nvmm

2019-04-27 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Apr 27 17:30:38 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: Mmh, fix nvmm_vcpu_create(), the cpuid is given, and must not be chosen from the free map. Looks like I forgot this after all my design rounds. While

CVS commit: src/sys/dev/nvmm/x86

2019-04-27 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Apr 27 09:06:18 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: If guest events were being processed when a #VMEXIT occurred, reschedule the events rather than dismissing them. This can

CVS commit: src/sys/dev/nvmm/x86

2019-04-27 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Apr 27 08:16:19 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c nvmm_x86_vmxfunc.S Log Message: Optimize nvmm-intel, use inlined GCC assembly rather than function calls. To generate a diff of this commit: cvs rdi

CVS commit: src/sys/dev/nvmm/x86

2019-04-24 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Apr 24 18:45:15 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svmfunc.S nvmm_x86_vmxfunc.S Log Message: Match the structure order, for better cache utilization. To generate a diff of this commit: cvs rdiff -u -r1.2 -

CVS commit: src/sys/dev/nvmm

2019-04-24 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Apr 24 18:19:28 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.h src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Provide the hardware error code for NVMM_EXIT_INVALID, useful when debugging. To genera

CVS commit: src/sys/dev/nvmm/x86

2019-04-20 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Apr 20 08:45:30 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Ah, take XSAVE into account in ECX too, not just in EBX. Otherwise if the guest relies only on ECX to initialize/copy the

CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Mon Apr 8 18:30:55 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: Switch to MODULE_CLASS_MISC, from pgoyette@. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/nvmm/nvmm.c Please note tha

CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Mon Apr 8 18:23:47 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: Don't forget to call (*machine_destroy) when killing VMs. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/nvmm/nvmm.c Pl

CVS commit: src/sys/dev/nvmm

2019-04-08 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Mon Apr 8 18:21:42 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_internal.h Log Message: Use the fd_clone approach, to avoid losing references to the registered VMs during fork(). We attach an nvmm_owner struct to the fd,

CVS commit: src/sys/dev/nvmm/x86

2019-04-07 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun Apr 7 14:28:50 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Invert the filtering priority: now the kernel-managed cpuid leaves are overwritable by the virtualizer. This is useful to

CVS commit: src/sys/dev/nvmm

2019-04-07 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun Apr 7 14:05:15 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: Don't allow unloading when there are still VMs registered, and don't allow auto-unloading at all. Not a big problem actually, because since I changed

CVS commit: src/sys/dev/nvmm/x86

2019-04-06 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Apr 6 11:49:53 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c nvmm_x86.h nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Replace the misc[] state by a new compressed nvmm_x64_state_intr structure, which descri

CVS commit: src/sys/dev/nvmm/x86

2019-04-03 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Apr 3 19:10:58 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c nvmm_x86.h nvmm_x86_vmx.c Log Message: VMX: if PAT is not valid, #GP on WRMSR, rather than crashing the guest. To generate a diff of this commit: cvs rd

CVS commit: src/sys/dev/nvmm/x86

2019-04-03 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Apr 3 18:05:55 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Add new VMCS bits. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/nvmm/x86/nvmm_x86_vmx.c Please note that

CVS commit: src/sys/dev/nvmm/x86

2019-04-03 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Apr 3 17:32:58 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c nvmm_x86.h nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Add MSR_TSC. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/n

CVS commit: src/sys/dev/nvmm/x86

2019-03-14 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Mar 14 20:29:53 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Optimize NVMM-Intel: keep the VMCS active on the host CPU, and lazy-switch it on demand only when needed. This allows the CPU to use the

CVS commit: src/sys/dev/nvmm/x86

2019-03-14 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Mar 14 19:26:44 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Move a KASSERT, applies to all branches. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/nvmm/x86/nvmm_x86_vm

CVS commit: src/sys/dev/nvmm/x86

2019-03-14 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Mar 14 19:15:26 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Reduce the mask of the VTPR, only the first four bits matter. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev

CVS commit: src/sys/dev/nvmm

2019-03-14 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Mar 14 19:10:28 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c Log Message: Fail early if we're beyond the guest max ram. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/nvmm/nvmm.c Please note tha

CVS commit: src/sys/dev/nvmm

2019-03-07 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Mar 7 15:22:22 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_internal.h Log Message: Rename the internal NVMM HVA table entries from "segment" to "hmapping", less confusing. Also fix the error handling in nvmm_hva_unma

CVS commit: src/sys/dev/nvmm/x86

2019-03-07 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Mar 7 15:06:37 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Parse EXC_NMI on nvmm-intel, and don't return NVMM_EXIT_INVALID if we received a host NMI, otherwise the guest could get killed if an NMI

CVS commit: src/sys/dev/nvmm/x86

2019-03-02 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun Mar 3 07:01:09 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.c nvmm_x86.h nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Choose which CPUID bits to allow, rather than which bits to disallow. This is clearer, a

CVS commit: src/sys/dev/nvmm/x86

2019-02-23 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Feb 23 08:19:16 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Reorder the functions, and constify setstate. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.

CVS commit: src/sys/dev/nvmm/x86

2019-02-22 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Fri Feb 22 12:24:34 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Fix omission: if we receive a guest trap on CR0, and if the original instruction would have resulted in Long Mode being enabled, we need

CVS commit: src/sys/dev/nvmm/x86

2019-02-21 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Feb 21 13:25:44 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: Reorder the detection in vmx_ident(), to fix panic on old CPUs. We must read MSR_IA32_VMX_EPT_VPID_CAP _after_ ensuring EPT is there, bec

CVS commit: src/sys/dev/nvmm/x86

2019-02-21 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Feb 21 11:58:04 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Clarify the gTLB code a little. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/nvmm/x86/nvmm_

CVS commit: src/sys/dev/nvmm

2019-02-18 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Mon Feb 18 12:17:45 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Ah, finally found you. Fix scheduling bug in NVMM. When processing guest page faults, we

CVS commit: src/sys/dev/nvmm/x86

2019-02-16 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Feb 16 12:58:14 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Ah no, adapt previous, on AMD RAX is in the VMCB. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/nvmm/x86/nv

CVS commit: src/sys/dev/nvmm/x86

2019-02-16 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Feb 16 12:40:31 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Improve the FPU detection: hide XSAVES because we're not allowing it, and don't set CPUID2_OSXSAVE if the guest didn't fir

CVS commit: src/sys/dev/nvmm/x86

2019-02-15 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Fri Feb 15 13:17:05 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_vmx.c Log Message: Initialize the guest TSC to zero at VCPU creation time, and handle guest writes to MSR_TSC at run time. This is imprecise

CVS commit: src/sys/dev/nvmm/x86

2019-02-14 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Feb 14 09:37:32 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_vmx.c Log Message: On AMD, the segments have a simple "present" bit. On Intel however there is an extra "unusable" bit, which has a twisted meaning. We can'

CVS commit: src/sys/dev/nvmm/x86

2019-02-13 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Feb 13 10:55:13 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Drop support for software interrupts. I had initially added that to cover the three event types available on AMD, but Intel has seven of

CVS commit: src/sys/dev/nvmm/x86

2019-02-12 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Feb 13 07:04:13 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Micro optimization: the STAR/LSTAR/CSTAR/SFMASK MSRs are static, so rather than saving them on each VMENTRY, save them only once, at VCPU

CVS commit: src/sys/dev/nvmm/x86

2019-02-12 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Wed Feb 13 06:32:45 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86.h Log Message: Reorder the GPRs to match the CPU encoding, simplifies things on Intel. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys

CVS commit: src/sys/dev/nvmm/x86

2019-02-12 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Feb 12 14:54:59 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Optimize: the hardware does not clear the TLB flush command after a VMENTRY, so clear it ourselves, to avoid uselessly flushing the guest

CVS commit: src/sys/dev/nvmm

2019-02-10 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Mon Feb 11 07:07:37 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm_internal.h Log Message: Increase the max guest ram from 4GB to 128GB. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/nvmm/nvmm_internal.h

CVS commit: src/sys/dev/nvmm/x86

2019-02-04 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Mon Feb 4 12:11:18 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Improvements: - Guest reads/writes to PAT land in gPAT, so no need to emulate them. - When emulating EFER, don't advance the RIP if a

CVS commit: src/sys/dev/nvmm

2019-01-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Jan 26 15:25:51 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.c nvmm_internal.h Log Message: Optimize: keep a per-VCPU buffer for the state, and copy in and out directly on it. The VCPUs are protected by mutexes, so nothing to

CVS commit: src/sys/dev/nvmm

2019-01-26 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sat Jan 26 15:12:20 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.h src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Remove nvmm_exit_memory.npc, useless. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/

CVS commit: src/sys/dev/nvmm

2019-01-24 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Jan 24 13:05:59 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm.h src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Optimize: change the behavior of the HLT vmexit, make it a "change in vcpu state" which occurs after the

CVS commit: src/sys/dev/nvmm/x86

2019-01-13 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Sun Jan 13 10:07:50 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Reset DR7 before loading DR0-3, to prevent a fault if the host process has dbregs enabled. To generate a diff of this commit: cvs rdiff

CVS commit: src/sys/dev/nvmm/x86

2019-01-09 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Thu Jan 10 06:58:37 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c nvmm_x86_svmfunc.S Log Message: Optimize: * Don't save/restore the host CR2, we don't care because we're not in a #PF context (and preemption swi

CVS commit: src/sys/dev/nvmm/x86

2019-01-08 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Jan 8 14:43:18 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Optimize: don't keep a full copy of the guest state, rather take only what is needed. This avoids expensive memcpy's. Also flush the V_T

CVS commit: src/sys/dev/nvmm

2019-01-07 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Tue Jan 8 07:29:46 UTC 2019 Modified Files: src/sys/dev/nvmm: nvmm_ioctl.h Log Message: _IOWR -> _IOW To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/nvmm/nvmm_ioctl.h Please note that diffs are not publi

CVS commit: src/sys/dev/nvmm/x86

2019-01-07 Thread Maxime Villard
Module Name:src Committed By: maxv Date: Mon Jan 7 14:08:02 UTC 2019 Modified Files: src/sys/dev/nvmm/x86: nvmm_x86_svm.c Log Message: Optimize: cache the guest state entirely in the VMCB-cache, flush it on a state-by-state basis when needed. To generate a diff of this

  1   2   >