summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd
AgeCommit message (Collapse)Author
2016-08-17small bits of header cleanup; ok mlarkinTheo de Raadt
2016-08-01Do not pass VM name directly to setproctitle format string.Stefan Kempf
Use a secure idiom instead. ok mlarkin@
2016-07-29Allow starting a VM again after it was terminatedStefan Kempf
If a VM exits, terminate it and remove it from the list of available VMs. That allows a VM with name `foo' to be restarted after it has exited. This changes structures shared between vmd and vmctl. You need to rebuild vmctl also. ok mlarkin@
2016-07-19Replace malloc() + memset() with calloc().Martin Natano
ok mlarkin
2016-07-09Prepare vionet to be handled asynchronously to the VCPU threadStefan Kempf
This splits the handling of received data into a separate function that can later be called in parallel to the VCPU thread instead of handling received packets on VCPU exits only. It also makes virtq accesses in the rx path safe to run in parallel to the VCPU thread: the last index into the 'avail' ring the driver has notified to the host is kept track of. It also makes sure that the host only writes back to the 'avail' ring instead of modifying the whole receive virtq. While there, describe what virtio_vq_info and virtio_io_cfg are used for, as suggested by mlarkin@ ok mlarkin@
2016-07-08Return 0 on read from PIT control port. Intel explicitly says this is notMike Larkin
supported, and it looks like other emulators/hypervisors do a variety of different things here. Most return 0, but at least one might return random garbage. Returning 0 seems safest here, but leave a warning in place for the logs in case a guest VM does this.
2016-07-07sanity check vm create and run args earlierMike Larkin
2016-07-06clarify a comment about memory regionsMike Larkin
2016-07-04limit each viornd request to 64KB.Mike Larkin
2016-06-30remove some unused variables (that were commented out anyway)Mike Larkin
2016-06-21do not allow whitespace in macro names, i.e. "this is" = "a variable".Sebastian Benoit
change this in all config parsers in our tree that support macros. problem reported by sven falempin. feedback from henning@, stsp@, deraadt@ ok florian@ mikeb@
2016-06-10grammar fix; from nick permyakovJason McIntyre
2016-06-10Access guest memory with normal loads and stores in vmd(8)Stefan Kempf
read_mem() and write_mem() in vmd(8) now use memcpy() instead of the vm_readpage() and vm_writepage() ioctls to read/write guest memory. ok mlarkin@
2016-06-07Allocate RAM for guest VM in vmd(8) and pass it to vmm(4)Stefan Kempf
vmm(4) then maps the pages allocated by the vmd(8) user process into the address space of the guest. This gives vmm(4) and vmd(8) a shared view of the guest RAM. This will allow us to have faster guest<->host data exchange by ordinary memory loads/stores later, as well as remove the vm_readpage and vm_writepage ioctls next. ok mlarkin@
2016-05-26Copy ELF headers into guest VM memoryStefan Kempf
This gives ddb access to the symbols of the kernel running inside the VM. ok mlarkin@
2016-05-05Fix a pasto; from Michal Mazurek <akfaew at jasminek dot net>.Ingo Schwarze
OK mlarkin
2016-04-07Place a BOOTARG_END section at the end of the boot arguments list pushedMike Larkin
to the VM during boot. i386 guest kernels need this marker to boot, and with this diff, it is possible to install and run an OpenBSD i386 guest VM using vmm(4). Note that i386 guests require a host CPU that supports unrestricted guest mode (eg, post-Nehalem) for the time being, hopefully this can be addressed later.
2016-04-07Remove headers associated with code that's been moved to other .c filesPhilip Guenther
ok mlarkin@
2016-04-05Support processors without unrestricted guest capability.Mike Larkin
ok stefan
2016-04-04Directly use physical addresses from ELF header for kernel loading.Stefan Kempf
This allows us to remove the 'do_mask' parameters in read_mem and write_mem as well as the address mask operaton itself. ok mlarkin@
2016-03-13Introduce memory ranges to support VMs with >= 4G RAMStefan Kempf
Kernel bits: - When creating a VM, a list of memory ranges has to be specified, similar to the BIOS memory map. This is necessary for VMs with RAM sizes approaching 4G because we'll need PCI MMIO space in the higher parts of the 32 bit address space. vmctl and vmd bits: - Construct appropriate memory ranges to create a VM with a given RAM size - Construct a corresponding BIOS memory map from the memory ranges and update the boot params page accordingly. - Make sure that all variables that represent guest physical addresses match the address width of the target CPU instead of using uint32_t. - Fix some integer promotion glitches that actually restricted VM RAM size to 2G. This changes the VM create ioctl interface, so update your kernel, vmd, and vmctl. ok mlarkin@
2016-03-13Rework an erroneous warning message about 16 bit i8253 PIT counter I/O.Mike Larkin
The unimplemented mode is MSB/LSB (8 bit), not 16 bit mode.
2016-03-04Set root device to sd0a, instead of wd0a. Virtio devices show upStefan Kempf
as sd. Original diff from Patrick Wildt. In addition, using the MAKEBOOTDEV macro no longer makes bsd ask for the root disk on VM boot. ok mlarkin@
2016-02-16Pass down the initial value of CR0 down to the RESETCPU ioctl() as well.Stefan Kempf
This gives us the opportunity later to start VCPUs in real-mode, etc. (for those CPUs that support unrestricted guest). You need to build an updated kernel for this first, the ioctl interface has changed. ok mlarkin@, deraadt@
2016-02-07avoid a double free in an error pathJonathan Gray
ok stefan@
2016-02-05Fix a possible use-after-free in vmd, forward the result to theReyk Floeter
control socket before free'ing the vm. Found by and OK jsg@
2016-02-02Remove setproctitle() for the parent process. Because rc.d(8) uses processStuart Henderson
titles (including flags) to distinguish between daemons, this makes it possible to manage multiple copies of a daemon using the normal infrastructure by symlinking rc.d scripts to a new name. ok jung@ ajacoutot@, smtpd ok gilles@
2016-01-16vmd(8) sometimes attempts page-crossing data copies between the hostStefan Kempf
and guest. The readpage/writepage ioctls of vmm(4) do not support this and they return EINVAL on such attempts since recently. Avoid page-crossing guest memory accesses by changing read_page() and write_page() into read_mem() and write_mem() that can copy arbitrary lengths of data between host<->guest without page-crossing accesses. This also allows us to remove page-wise copy-loops in a few places. ok mlarkin@
2016-01-14stdio.h is not needed here anymore.Mike Larkin
2016-01-13Update the comment that is decribing terminate_vm()'s arguments,Reyk Floeter
sort the description of arguments for init_emulated_hw(). Pointed out my mlarkin
2016-01-10remove a duplicate break statementJonathan Gray
2016-01-08Keep the pledge of the vmm and vm processes disabled for now as longReyk Floeter
as there is some more expected progress in the kernel interface. It can be tested, and should work, with the previous kernel commit of the "vmm" pledge, but is not called.
2016-01-08Must set MAX_PORTS to 65536, since we assign toStefan Kempf
ioports_map[VMM_PCI_IO_BAR_END (= 65535)]. Fixes an off-by-one. ok mlarkin@, reyk@
2016-01-05Make some things static that are only used in loadfile_elf.cMike Larkin
diff from Michal Mazurek, thanks!
2016-01-05Fail fast if elf64_exec fails. No need to populate the bootargs/stackMike Larkin
and gdt pages if we couldn't load the kernel. diff from Michal Mazurek, thanks!
2016-01-05more bzero -> memset conversionsMike Larkin
from Michal Mazurek, thanks!
2016-01-04Use an bitmap of handler function pointers to track I/O device to handlerMike Larkin
function mappings. First step in reworking device support in vmd to better handle interrupts.
2016-01-04bzero -> memset for consistencyMike Larkin
2016-01-03Add a cleanup block, fix a couple of memory leaks, fix a typo and a bitMike Larkin
of KNF. Submitted by Michal Mazurek, thanks!
2016-01-02fix typo in comment, found by Michal Mazurek, thanksSebastian Benoit
2015-12-17Move vcpu register state init to vmd. Allows vmd bootloader to make theMike Larkin
decision as to how the vcpu should be set up for initial start and reset. Also removes some hardcoded register constants from vmm(4). ok jsing@, mpi@
2015-12-15if a vcpu run thread in vmd exits unexpectedly, teardown the VM's kernelMike Larkin
components as well. ok deraadt@
2015-12-11The vmctl "id" argument can now be a number of or a vm name, eg.Reyk Floeter
vmctl stop 3 vmctl stop "openbsd.vm"
2015-12-08when checking the config file with -n don't open /dev/vmm or require rootJonathan Gray
ok reyk@
2015-12-08make the -f option work as intendedJonathan Gray
ok reyk@
2015-12-07Add imsg "peerid" to debug messages (only within -DDEBUG).Reyk Floeter
2015-12-07Forcibly remove the local vm reference on error.Reyk Floeter
2015-12-07Only increment the vm counter after successfully adding a new vm; theReyk Floeter
counter has to be in sync in the parent and vmm processes. This fixes reload after a previous load error.
2015-12-07Fix error handling in a few cases: some function return (-1) on error,Reyk Floeter
while others return (errno) on error. We probably have to agree on something.
2015-12-07Most common strings in vm.conf are pathnames, so allow unquotedReyk Floeter
slashes in strings. Slashes were excluded because the parser came from pfctl and bgpd were IP prefixes are parsed this way but we can handle such cases differently if vmd ever has to parse IPs with prefix length. This change also allows to concatenate pathnames with macros.