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 | Cm k | Cm M | Cm m | Cm G | Cm g | Cm T | 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 device backends:
345 .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
351 .Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
361 parameter can be specified to inform the guest about the largest MTU
362 that should be allowed, expressed in bytes.
364 Block storage device backends:
368 .Ar /filename Op Cm \&, Ar block-device-options
370 .Ar /dev/xxx Op Cm \&, Ar block-device-options
375 .Ar block-device-options
385 Force the file to be opened read-only.
386 .It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc
387 Specify the logical and physical sector sizes of the emulated disk.
388 The physical sector size is optional and is equal to the logical sector size
389 if not explicitly specified.
392 SCSI device backends:
396 .Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc
401 .Ar scsi-device-options
404 .It Cm iid= Ns Ar IID
405 Initiator ID to use when sending requests to specified CTL port.
406 The default value is 0.
412 Connect the serial port to the standard input and output of
417 Use the host TTY device for serial port I/O.
420 Boot ROM device backends:
425 in the guest address space reserved for boot firmware.
428 Pass-through device backends:
430 .It Ns Ar slot Ns Cm \&/ Ns Ar bus Ns Cm \&/ Ns Ar function
431 Connect to a PCI device on the host at the selector described by
439 Guest memory must be wired using the
441 option when a pass-through device is configured.
443 The host device must have been reserved at boot-time using the
445 loader variable as described in
448 Virtio console device backends:
452 .Cm port1= Ns Ar /path/to/port1.sock Ns Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ...
456 A maximum of 16 ports per device can be created.
457 Every port is named and corresponds to a Unix domain socket created by
460 accepts at most one connection per port at a time.
465 Due to lack of destructors in
467 sockets on the filesystem must be cleaned up manually after
471 There is no way to use the
473 feature, nor the console port
476 Emergency write is advertised, but no-op at present.
479 Framebuffer devices backends:
483 .Op Cm rfb= Ar ip-and-port
486 .Op Cm ,vga= Ar vgaconf
488 .Op Cm ,password= Ar password
492 Configuration options are defined as follows:
494 .It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port
495 An IP address and a port VNC should listen on.
496 There are two formats:
506 .Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port
510 The default is to listen on localhost IPv4 address and default VNC port 5900.
511 An IPv6 address must be enclosed in square brackets and may contain an
512 optional zone identifier.
513 .It Cm w= Ns Ar width No and Cm h= Ns Ar height
514 A display resolution, width and height, respectively.
515 If not specified, a default resolution of 1024x768 pixels will be used.
516 Minimal supported resolution is 640x480 pixels,
517 and maximum is 1920x1200 pixels.
518 .It Cm vga= Ns Ar vgaconf
519 Possible values for this option are
525 PCI graphics cards have a dual personality in that they are
526 standard PCI devices with BAR addressing, but may also
527 implicitly decode legacy VGA I/O space
530 .Pq 64KB at Ad 0xA0000 .
533 option should be used for guests that attempt to issue BIOS calls which result
534 in I/O port queries, and fail to boot if I/O decode is disabled.
538 option should be used along with the CSM BIOS capability in UEFI
539 to boot traditional BIOS guests that require the legacy VGA I/O and
540 memory regions to be available.
544 option should be used for the UEFI guests that assume that
545 VGA adapter is present if they detect the I/O ports.
546 An example of such a guest is
554 .Pq Lk https://wiki.freebsd.org/bhyve
555 for configuration notes of particular guests.
559 to only boot upon the initiation of a VNC connection, simplifying the
560 installation of operating systems that require immediate keyboard input.
561 This can be removed for post-installation use.
562 .It Cm password= Ns Ar password
563 This type of authentication is known to be cryptographically weak and is not
564 intended for use on untrusted networks.
565 Many implementations will want to use stronger security, such as running
566 the session over an encrypted channel provided by IPsec or SSH.
569 xHCI USB device backends:
572 A USB tablet device which provides precise cursor synchronization
576 NVMe device backends:
583 .Op Cm ,ioslots= Ar #
591 Configuration options are defined as follows:
594 Accepted device paths are:
599 .Cm ram= Ns Ar size_in_MiB .
601 Max number of queues.
603 Max elements in each queue.
605 Max number of concurrent I/O requests.
607 Sector size (defaults to blockif sector size).
609 Serial number with maximum 20 characters.
611 IEEE Extended Unique Identifier (8 byte value).
613 DataSet Management support.
614 Supported values are:
620 AHCI device backends:
624 .Op Oo Cm hd\&: | cd\&: Oc Ar path
625 .Op Cm ,nmrr= Ar nmrr
632 Configuration options are defined as follows:
635 Nominal Media Rotation Rate, known as RPM.
636 Value 1 will indicate device as Solid State Disk.
637 Default value is 0, not report.
639 Serial Number with maximum 20 characters.
641 Revision Number with maximum 8 characters.
643 Model Number with maximum 40 characters.
646 HD Audio device backends:
650 .Op Cm play= Ar playback
651 .Op Cm ,rec= Ar recording
655 Configuration options are defined as follows:
658 Playback device, typically
661 Recording device, typically
665 Set the universally unique identifier
667 in the guest's System Management BIOS System Information structure.
668 By default a UUID is generated from the host's hostname and
673 Force virtio PCI device emulations to use MSI interrupts instead of MSI-X
676 Ignore accesses to unimplemented Model Specific Registers (MSRs).
677 This is intended for debug purposes.
679 The guest's local APIC is configured in x2APIC mode.
681 Disable MPtable generation.
683 Alphanumeric name of the guest.
684 This should be the same as that created by
688 The current debug server provides limited support for debuggers.
690 Each virtual CPU is exposed to the debugger as a thread.
692 General purpose registers can be queried for each virtual CPU, but other
693 registers such as floating-point and system registers cannot be queried.
695 Memory (including memory mapped I/O regions) can be read by the debugger,
697 Memory operations use virtual addresses that are resolved to physical addresses
698 via the current virtual CPU's active address translation.
700 The running guest can be interrupted by the debugger at any time
701 .Pq for example, by pressing Ctrl-C in the debugger .
703 Single stepping is only supported on Intel CPUs supporting the MTRAP VM exit.
705 Breakpoints are supported on Intel CPUs that support single stepping.
706 Note that continuing from a breakpoint while interrupts are enabled in the
707 guest may not work as expected due to timer interrupts firing while single
708 stepping over the breakpoint.
711 deals with the following signals:
713 .Bl -tag -width SIGTERM -compact
715 Trigger ACPI poweroff for a VM
718 Exit status indicates how the VM was terminated:
720 .Bl -tag -width indent -compact
730 exited due to an error
733 If not using a boot ROM, the guest operating system must have been loaded with
735 or a similar boot loader before
738 Otherwise, the boot loader is not needed.
740 To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio
741 block device backed by the
743 filesystem image, and a serial port for the console:
744 .Bd -literal -offset indent
745 bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \\
746 -l com1,stdio -A -H -P -m 1G vm1
749 Run a 24GB single-CPU virtual machine with three network ports, one of which
750 has a MAC address specified:
751 .Bd -literal -offset indent
752 bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\
753 -s 2:1,virtio-net,tap1 \\
754 -s 2:2,virtio-net,tap2,mac=00:be:fa:76:45:00 \\
755 -s 3,virtio-blk,/my/image -l com1,stdio \\
756 -A -H -P -m 24G bigvm
759 Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI
760 CD-ROM, a single virtio network port, an AMD hostbridge, and the console
764 .Bd -literal -offset indent
766 -s 0,amd_hostbridge -s 1,lpc \\
767 -s 1:0,ahci,hd:/images/disk.1,hd:/images/disk.2,\\
768 hd:/images/disk.3,hd:/images/disk.4,\\
769 hd:/images/disk.5,hd:/images/disk.6,\\
770 hd:/images/disk.7,hd:/images/disk.8,\\
771 cd:/images/install.iso \\
772 -s 3,virtio-net,tap0 \\
773 -l com1,/dev/nmdm0A \\
777 Run a UEFI virtual machine with a display resolution of 800 by 600 pixels
778 that can be accessed via VNC at: 0.0.0.0:5900.
779 .Bd -literal -offset indent
780 bhyve -c 2 -m 4G -w -H \\
782 -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\
783 -s 4,ahci-hd,disk.img \\
784 -s 5,virtio-net,tap0 \\
785 -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\
787 -s 31,lpc -l com1,stdio \\
788 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
792 Run a UEFI virtual machine with a VNC display that is bound to all IPv6
793 addresses on port 5900.
794 .Bd -literal -offset indent
795 bhyve -c 2 -m 4G -w -H \\
797 -s 4,ahci-hd,disk.img \\
798 -s 5,virtio-net,tap0 \\
799 -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\
801 -s 31,lpc -l com1,stdio \\
802 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
815 .%B 64 and IA-32 Architectures Software Developer’s Manual
823 .An Neel Natu Aq Mt neel@freebsd.org
824 .An Peter Grehan Aq Mt grehan@freebsd.org