1 .\" Copyright (c) 2013 Peter Grehan
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd "run a guest operating system inside a virtual machine"
52 .Ar lpcdev Op Cm \&, Ar conf
59 .Cm K No | Cm k No | Cm M No | Cm m No | Cm G No | Cm g No | Cm T No | Cm t
63 .Op Fl p Ar vcpu Ns Cm \&: Ns Ar hostcpu
66 .Ar slot Cm \&, Ar emulation Op Cm \&, Ar conf
77 is a hypervisor that runs guest operating systems inside a
80 Parameters such as the number of virtual CPUs, amount of guest memory, and
81 I/O connectivity can be specified with command-line parameters.
83 If not using a boot ROM, the guest operating system must be loaded with
85 or a similar boot loader before running
87 otherwise, it is enough to run
89 with a boot ROM of choice.
92 runs until the guest operating system reboots or an unhandled hypervisor
102 The guest's local APIC is configured in xAPIC mode.
103 The xAPIC mode is the default setting so this option is redundant.
104 It will be deprecated in a future version.
106 Enable a low-level console device supported by
108 kernels compiled with
109 .Cd "device bvmconsole" .
110 This option is deprecated and will be removed in
113 Include guest memory in core file.
114 .It Fl c Op Ar setting ...
115 Number of guest virtual CPUs
116 and/or the CPU topology.
117 The default value for each of
124 The current maximum number of guest virtual CPUs is 16.
127 is not specified then it will be calculated from the other arguments.
128 The topology must be consistent in that the
130 must equal the product of
137 is specified more than once the last one has precedence.
139 Destroy the VM on guest initiated power-off.
143 to exit when a guest issues an access to an I/O port that is not emulated.
144 This is intended for debug purposes.
146 Start a debug server that uses the GDB protocol to export guest state to a
148 An IPv4 TCP socket will be bound to the supplied
150 to listen for debugger connections.
151 Only a single debugger may be attached to the debug server at a time.
157 will pause execution at the first instruction waiting for a debugger to attach.
161 kernels compiled with
162 .Cd "device bvmdebug" ,
163 allow a remote kernel kgdb to be relayed to the guest kernel gdb stub
164 via a local IPv4 address and this port.
165 This option is deprecated and will be removed in
168 Yield the virtual CPU thread when a HLT instruction is detected.
169 If this option is not specified, virtual CPUs will use 100% of a host CPU.
171 Print help message and exit.
173 Set configuration variables from a simple, key-value config file.
174 Each line of the config file is expected to consist of a config variable
178 No spaces are permitted between the variable name, equals sign, or
180 Blank lines and lines starting with
184 Print a list of supported LPC devices.
185 .It Fl l Ar lpcdev Ns Op Cm \&, Ns Ar conf
186 Allow devices behind the LPC PCI-ISA bridge to be configured.
187 The only supported devices are the TTY-class devices
193 and the debug/test device
196 The possible values for the
198 argument are listed in the
202 .Fl m Ar memsize Ns Oo
204 .Cm K | k | M | m | G | g | T | t
208 Set the guest physical memory size
209 This must be the same size that was given to
212 The size argument may be suffixed with one of
216 (either upper or lower case)
217 to indicate a multiple of kilobytes, megabytes, gigabytes, or terabytes.
218 If no suffix is given, the value is assumed to be in megabytes.
221 .It Fl o Ar var Ns Cm = Ns Ar value
222 Set the configuration variable
227 Force the guest virtual CPU to exit when a PAUSE instruction is detected.
228 .It Fl p Ar vcpu Ns Cm \& : Ns Ar hostcpu
229 Pin guest's virtual CPU
234 Force the guest virtual CPU to exit when a PAUSE instruction is detected.
238 Print a list of supported PCI devices.
239 .It Fl s Ar slot Ns Cm \&, Ns Ar emulation Ns Op Cm \&, Ns Ar conf
240 Configure a virtual PCI slot and function.
243 provides PCI bus emulation and virtual devices that can be attached to
245 There are 32 available slots, with the option of providing up to 8 functions
250 can be specified in one of the following formats:
257 .Ar pcislot Cm \&: Ar function
261 .Ar bus Cm \&: Ar pcislot Cm \&: Ar function
274 If not specified, the
277 If not specified, the
284 can be one of the following:
285 .Bl -tag -width "amd_hostbridge"
287 A simple host bridge.
288 This is usually configured at slot 0, and is required by most guest
290 .It Cm amd_hostbridge
291 Emulation identical to
293 using a PCI vendor ID of AMD.
295 PCI pass-through device.
297 Virtio network interface.
299 Virtio block storage interface.
301 Virtio SCSI interface.
303 Virtio RNG interface.
304 .It Cm virtio-console
305 Virtio console interface, which exposes multiple ports
306 to the guest in the form of simple char devices for simple IO
307 between the guest and host userspaces.
309 AHCI controller attached to arbitrary devices.
311 AHCI controller attached to an ATAPI CD/DVD.
313 AHCI controller attached to a SATA hard drive.
315 Intel e82545 network interface.
317 PCI 16550 serial device.
319 LPC PCI-ISA bridge with COM1, COM2, and 16550 serial ports,
321 optionally, the debug/test device.
322 The LPC bridge emulation can only be configured on bus 0.
324 Raw framebuffer device attached to VNC server.
326 eXtensible Host Controller Interface (xHCI) USB controller.
328 NVM Express (NVMe) controller.
331 The optional parameter
333 describes the backend for device emulations.
336 is not specified, the device emulation has no backend and can be
337 considered unconnected.
339 Network backends formats for
346 .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
352 .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
362 parameter can be specified to inform the guest about the largest MTU
363 that should be allowed, expressed in bytes.
365 Block storage device backends:
369 .Ar /filename Op Cm \&, Ar block-device-options
371 .Ar /dev/xxx Op Cm \&, Ar block-device-options
376 .Ar block-device-options
386 Force the file to be opened read-only.
387 .It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc
388 Specify the logical and physical sector sizes of the emulated disk.
389 The physical sector size is optional and is equal to the logical sector size
390 if not explicitly specified.
393 SCSI device backends:
397 .Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc
402 .Ar scsi-device-options
405 .It Cm iid= Ns Ar IID
406 Initiator ID to use when sending requests to specified CTL port.
407 The default value is 0.
413 Connect the serial port to the standard input and output of
418 Use the host TTY device for serial port I/O.
421 Boot ROM device backends:
426 in the guest address space reserved for boot firmware.
429 Pass-through device backends:
431 .It Ns Ar slot Ns Cm \&/ Ns Ar bus Ns Cm \&/ Ns Ar function
432 Connect to a PCI device on the host at the selector described by
440 Guest memory must be wired using the
442 option when a pass-through device is configured.
444 The host device must have been reserved at boot-time using the
446 loader variable as described in
449 Virtio console device backends:
453 .Cm port1= Ns Ar /path/to/port1.sock Ns Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ...
457 A maximum of 16 ports per device can be created.
458 Every port is named and corresponds to a Unix domain socket created by
461 accepts at most one connection per port at a time.
466 Due to lack of destructors in
468 sockets on the filesystem must be cleaned up manually after
472 There is no way to use the
474 feature, nor the console port
477 Emergency write is advertised, but no-op at present.
480 Framebuffer devices backends:
484 .Op Cm rfb= Ar ip-and-port
487 .Op Cm ,vga= Ar vgaconf
489 .Op Cm ,password= Ar password
493 Configuration options are defined as follows:
495 .It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port
496 An IP address and a port VNC should listen on.
497 There are two formats:
507 .Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port
511 The default is to listen on localhost IPv4 address and default VNC port 5900.
512 An IPv6 address must be enclosed in square brackets and may contain an
513 optional zone identifier.
514 .It Cm w= Ns Ar width No and Cm h= Ns Ar height
515 A display resolution, width and height, respectively.
516 If not specified, a default resolution of 1024x768 pixels will be used.
517 Minimal supported resolution is 640x480 pixels,
518 and maximum is 1920x1200 pixels.
519 .It Cm vga= Ns Ar vgaconf
520 Possible values for this option are
526 PCI graphics cards have a dual personality in that they are
527 standard PCI devices with BAR addressing, but may also
528 implicitly decode legacy VGA I/O space
531 .Pq 64KB at Ad 0xA0000 .
534 option should be used for guests that attempt to issue BIOS calls which result
535 in I/O port queries, and fail to boot if I/O decode is disabled.
539 option should be used along with the CSM BIOS capability in UEFI
540 to boot traditional BIOS guests that require the legacy VGA I/O and
541 memory regions to be available.
545 option should be used for the UEFI guests that assume that
546 VGA adapter is present if they detect the I/O ports.
547 An example of such a guest is
555 .Pq Lk https://wiki.freebsd.org/bhyve
556 for configuration notes of particular guests.
560 to only boot upon the initiation of a VNC connection, simplifying the
561 installation of operating systems that require immediate keyboard input.
562 This can be removed for post-installation use.
563 .It Cm password= Ns Ar password
564 This type of authentication is known to be cryptographically weak and is not
565 intended for use on untrusted networks.
566 Many implementations will want to use stronger security, such as running
567 the session over an encrypted channel provided by IPsec or SSH.
570 xHCI USB device backends:
573 A USB tablet device which provides precise cursor synchronization
577 NVMe device backends:
584 .Op Cm ,ioslots= Ar #
592 Configuration options are defined as follows:
595 Accepted device paths are:
600 .Cm ram= Ns Ar size_in_MiB .
602 Max number of queues.
604 Max elements in each queue.
606 Max number of concurrent I/O requests.
608 Sector size (defaults to blockif sector size).
610 Serial number with maximum 20 characters.
612 IEEE Extended Unique Identifier (8 byte value).
614 DataSet Management support.
615 Supported values are:
621 AHCI device backends:
625 .Op Oo Cm hd\&: | cd\&: Oc Ar path
626 .Op Cm ,nmrr= Ar nmrr
633 Configuration options are defined as follows:
636 Nominal Media Rotation Rate, known as RPM.
637 Value 1 will indicate device as Solid State Disk.
638 Default value is 0, not report.
640 Serial Number with maximum 20 characters.
642 Revision Number with maximum 8 characters.
644 Model Number with maximum 40 characters.
650 Playback device, typically
653 Recording device, typically
657 Set the universally unique identifier
659 in the guest's System Management BIOS System Information structure.
660 By default a UUID is generated from the host's hostname and
665 Force virtio PCI device emulations to use MSI interrupts instead of MSI-X
668 Ignore accesses to unimplemented Model Specific Registers (MSRs).
669 This is intended for debug purposes.
671 The guest's local APIC is configured in x2APIC mode.
673 Disable MPtable generation.
675 Alphanumeric name of the guest.
676 This should be the same as that created by
680 The current debug server provides limited support for debuggers.
682 Each virtual CPU is exposed to the debugger as a thread.
684 General purpose registers can be queried for each virtual CPU, but other
685 registers such as floating-point and system registers cannot be queried.
687 Memory (including memory mapped I/O regions) can be read by the debugger,
689 Memory operations use virtual addresses that are resolved to physical addresses
690 via the current virtual CPU's active address translation.
692 The running guest can be interrupted by the debugger at any time
693 .Pq for example, by pressing Ctrl-C in the debugger .
695 Single stepping is only supported on Intel CPUs supporting the MTRAP VM exit.
697 Breakpoints are supported on Intel CPUs that support single stepping.
698 Note that continuing from a breakpoint while interrupts are enabled in the
699 guest may not work as expected due to timer interrupts firing while single
700 stepping over the breakpoint.
703 deals with the following signals:
705 .Bl -tag -width SIGTERM -compact
707 Trigger ACPI poweroff for a VM
710 Exit status indicates how the VM was terminated:
712 .Bl -tag -width indent -compact
722 exited due to an error
725 If not using a boot ROM, the guest operating system must have been loaded with
727 or a similar boot loader before
730 Otherwise, the boot loader is not needed.
732 To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio
733 block device backed by the
735 filesystem image, and a serial port for the console:
736 .Bd -literal -offset indent
737 bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \\
738 -l com1,stdio -A -H -P -m 1G vm1
741 Run a 24GB single-CPU virtual machine with three network ports, one of which
742 has a MAC address specified:
743 .Bd -literal -offset indent
744 bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\
745 -s 2:1,virtio-net,tap1 \\
746 -s 2:2,virtio-net,tap2,mac=00:be:fa:76:45:00 \\
747 -s 3,virtio-blk,/my/image -l com1,stdio \\
748 -A -H -P -m 24G bigvm
751 Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI
752 CD-ROM, a single virtio network port, an AMD hostbridge, and the console
756 .Bd -literal -offset indent
758 -s 0,amd_hostbridge -s 1,lpc \\
759 -s 1:0,ahci,hd:/images/disk.1,hd:/images/disk.2,\\
760 hd:/images/disk.3,hd:/images/disk.4,\\
761 hd:/images/disk.5,hd:/images/disk.6,\\
762 hd:/images/disk.7,hd:/images/disk.8,\\
763 cd:/images/install.iso \\
764 -s 3,virtio-net,tap0 \\
765 -l com1,/dev/nmdm0A \\
769 Run a UEFI virtual machine with a display resolution of 800 by 600 pixels
770 that can be accessed via VNC at: 0.0.0.0:5900.
771 .Bd -literal -offset indent
772 bhyve -c 2 -m 4G -w -H \\
774 -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\
775 -s 4,ahci-hd,disk.img \\
776 -s 5,virtio-net,tap0 \\
777 -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\
779 -s 31,lpc -l com1,stdio \\
780 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
784 Run a UEFI virtual machine with a VNC display that is bound to all IPv6
785 addresses on port 5900.
786 .Bd -literal -offset indent
787 bhyve -c 2 -m 4G -w -H \\
789 -s 4,ahci-hd,disk.img \\
790 -s 5,virtio-net,tap0 \\
791 -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\
793 -s 31,lpc -l com1,stdio \\
794 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
807 .%B 64 and IA-32 Architectures Software Developer’s Manual
815 .An Neel Natu Aq Mt neel@freebsd.org
816 .An Peter Grehan Aq Mt grehan@freebsd.org