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 .Oo Ar bind_address Cm \&: Oc
56 .Op Fl k Ar config_file
60 .Ar lpcdev Op Cm \&, Ar conf
67 .Cm K | Cm k | Cm M | Cm m | Cm G | Cm g | Cm T | Cm t
71 .Op Fl o Ar var Ns Cm = Ns Ar value
72 .Op Fl p Ar vcpu Ns Cm \&: Ns Ar hostcpu
76 .Ar slot Cm \&, Ar emulation Op Cm \&, Ar conf
87 is a hypervisor that runs guest operating systems inside a
90 Parameters such as the number of virtual CPUs, amount of guest memory, and
91 I/O connectivity can be specified with command-line parameters.
93 If not using a boot ROM, the guest operating system must be loaded with
95 or a similar boot loader before running
97 otherwise, it is enough to run
99 with a boot ROM of choice.
102 runs until the guest operating system reboots or an unhandled hypervisor
107 Generate ACPI tables.
112 The guest's local APIC is configured in xAPIC mode.
113 The xAPIC mode is the default setting so this option is redundant.
114 It will be deprecated in a future version.
116 Include guest memory in core file.
117 .It Fl c Op Ar setting ...
118 Number of guest virtual CPUs
119 and/or the CPU topology.
120 The default value for each of
127 The current maximum number of guest virtual CPUs is 16.
130 is not specified then it will be calculated from the other arguments.
131 The topology must be consistent in that the
133 must equal the product of
140 is specified more than once the last one has precedence.
142 Destroy the VM on guest initiated power-off.
146 to exit when a guest issues an access to an I/O port that is not emulated.
147 This is intended for debug purposes.
151 .Oo Ar bind_address Cm \&: Oc
155 Start a debug server that uses the GDB protocol to export guest state to a
157 An IPv4 TCP socket will be bound to the supplied
161 to listen for debugger connections.
162 Only a single debugger may be attached to the debug server at a time.
163 If the option begins with
166 will pause execution at the first instruction waiting for a debugger to attach.
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.
172 .It Fl k Ar config_file
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
177 Specify the keyboard layout.
178 The value that can be specified sets the file name in
179 .Ar /usr/share/bhyve/kbdlayout .
180 This specification only works when loaded with UEFI mode for VNC.
181 When using a VNC client that supports QEMU Extended Key Event Message (e.g. TigerVNC), this option isn't needed.
182 When using a VNC client that doesn't support QEMU Extended Key Event Message (e.g. tightVNC), the layout defaults to the US keyboard unless specified otherwise.
185 No spaces are permitted between the variable name, equals sign, or
187 Blank lines and lines starting with
194 Print a list of supported LPC devices.
195 .It Fl l Ar lpcdev Ns Op Cm \&, Ns Ar conf
196 Allow devices behind the LPC PCI-ISA bridge to be configured.
197 The only supported devices are the TTY-class devices
198 .Cm com1 , com2 , com3 ,
203 and the debug/test device
206 The possible values for the
208 argument are listed in the
212 .Fl m Ar memsize Ns Oo
214 .Cm K | k | M | m | G | g | T | t
218 Set the guest physical memory size
219 This must be the same size that was given to
222 The size argument may be suffixed with one of
226 (either upper or lower case)
227 to indicate a multiple of kilobytes, megabytes, gigabytes, or terabytes.
228 If no suffix is given, the value is assumed to be in megabytes.
231 .It Fl o Ar var Ns Cm = Ns Ar value
232 Set the configuration variable
237 Force the guest virtual CPU to exit when a PAUSE instruction is detected.
238 .It Fl p Ar vcpu Ns Cm \& : Ns Ar hostcpu
239 Pin guest's virtual CPU
244 Resume a guest from a snapshot.
245 The guest memory contents are restored from
247 and the guest device and vCPU state are restored from the file
248 .Dq Ar file Ns .kern .
250 Note that the current snapshot file format requires that the configuration of
251 devices in the new VM match the VM from which the snapshot was taken by specifying the
257 The count of vCPUs and memory configuration are read from the snapshot.
261 Print a list of supported PCI devices.
262 .It Fl s Ar slot Ns Cm \&, Ns Ar emulation Ns Op Cm \&, Ns Ar conf
263 Configure a virtual PCI slot and function.
266 provides PCI bus emulation and virtual devices that can be attached to
268 There are 32 available slots, with the option of providing up to 8 functions
273 can be specified in one of the following formats:
280 .Ar pcislot Cm \&: Ar function
284 .Ar bus Cm \&: Ar pcislot Cm \&: Ar function
297 If not specified, the
300 If not specified, the
307 can be one of the following:
308 .Bl -tag -width "amd_hostbridge"
310 A simple host bridge.
311 This is usually configured at slot 0, and is required by most guest
313 .It Cm amd_hostbridge
314 Emulation identical to
316 using a PCI vendor ID of AMD.
318 PCI pass-through device.
320 Virtio network interface.
322 Virtio block storage interface.
324 Virtio SCSI interface.
326 Virtio 9p (VirtFS) interface.
328 Virtio RNG interface.
329 .It Cm virtio-console
330 Virtio console interface, which exposes multiple ports
331 to the guest in the form of simple char devices for simple IO
332 between the guest and host userspaces.
334 Virtio input interface.
336 AHCI controller attached to arbitrary devices.
338 AHCI controller attached to an ATAPI CD/DVD.
340 AHCI controller attached to a SATA hard drive.
342 Intel e82545 network interface.
344 PCI 16550 serial device.
346 LPC PCI-ISA bridge with COM1, COM2, COM3, and COM4 16550 serial ports,
348 optionally, the debug/test device.
349 The LPC bridge emulation can only be configured on bus 0.
351 Raw framebuffer device attached to VNC server.
353 eXtensible Host Controller Interface (xHCI) USB controller.
355 NVM Express (NVMe) controller.
357 High Definition Audio Controller.
360 The optional parameter
362 describes the backend for device emulations.
365 is not specified, the device emulation has no backend and can be
366 considered unconnected.
368 Network device backends:
374 .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
380 .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
385 .Cm netgraph,path= Ar ADDRESS Cm \&,peerhook= Ar HOOK
386 .Op Cm \&,socket= Ar NAME
387 .Op Cm \&,hook= Ar HOOK
388 .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
396 is not specified, the MAC address is derived from a fixed OUI and the
397 remaining bytes from an MD5 hash of the slot and function numbers and
400 The MAC address is an ASCII string in
408 parameter can be specified to inform the guest about the largest MTU
409 that should be allowed, expressed in bytes.
417 parameters must be specified to set the destination node and corresponding hook.
418 The optional parameters
422 may be used to set the
424 node name and source hook.
434 Block storage device backends:
438 .Ar /filename Op Cm \&, Ar block-device-options
440 .Ar /dev/xxx Op Cm \&, Ar block-device-options
445 .Ar block-device-options
455 Force the file to be opened read-only.
456 .It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc
457 Specify the logical and physical sector sizes of the emulated disk.
458 The physical sector size is optional and is equal to the logical sector size
459 if not explicitly specified.
461 Disable emulation of guest trim requests via
466 SCSI device backends:
470 .Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc
475 .Ar scsi-device-options
478 .It Cm iid= Ns Ar IID
479 Initiator ID to use when sending requests to specified CTL port.
480 The default value is 0.
487 .Ar sharename Cm = Ar /path/to/share Op Cm \&, Ar 9p-device-options
492 .Ar 9p-device-options
496 Expose the share in read-only mode.
502 Connect the serial port to the standard input and output of
507 Use the host TTY device for serial port I/O.
510 Boot ROM device backends:
512 .It Ar romfile Ns Op Cm \&, Ns Ar varfile
515 in the guest address space reserved for boot firmware.
518 is provided, that file is also mapped in the boot firmware guest
519 address space, and any modifications the guest makes will be saved
523 Pass-through device backends:
527 .Cm ppt Ar N Oo , Ar passthru-device-options Oc
529 .Ns Ar bus Cm \&/ Ar slot Cm \&/ Ar function
530 .Op , Ar passthru-device-options
532 .Cm pci Ar bus Cm : Ar slot Cm : Ns Ar function
533 .Op , Ar passthru-device-options
537 Connect to a PCI device on the host either named ppt
539 or at the selector described by
547 .Ar passthru-device-options
550 .It Cm rom= Ns Ar romfile
553 as option ROM to the PCI device.
554 The ROM will be loaded by firmware and should be capable of initializing the device.
557 Guest memory must be wired using the
559 option when a pass-through device is configured.
561 The host device must have been reserved at boot-time using the
563 loader variable as described in
566 Virtio console device backends:
570 .Cm port1= Ns Ar /path/to/port1.sock Ns Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ...
574 A maximum of 16 ports per device can be created.
575 Every port is named and corresponds to a Unix domain socket created by
578 accepts at most one connection per port at a time.
583 Due to lack of destructors in
585 sockets on the filesystem must be cleaned up manually after
589 There is no way to use the
591 feature, nor the console port
594 Emergency write is advertised, but no-op at present.
597 Virtio input device backends:
599 .It Ar /dev/input/eventX
601 .Ar /dev/input/eventX
602 to guest by VirtIO Input Interface.
605 Framebuffer devices backends:
609 .Op Cm rfb= Ar ip-and-port
612 .Op Cm ,vga= Ar vgaconf
614 .Op Cm ,password= Ar password
618 Configuration options are defined as follows:
620 .It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port
621 An IP address and a port VNC should listen on.
622 There are two formats:
632 .Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port
636 The default is to listen on localhost IPv4 address and default VNC port 5900.
637 An IPv6 address must be enclosed in square brackets and may contain an
638 optional zone identifier.
639 .It Cm w= Ns Ar width No and Cm h= Ns Ar height
640 A display resolution, width and height, respectively.
641 If not specified, a default resolution of 1024x768 pixels will be used.
642 Minimal supported resolution is 640x480 pixels,
643 and maximum is 1920x1200 pixels.
644 .It Cm vga= Ns Ar vgaconf
645 Possible values for this option are
651 PCI graphics cards have a dual personality in that they are
652 standard PCI devices with BAR addressing, but may also
653 implicitly decode legacy VGA I/O space
656 .Pq 64KB at Ad 0xA0000 .
659 option should be used for guests that attempt to issue BIOS calls which result
660 in I/O port queries, and fail to boot if I/O decode is disabled.
664 option should be used along with the CSM BIOS capability in UEFI
665 to boot traditional BIOS guests that require the legacy VGA I/O and
666 memory regions to be available.
670 option should be used for the UEFI guests that assume that
671 VGA adapter is present if they detect the I/O ports.
672 An example of such a guest is
680 .Pq Lk https://wiki.freebsd.org/bhyve
681 for configuration notes of particular guests.
685 to only boot upon the initiation of a VNC connection, simplifying the
686 installation of operating systems that require immediate keyboard input.
687 This can be removed for post-installation use.
688 .It Cm password= Ns Ar password
689 This type of authentication is known to be cryptographically weak and is not
690 intended for use on untrusted networks.
691 Many implementations will want to use stronger security, such as running
692 the session over an encrypted channel provided by IPsec or SSH.
695 xHCI USB device backends:
698 A USB tablet device which provides precise cursor synchronization
702 NVMe device backends:
709 .Op Cm ,ioslots= Ar #
717 Configuration options are defined as follows:
720 Accepted device paths are:
725 .Cm ram= Ns Ar size_in_MiB .
727 Max number of queues.
729 Max elements in each queue.
731 Max number of concurrent I/O requests.
733 Sector size (defaults to blockif sector size).
735 Serial number with maximum 20 characters.
737 IEEE Extended Unique Identifier (8 byte value).
739 DataSet Management support.
740 Supported values are:
746 AHCI device backends:
750 .Op Oo Cm hd\&: | cd\&: Oc Ar path
751 .Op Cm ,nmrr= Ar nmrr
758 Configuration options are defined as follows:
761 Nominal Media Rotation Rate, known as RPM.
762 Value 1 will indicate device as Solid State Disk.
763 Default value is 0, not report.
765 Serial Number with maximum 20 characters.
767 Revision Number with maximum 8 characters.
769 Model Number with maximum 40 characters.
772 HD Audio device backends:
776 .Op Cm play= Ar playback
777 .Op Cm ,rec= Ar recording
781 Configuration options are defined as follows:
784 Playback device, typically
787 Recording device, typically
791 Set the universally unique identifier
793 in the guest's System Management BIOS System Information structure.
794 By default a UUID is generated from the host's hostname and
799 Force virtio PCI device emulations to use MSI interrupts instead of MSI-X
802 Ignore accesses to unimplemented Model Specific Registers (MSRs).
803 This is intended for debug purposes.
805 The guest's local APIC is configured in x2APIC mode.
807 Disable MPtable generation.
809 Alphanumeric name of the guest.
810 This should be the same as that created by
813 .Sh CONFIGURATION VARIABLES
815 uses an internal tree of configuration variables to describe global and
820 it parses command line options (including config files) in the order given
822 Each command line option sets one or more configuration variables.
826 option creates a new tree node for a PCI device and sets one or more variables
827 under that node including the device model and device model-specific variables.
828 Variables may be set multiple times during this parsing stage with the final
829 value overriding previous values.
831 Once all of the command line options have been processed,
832 the configuration values are frozen.
834 then uses the value of configuration values to initialize device models
837 More details on configuration variables can be found in
840 The current debug server provides limited support for debuggers.
842 Each virtual CPU is exposed to the debugger as a thread.
844 General purpose registers can be queried for each virtual CPU, but other
845 registers such as floating-point and system registers cannot be queried.
847 Memory (including memory mapped I/O regions) can be read and written by the debugger.
848 Memory operations use virtual addresses that are resolved to physical addresses
849 via the current virtual CPU's active address translation.
851 The running guest can be interrupted by the debugger at any time
852 .Pq for example, by pressing Ctrl-C in the debugger .
854 Single stepping is only supported on Intel CPUs supporting the MTRAP VM exit.
856 Breakpoints are supported on Intel CPUs that support single stepping.
857 Note that continuing from a breakpoint while interrupts are enabled in the
858 guest may not work as expected due to timer interrupts firing while single
859 stepping over the breakpoint.
862 deals with the following signals:
864 .Bl -tag -width SIGTERM -compact
866 Trigger ACPI poweroff for a VM
869 Exit status indicates how the VM was terminated:
871 .Bl -tag -width indent -compact
881 exited due to an error
884 If not using a boot ROM, the guest operating system must have been loaded with
886 or a similar boot loader before
889 Otherwise, the boot loader is not needed.
891 To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio
892 block device backed by the
894 filesystem image, and a serial port for the console:
895 .Bd -literal -offset indent
896 bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \\
897 -l com1,stdio -A -H -P -m 1G vm1
900 Run a 24GB single-CPU virtual machine with three network ports, one of which
901 has a MAC address specified:
902 .Bd -literal -offset indent
903 bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\
904 -s 2:1,virtio-net,tap1 \\
905 -s 2:2,virtio-net,tap2,mac=00:be:fa:76:45:00 \\
906 -s 3,virtio-blk,/my/image -l com1,stdio \\
907 -A -H -P -m 24G bigvm
910 Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI
911 CD-ROM, a single virtio network port, an AMD hostbridge, and the console
915 .Bd -literal -offset indent
917 -s 0,amd_hostbridge -s 1,lpc \\
918 -s 1:0,ahci,hd:/images/disk.1,hd:/images/disk.2,\\
919 hd:/images/disk.3,hd:/images/disk.4,\\
920 hd:/images/disk.5,hd:/images/disk.6,\\
921 hd:/images/disk.7,hd:/images/disk.8,\\
922 cd:/images/install.iso \\
923 -s 3,virtio-net,tap0 \\
924 -l com1,/dev/nmdm0A \\
928 Run a UEFI virtual machine with a display resolution of 800 by 600 pixels
929 that can be accessed via VNC at: 0.0.0.0:5900.
930 .Bd -literal -offset indent
931 bhyve -c 2 -m 4G -w -H \\
933 -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\
934 -s 4,ahci-hd,disk.img \\
935 -s 5,virtio-net,tap0 \\
936 -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\
938 -s 31,lpc -l com1,stdio \\
939 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
943 Run a UEFI virtual machine with a VNC display that is bound to all IPv6
944 addresses on port 5900.
945 .Bd -literal -offset indent
946 bhyve -c 2 -m 4G -w -H \\
948 -s 4,ahci-hd,disk.img \\
949 -s 5,virtio-net,tap0 \\
950 -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\
952 -s 31,lpc -l com1,stdio \\
953 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
957 Run a UEFI virtual machine with a VARS file to save EFI variables.
960 will write guest modifications to the given VARS file.
961 Be sure to create a per-guest copy of the template VARS file from
963 .Bd -literal -offset indent
964 bhyve -c 2 -m 4g -w -H \\
966 -s 31,lpc -p com1,stdio \\
967 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE.fd,BHYVE_UEFI_VARS.fd
983 .%B 64 and IA-32 Architectures Software Developer’s Manual
991 .An Neel Natu Aq Mt neel@freebsd.org
992 .An Peter Grehan Aq Mt grehan@freebsd.org