CVS: cvs.openbsd.org: src

2020-06-28 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/06/28 10:52:45

Modified files:
usr.sbin/vmd   : i8253.c mc146818.c ns8250.c vm.c vmd.h 

Log message:
vmd(8): Eliminate libevent state corruption

libevent functions for com, pic and rtc are now only called on event_thread.
vcpu exit handlers send messages on a dev pipe and callbacks on these events do
the event management (event_add, evtimer_add, etc).  Previously, libevent state
was mutated by two threads, event_thread, that runs all the callbacks and the
vcpu thread when running exit handlers.  This could have lead to libevent state
corruption.

Patch from Dave Voutila 

ok claudio@
tested by abieber@ and brynet@



CVS: cvs.openbsd.org: src

2020-06-21 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/06/21 14:36:08

Modified files:
usr.sbin/vmd   : ns8250.c 

Log message:
vmd(8): fix ns8250 lockup due to race condition

Inject a pending interrupt even if the rcv_pending flag is set to avoid the
endless EV_READ loop where a byte lingers read to be read but the vcpu never
gets the interrupt to read it. (e.g. the result of spamming RETURN via the
serial console)

Also, protect com ratelimit handler with mutexes to avoid corruption of the
device state.

These changes help preventing linux vm crashes when the return key is held on
boot.

Discovered by and patch from Dave Voutila 

ok tb@



CVS: cvs.openbsd.org: src

2020-06-16 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/06/16 02:46:03

Modified files:
usr.sbin/vmd   : ns8250.c 

Log message:
vmd(8): backout previous commit to ns8250.c as it reintroduced the bug where the
vm would get stuck if disconnected from console and get unstuck once console is
attached.

Spotted by tb@



CVS: cvs.openbsd.org: src

2020-06-16 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/06/16 00:23:51

Modified files:
usr.sbin/vmd   : ns8250.c 

Log message:
vmd(8): fix ns8250 lockup due to race condition

Inject pending interrupt if com has receive pending. This was previously
accidently checked in with an unrelated change by Mike Larkin and was backed out
as it didn't fix the intended problem.

Also, protect com ratelimit handler with mutexes to avoid corruption of the
device state.  These changes help preventing linux vm crashes when the return
key is held on boot.

Discovered by and patch from Dave Voutila 



CVS: cvs.openbsd.org: src

2020-04-29 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/04/29 21:50:53

Modified files:
usr.sbin/vmd   : vm.c vmm.c 

Log message:
vmd(8): correctly terminate vm processes after sending vm

Instead of a round about way of sending a message to vmm that 'send is
successful' and terminating by vm_remove from vmm, we can send the imsg and
exit in the vm process.  The sigchld handler in vmm will vm_remove it from its
structures.  This is how a normal vm is terminated as well.

Previously, vm_remove was called in vmm_dispatch_vm (ie. the event handler to
receive messages from vm process) when hanlding the IMSG_VMDOP_SEND_VM_RESPONSE
(ie. the vm process has written the vm state to the fd passed on by vmctl
send).  This is not how vm_remove was intented to be used as it does a
free(vm).  The vm struct holds the buffers for imsg and so after handling this
IMSG_VMDOP_SEND_VM_RESPONSE message, vmm_dispatch_vm loops again to do
imsg_get(ibuf, ) to read the next message (and we had just freed this
*ibuf when we freed the vm struct) causing it to segfault.

reported by kn@
ok kn@



Re: CVS: cvs.openbsd.org: src

2020-04-20 Thread Pratik Vyas

* Pratik Vyas  [2020-04-08 01:39:48 -0600]:


CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/04/08 01:39:48

Modified files:
sys/arch/amd64/amd64: vmm.c
sys/arch/amd64/include: specialreg.h vmmvar.h
usr.sbin/vmd   : vm.c

Log message:
vmm(4): add IOCTL handler to sets the access protections of the ept

This exposes VMM_IOC_MPROTECT_EPT which can be used by vmd to lock in physical
pages.  Currently, vmd just terminates the vm in case it gets a protection fault
in the future.

This feature is used by solo5 which uses vmm(4) as a backend hypervisor.

ok mpi@

Patch from Adam Steen 



Also, with inputs and review from Mike Larkin



Re: CVS: cvs.openbsd.org: src

2020-04-20 Thread Pratik Vyas

* Pratik Vyas  [2020-04-08 01:32:56 -0600]:


CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/04/08 01:32:56

Modified files:
sys/arch/amd64/amd64: vmm.c
sys/arch/amd64/include: vmmvar.h

Log message:
vmm(4): handle cr0 writes more correctly for vmx

* Switch to using vcpu->vc_vmx_cr0_fixed[1|0] to check must be 0|1 bits,
rather than the cpu capabilities.

* Add the checks on the new values as per the SDM 2.5 CONTROL REGISTERS.

2.1 Bits 63:32 of CR0 and CR4 are reserved and must be written with zeros.
Writing a nonzero value to any of the upper 32 bits results in a
general-protection exception, #GP(0).

2.2 setting the PG flag when the PE flag is clear causes a general-protection
exception (#GP).

11.5.1 Cache Control Registers and Bits, Table 11-5. Cache Operating Modes

2.3 CD: 0, NW: 1, Invalid setting. Generates a general-protection exception
(#GP) with an error code of 0.

*. Don't alway assume, if the guest is not disabling paging, they are
enabling it, check the guest is actually enabling paging. also only read
cr4 when we actually need it, not right at the start.

ok mpi@

Patch from Adam Steen 



Also, with help and review from Mike Larkin



CVS: cvs.openbsd.org: src

2020-04-20 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/04/20 21:36:57

Modified files:
usr.sbin/vmd   : vm.c 

Log message:
vmd: improve concurrency control in pause

Previous implementation hit a deadlock sometimes as the pthread_cond_broadcast
for the pause mutex could happen before pthread_cond_wait.  This implementation
uses a barrier which is hit when all vpcus are paused.

ok mpi@



CVS: cvs.openbsd.org: src

2020-04-08 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/04/08 01:39:48

Modified files:
sys/arch/amd64/amd64: vmm.c 
sys/arch/amd64/include: specialreg.h vmmvar.h 
usr.sbin/vmd   : vm.c 

Log message:
vmm(4): add IOCTL handler to sets the access protections of the ept

This exposes VMM_IOC_MPROTECT_EPT which can be used by vmd to lock in physical
pages.  Currently, vmd just terminates the vm in case it gets a protection fault
in the future.

This feature is used by solo5 which uses vmm(4) as a backend hypervisor.

ok mpi@

Patch from Adam Steen 



CVS: cvs.openbsd.org: src

2020-04-08 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/04/08 01:32:56

Modified files:
sys/arch/amd64/amd64: vmm.c 
sys/arch/amd64/include: vmmvar.h 

Log message:
vmm(4): handle cr0 writes more correctly for vmx

* Switch to using vcpu->vc_vmx_cr0_fixed[1|0] to check must be 0|1 bits,
rather than the cpu capabilities.

* Add the checks on the new values as per the SDM 2.5 CONTROL REGISTERS.

2.1 Bits 63:32 of CR0 and CR4 are reserved and must be written with zeros.
Writing a nonzero value to any of the upper 32 bits results in a
general-protection exception, #GP(0).

2.2 setting the PG flag when the PE flag is clear causes a general-protection
exception (#GP).

11.5.1 Cache Control Registers and Bits, Table 11-5. Cache Operating Modes

2.3 CD: 0, NW: 1, Invalid setting. Generates a general-protection exception
(#GP) with an error code of 0.

*. Don't alway assume, if the guest is not disabling paging, they are
enabling it, check the guest is actually enabling paging. also only read
cr4 when we actually need it, not right at the start.

ok mpi@

Patch from Adam Steen 



CVS: cvs.openbsd.org: src

2020-02-25 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/02/25 23:32:22

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
vmm(4): check page boundaries for pvclock struct

Check if pvclock struct crosses page boundaries as that could potentially
corrupt host memory.

Discussed with guenther@ and Mike Larkin
Reported by Maxime Villard.

ok mortimer@



CVS: cvs.openbsd.org: src

2020-02-25 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/02/25 23:07:09

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
vmm(4): tighten rdmsr on svm

For MSRs not emulated or passed through explicitly, inject #GP.

With help from brynet@

Reported by Maxime Villard.

ok brynet@



CVS: cvs.openbsd.org: src

2020-02-17 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/02/17 11:16:10

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
vmm: check guest cpl and xsave_mask in xsetbv handler

Reported by Maxime Villard.

ok kettenis@ brynet@



CVS: cvs.openbsd.org: src

2020-01-02 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2020/01/02 22:32:00

Modified files:
usr.sbin/vmctl : main.c 

Log message:
vmctl(8): fix vmctl send exit code

vmctl send always returned exit code 1

Patch by Benjamin Baier
ok kn@



CVS: cvs.openbsd.org: src

2019-12-12 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/12/12 23:43:46

Modified files:
sys/dev/pv : pvclock.c 

Log message:
pvclock(4): attach even if when PVCLOCK_FLAG_TSC_STABLE is unset

Attaches pvclock with lower priority (500) in case of unstable tsc
(PVCLOCK_FLAG_TSC_STABLE) instead of not attaching at all.  In this state, we do
make sure to return a monotonically increasing number.

This mostly helps openbsd guests on openbsd vmm(4) where a pvclock with unstable
tsc is still better than i8254.

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-12-11 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/12/11 20:53:38

Modified files:
usr.sbin/vmctl : vmctl.c 
usr.sbin/vmd   : parse.y vm.conf.5 vmd.c vmd.h 

Log message:
vmd: start vms defined in vm.conf in a staggered fashion

This addresses 'thundering herd' problem when a lot of
vms are configured in vm.conf.  A lot of vms booting in parallel can
overload the host and also mess up tsc calibration in openbsd guests as
it uses PIT which doesn't fire reliably if the host is overloaded.

We default to starting vms with parallelism of ncpuonline and a delay 30 seconds
between batches.  This is configurable in vm.conf.

ok mlarkin@ (also addressed comments from cheloha@)



CVS: cvs.openbsd.org: src

2019-12-10 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/12/10 23:45:17

Modified files:
usr.sbin/vmd   : ns8250.c ns8250.h virtio.c virtio.h vm.c vmm.c 

Log message:
vmd: proper concurrency control when pausing a vm

Removes an XXX which slept for 1s waiting for the vcpu thread to reach HLT and
pause.  We now define a paused and unpaused condition so that a call to
pause_vm() / vmctl pause blocks till the vm really reaches a paused state.

Also, detach events for devices from event loop when pausing and add them back
when unpausing.  This is because some callbacks call pthread_mutex_lock and if
the vm is paused, it would block also causing the libevent thread to block.
This would mean that we would not be able to process any IMSGs received from vmm
(parent process) including a message to unpause.

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-11-25 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/11/25 22:39:11

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
vmm(4): fix pvclock accuracy issues

Shift math error discovered by George Koehler.  Also, fix the error in tsc
multiplier which was correct only if the host timecounter was tsc.

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-07-16 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/07/16 23:51:07

Modified files:
sys/arch/amd64/amd64: vmm.c 
sys/arch/amd64/include: vmmvar.h 
usr.sbin/vmd   : vm.c vmd.h 

Log message:
vmm/vmd:  Fix migration with pvclock

Implement VMM_IOC_READVMPARAMS and VMM_IOC_WRITEVMPARAMS ioctls to read and
write pvclock state.

reads ok mlarkin@



CVS: cvs.openbsd.org: src

2019-05-27 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/05/27 21:20:59

Modified files:
usr.sbin/vmd   : vm.c 

Log message:
vmd: unset CR0_CD and CR0_NW in default flat64 register values

These never got unset on AMD/SVM guests when booted via vmctl start
-b causing them to run very slow

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-05-13 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/05/13 09:40:34

Modified files:
sys/arch/amd64/amd64: vmm.c 
sys/arch/amd64/include: vmmvar.h 
sys/dev/pv : pvbus.c pvclock.c pvreg.h 

Log message:
vmm: add host side pvclock

Emulate kvm pvclock in vmm(4).  Compatible with pvclock(4) in OpenBSD.  Linux
does not attach to this (yet).

Fixes by reyk@ and tested extensively by reyk@, tb@ and phessler@

ok mlarkin@ phessler@ reyk@



CVS: cvs.openbsd.org: src

2019-05-12 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/05/12 14:56:34

Modified files:
sys/arch/amd64/amd64: vmm.c 
sys/arch/amd64/include: vmmvar.h 
usr.sbin/vmd   : vm.c 

Log message:
vmm: add a x86 page table walker

Add a first cut of x86 page table walker to vmd(8) and vmm(4).  This function is
not used right now but is a building block for future features like HPET, OUTSB
and INSB emulation, nested virtualisation support, etc.

With help from Mike Larkin

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-05-10 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/05/10 14:17:41

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
vmm: handle some unhandled exits for SVM

There were some exits for instructions that were unhandled and caused the guest
to terminate if it tried to execute them.  We now inject a #ud for those.  Also
intercept and #ud RDTSCP and INVLPGA instructions.

ok mlarkin@



CVS: cvs.openbsd.org: src

2019-01-17 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/01/17 18:34:50

Modified files:
sys/arch/i386/conf: GENERIC Makefile.i386 files.i386 
sys/arch/i386/i386: conf.c cpu.c ipifuncs.c machdep.c mainbus.c 
pmap.c pmapae.c 
sys/arch/i386/include: conf.h cpu.h intrdefs.h pmap.h pte.h 
   specialreg.h vmmvar.h 
sys/kern   : kern_pledge.c 
Removed files:
sys/arch/i386/i386: vmm.c vmm_support.S 

Log message:
delete vmm(4) in i386

We will still be able to run i386 guests on amd64 vmm.

Reasons to delete i386 vmm:

- Been broken for a while, almost no one complained.
- Had been falling out of sync from amd64 while it worked.
- If your machine has vmx, you most probably can run amd64, so why not run that?

ok deraadt@ mlarkin@



CVS: cvs.openbsd.org: src

2019-01-17 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2019/01/17 18:24:07

Modified files:
distrib/sets/lists/base: md.i386 
usr.sbin/vmctl : Makefile 
usr.sbin/vmd   : Makefile 

Log message:
disable vmd/vmctl for i386

Next commit will delete vmm(4) for i386.

Reasons to delete i386 vmm:

- Been broken for a while, almost no one complained.
- Had been falling out of sync from amd64 while it worked.
- If your machine has vmx, you most probably can run amd64, so why not run that?

ok mlarkin@ deraadt@



CVS: cvs.openbsd.org: src

2018-09-29 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/09/29 16:33:09

Modified files:
usr.sbin/vmd   : vmd.c 

Log message:
vmd: don't remove vm if sending failed

Fix a bug where a vm was removed in vmd.c after vmctl send even if sending
failed.
spotted by solene@
ok mlarkin@



CVS: cvs.openbsd.org: src

2018-09-12 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/09/12 22:23:36

Modified files:
usr.sbin/vmd   : virtio.c 

Log message:
vmd: set irq and vm_id in virtio dev structs on restore

This unbreaks vmctl receive.

ok ccardenas@



CVS: cvs.openbsd.org: src

2018-08-28 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/08/28 22:51:12

Modified files:
sys/arch/i386/i386: vmm.c 
sys/arch/i386/include: vmmvar.h 

Log message:
First pass in bringing i386 in sync with amd64. This does not yet work, but is
being committed now so we can work on the rest in-tree.

ok mlarkin@



CVS: cvs.openbsd.org: src

2018-05-13 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/05/13 16:48:11

Modified files:
usr.sbin/vmd   : control.c vm.conf.5 vmd.c 

Log message:
vmd(8): enable pause / unpause for vm owners

Patch from Mohamed Aslan.  Thanks!
ok kn@



Re: CVS: cvs.openbsd.org: src

2018-04-18 Thread Pratik Vyas

* Pratik Vyas <p...@openbsd.org> [2018-04-18 00:50:35 -0600]:


CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/04/18 00:50:35

Modified files:
sys/arch/amd64/include: specialreg.h
sys/arch/amd64/amd64: vmm.c

Log message:
vmm: Fix interrupt window exiting for AMD / SVM

* define V_IGN_TPR (ignore virtual TPR)
* set V_IGN_TPR while configuring window exiting (was missed in one
location along with setting of the intr vector)

This should fix unresponsive network / console issues with guests on SVM.



was okayed by mlarkin@



CVS: cvs.openbsd.org: src

2018-04-18 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/04/18 00:50:35

Modified files:
sys/arch/amd64/include: specialreg.h 
sys/arch/amd64/amd64: vmm.c 

Log message:
vmm: Fix interrupt window exiting for AMD / SVM

* define V_IGN_TPR (ignore virtual TPR)
* set V_IGN_TPR while configuring window exiting (was missed in one
location along with setting of the intr vector)

This should fix unresponsive network / console issues with guests on SVM.



CVS: cvs.openbsd.org: www

2018-03-24 Thread Pratik Vyas
CVSROOT:/cvs
Module name:www
Changes by: p...@cvs.openbsd.org2018/03/24 12:05:02

Modified files:
.  : 63.html 

Log message:
vmctl send / receive now works for AMD hosts



CVS: cvs.openbsd.org: src

2018-02-27 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/02/27 23:53:25

Modified files:
usr.sbin/vmd   : mc146818.c 

Log message:
vmd: Fix 100% vmd cpu usage on linux receive / unpause

Use rtc_reschedule_per in mc146818_start instead of re arming the
periodic interrupt without checking if it's enabled in REGB.

reported by Dave Voutila
ok phessler@



CVS: cvs.openbsd.org: src

2018-02-17 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/02/17 18:00:25

Modified files:
usr.sbin/vmd   : vmd.c 

Log message:
vmd: fix vmctl pause for non existing vm ids (never returns)

check if vm id is valid before sending to vmm for pausing. The 'lock' is caused
by vmm sending back ENOENT for a non existent vm but vmd drops the message
because it doesn't recogize the vmid vmm is talking about. This is an artifact
of the 'policy' don't trust any imsg from a sibling priv sep process and do
your own checking.

reported by Abel Abraham Camarillo Ojeda
ok mlarkin@ and ccardenas@



CVS: cvs.openbsd.org: src

2018-02-02 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/02/02 01:24:28

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
vmm: add support for send / receive for AMD SVM hosts

ok mlarkin@



CVS: cvs.openbsd.org: src

2018-02-01 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2018/02/01 11:33:27

Modified files:
usr.sbin/vmd   : virtio.c 

Log message:
vmd: fix vioscsi dump and restore

This unbreaks send / receive. Also tested send / receive for vms with cdrom
by booting install62.iso on a vm with a small empty disk, send to file,
receive into a new vm and running an install of bsd* and base.

ok ccardenas@



CVS: cvs.openbsd.org: www

2017-10-02 Thread Pratik Vyas
CVSROOT:/cvs
Module name:www
Changes by: p...@cvs.openbsd.org2017/10/02 22:22:29

Modified files:
.  : 62.html 

Log message:
vmctl(8) send and receive



CVS: cvs.openbsd.org: src

2017-09-17 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/09/17 17:07:56

Modified files:
usr.sbin/vmd   : pci.c pci.h virtio.c virtio.h vm.c 

Log message:
vmd: send/recv pci config space instead of recreating pci devices on receive

ok mlarkin@



CVS: cvs.openbsd.org: src

2017-09-17 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/09/17 16:47:03

Modified files:
usr.sbin/vmd   : vm.c 

Log message:
vmd: re add rtc.per and rtc.sec evtimers on receive

This was missed in receive. mc146818_start is already defined. This fixes rtc
time resync on receive.

ok mlarkin@



CVS: cvs.openbsd.org: src

2017-08-20 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/08/20 18:38:24

Modified files:
sys/arch/i386/i386: vmm.c 
sys/arch/i386/include: vmmvar.h 

Log message:
vmm (i386): Move CPUID masks to vmmvar.h

My previous commit to restrict vm migration broke vmd for i386. This fixes it.

ok mlarkin@



CVS: cvs.openbsd.org: src

2017-08-20 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/08/20 15:15:32

Modified files:
sys/arch/amd64/amd64: vmm.c 
sys/arch/amd64/include: vmmvar.h 
usr.sbin/vmd   : vm.c vmd.c vmd.h 

Log message:
vmd: Allow only upward migration

This restricts receiving vms from hosts with more cpu features.

Tested on
broadwell -> skylake (works)
skylake -> broadwell (don't work)

ok mlarkin@



CVS: cvs.openbsd.org: src

2017-08-15 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/08/15 09:10:35

Modified files:
usr.sbin/vmd   : vmd.c vmm.c 

Log message:
vmd: fix vm id displayed by vmctl when receiving a vm

Also fix two debug messages and an IMSG type.



CVS: cvs.openbsd.org: src

2017-08-09 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/08/09 13:13:06

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
fix a few DPRINTFs in vmm.c so that compilation with VMM_DEBUG works

ok mlarkin@



CVS: cvs.openbsd.org: src

2017-08-09 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/08/09 11:22:18

Modified files:
sys/arch/amd64/amd64: vmm.c 

Log message:
Expose TSC to vmm guest

This exposes TSC to vmm guest and OpenBSD guests should use it as a preferred
timecounter on >= skylake. This should improve the clock drift situation. This
breaks vmctl send and receive (for >= skylake), working on that.

ok mlarkin@



CVS: cvs.openbsd.org: src

2017-07-14 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/07/14 23:05:36

Modified files:
usr.sbin/vmctl : Makefile main.c vmctl.8 vmctl.c vmctl.h 
usr.sbin/vmd   : config.c control.c ns8250.c vm.c vmd.c vmd.h 
 vmm.c 

Log message:
Add vmctl send and vmctl receive

ok reyk@ and mlarkin@



CVS: cvs.openbsd.org: src

2017-07-08 Thread Pratik Vyas
CVSROOT:/cvs
Module name:src
Changes by: p...@cvs.openbsd.org2017/07/08 18:51:40

Modified files:
usr.sbin/vmctl : main.c vmctl.c vmctl.h 
usr.sbin/vmd   : control.c i8253.c i8253.h mc146818.c mc146818.h 
 vm.c vmd.c vmd.h vmm.c 

Log message:
vmd/vmctl: Add ability to pause / unpause vms

With help from Ashwin Agrawal

ok reyk@ mlarkin@