xref: /freebsd/usr.sbin/bhyve/bhyve.8 (revision 2b833162)
1.\" Copyright (c) 2013 Peter Grehan
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
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.
12.\"
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
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd August 19, 2022
28.Dt BHYVE 8
29.Os
30.Sh NAME
31.Nm bhyve
32.Nd "run a guest operating system inside a virtual machine"
33.Sh SYNOPSIS
34.Nm
35.Op Fl AaCDeHhPSuWwxY
36.Oo
37.Sm off
38.Fl c\~
39.Oo
40.Op Cm cpus=
41.Ar numcpus
42.Oc
43.Op Cm ,sockets= Ar n
44.Op Cm ,cores= Ar n
45.Op Cm ,threads= Ar n
46.Oc
47.Sm on
48.Oo
49.Sm off
50.Fl G\~
51.Oo Ar w Oc
52.Oo Ar bind_address Cm \&: Oc
53.Ar port
54.Sm on
55.Oc
56.Op Fl k Ar config_file
57.Op Fl K Ar layout
58.Oo Fl l
59.Sm off
60.Ar lpcdev Op Cm \&, Ar conf
61.Sm on
62.Oc
63.Sm off
64.Oo Fl m\~
65.Ar memsize
66.Oo
67.Cm K | Cm k | Cm M | Cm m | Cm G | Cm g | Cm T | Cm t
68.Oc
69.Sm on
70.Oc
71.Op Fl o Ar var Ns Cm = Ns Ar value
72.Op Fl p Ar vcpu Ns Cm \&: Ns Ar hostcpu
73.Op Fl r Ar file
74.Sm off
75.Oo Fl s\~
76.Ar slot Cm \&, Ar emulation Op Cm \&, Ar conf
77.Sm on
78.Oc
79.Op Fl U Ar uuid
80.Ar vmname
81.Nm
82.Fl l Cm help
83.Nm
84.Fl s Cm help
85.Sh DESCRIPTION
86.Nm
87is a hypervisor that runs guest operating systems inside a
88virtual machine.
89.Pp
90Parameters such as the number of virtual CPUs, amount of guest memory, and
91I/O connectivity can be specified with command-line parameters.
92.Pp
93If not using a boot ROM, the guest operating system must be loaded with
94.Xr bhyveload 8
95or a similar boot loader before running
96.Nm ,
97otherwise, it is enough to run
98.Nm
99with a boot ROM of choice.
100.Pp
101.Nm
102runs until the guest operating system reboots or an unhandled hypervisor
103exit is detected.
104.Sh OPTIONS
105.Bl -tag -width 10n
106.It Fl A
107Generate ACPI tables.
108Required for
109.Fx Ns /amd64
110guests.
111.It Fl a
112The guest's local APIC is configured in xAPIC mode.
113The xAPIC mode is the default setting so this option is redundant.
114It will be deprecated in a future version.
115.It Fl C
116Include guest memory in core file.
117.It Fl c Op Ar setting ...
118Number of guest virtual CPUs
119and/or the CPU topology.
120The default value for each of
121.Ar numcpus ,
122.Ar sockets ,
123.Ar cores ,
124and
125.Ar threads
126is 1.
127The current maximum number of guest virtual CPUs is 16.
128If
129.Ar numcpus
130is not specified then it will be calculated from the other arguments.
131The topology must be consistent in that the
132.Ar numcpus
133must equal the product of
134.Ar sockets ,
135.Ar cores ,
136and
137.Ar threads .
138If a
139.Ar setting
140is specified more than once the last one has precedence.
141.It Fl D
142Destroy the VM on guest initiated power-off.
143.It Fl e
144Force
145.Nm
146to exit when a guest issues an access to an I/O port that is not emulated.
147This is intended for debug purposes.
148.It Fl G Xo
149.Sm off
150.Oo Ar w Oc
151.Oo Ar bind_address Cm \&: Oc
152.Ar port
153.Sm on
154.Xc
155Start a debug server that uses the GDB protocol to export guest state to a
156debugger.
157An IPv4 TCP socket will be bound to the supplied
158.Ar bind_address
159and
160.Ar port
161to listen for debugger connections.
162Only a single debugger may be attached to the debug server at a time.
163If the option begins with
164.Sq w ,
165.Nm
166will pause execution at the first instruction waiting for a debugger to attach.
167.It Fl H
168Yield the virtual CPU thread when a HLT instruction is detected.
169If this option is not specified, virtual CPUs will use 100% of a host CPU.
170.It Fl h
171Print help message and exit.
172.It Fl k Ar config_file
173Set configuration variables from a simple, key-value config file.
174Each line of the config file is expected to consist of a config variable
175name, an equals sign
176.It Fl K Ar layout
177Specify the keyboard layout.
178The value that can be specified sets the file name in
179.Ar /usr/share/bhyve/kbdlayout .
180This specification only works when loaded with UEFI mode for VNC.
181When using a VNC client that supports QEMU Extended Key Event Message (e.g. TigerVNC), this option isn't needed.
182When 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.
183.Pq Sq = ,
184and a value.
185No spaces are permitted between the variable name, equals sign, or
186value.
187Blank lines and lines starting with
188.Sq #
189are ignored.
190See
191.Xr bhyve_config 5
192for more details.
193.It Fl l Cm help
194Print a list of supported LPC devices.
195.It Fl l Ar lpcdev Ns Op Cm \&, Ns Ar conf
196Allow devices behind the LPC PCI-ISA bridge to be configured.
197The only supported devices are the TTY-class devices
198.Cm com1 , com2 , com3 ,
199and
200.Cm com4 ,
201the boot ROM device
202.Cm bootrom ,
203the
204.Cm fwcfg
205type and the debug/test device
206.Cm pc-testdev .
207.Pp
208The possible values for the
209.Ar conf
210argument are listed in the
211.Fl s
212flag description.
213.It Xo
214.Fl m Ar memsize Ns Oo
215.Sm off
216.Cm K | k | M | m | G | g | T | t
217.Sm on
218.Oc
219.Xc
220Set the guest physical memory size
221This must be the same size that was given to
222.Xr bhyveload 8 .
223.Pp
224The size argument may be suffixed with one of
225.Cm K , M , G
226or
227.Cm T
228(either upper or lower case)
229to indicate a multiple of kilobytes, megabytes, gigabytes, or terabytes.
230If no suffix is given, the value is assumed to be in megabytes.
231.Pp
232The default is 256M.
233.It Fl o Ar var Ns Cm = Ns Ar value
234Set the configuration variable
235.Ar var
236to
237.Ar value .
238.It Fl P
239Force the guest virtual CPU to exit when a PAUSE instruction is detected.
240.It Fl p Ar vcpu Ns Cm \& : Ns Ar hostcpu
241Pin guest's virtual CPU
242.Em vcpu
243to
244.Em hostcpu .
245.It Fl r Ar file
246Resume a guest from a snapshot.
247The guest memory contents are restored from
248.Ar file ,
249and the guest device and vCPU state are restored from the file
250.Dq Ar file Ns .kern .
251.Pp
252Note that the current snapshot file format requires that the configuration of
253devices in the new VM match the VM from which the snapshot was taken by specifying the
254same
255.Fl s
256and
257.Fl l
258options.
259The count of vCPUs and memory configuration are read from the snapshot.
260.It Fl S
261Wire guest memory.
262.It Fl s Cm help
263Print a list of supported PCI devices.
264.It Fl s Ar slot Ns Cm \&, Ns Ar emulation Ns Op Cm \&, Ns Ar conf
265Configure a virtual PCI slot and function.
266.Pp
267.Nm
268provides PCI bus emulation and virtual devices that can be attached to
269slots on the bus.
270There are 32 available slots, with the option of providing up to 8 functions
271per slot.
272.Pp
273The
274.Ar slot
275can be specified in one of the following formats:
276.Pp
277.Bl -bullet -compact
278.It
279.Ar pcislot
280.It
281.Sm off
282.Ar pcislot Cm \&: Ar function
283.Sm on
284.It
285.Sm off
286.Ar bus Cm \&: Ar pcislot Cm \&: Ar function
287.Sm on
288.El
289.Pp
290The
291.Ar pcislot
292value is 0 to 31.
293The optional
294.Ar function
295value is 0 to 7.
296The optional
297.Ar bus
298value is 0 to 255.
299If not specified, the
300.Ar function
301value defaults to 0.
302If not specified, the
303.Ar bus
304value defaults to 0.
305.Pp
306The
307.Ar emulation
308argument
309can be one of the following:
310.Bl -tag -width "amd_hostbridge"
311.It Cm hostbridge
312A simple host bridge.
313This is usually configured at slot 0, and is required by most guest
314operating systems.
315.It Cm amd_hostbridge
316Emulation identical to
317.Cm hostbridge
318using a PCI vendor ID of AMD.
319.It Cm passthru
320PCI pass-through device.
321.It Cm virtio-net
322Virtio network interface.
323.It Cm virtio-blk
324Virtio block storage interface.
325.It Cm virtio-scsi
326Virtio SCSI interface.
327.It Cm virtio-9p
328Virtio 9p (VirtFS) interface.
329.It Cm virtio-rnd
330Virtio RNG interface.
331.It Cm virtio-console
332Virtio console interface, which exposes multiple ports
333to the guest in the form of simple char devices for simple IO
334between the guest and host userspaces.
335.It Cm virtio-input
336Virtio input interface.
337.It Cm ahci
338AHCI controller attached to arbitrary devices.
339.It Cm ahci-cd
340AHCI controller attached to an ATAPI CD/DVD.
341.It Cm ahci-hd
342AHCI controller attached to a SATA hard drive.
343.It Cm e1000
344Intel e82545 network interface.
345.It Cm uart
346PCI 16550 serial device.
347.It Cm lpc
348LPC PCI-ISA bridge with COM1, COM2, COM3, and COM4 16550 serial ports,
349a boot ROM, and,
350optionally, a fwcfg type and the debug/test device.
351The LPC bridge emulation can only be configured on bus 0.
352.It Cm fbuf
353Raw framebuffer device attached to VNC server.
354.It Cm xhci
355eXtensible Host Controller Interface (xHCI) USB controller.
356.It Cm nvme
357NVM Express (NVMe) controller.
358.It Cm hda
359High Definition Audio Controller.
360.El
361.Pp
362The optional parameter
363.Ar conf
364describes the backend for device emulations.
365If
366.Ar conf
367is not specified, the device emulation has no backend and can be
368considered unconnected.
369.Pp
370Network device backends:
371.Sm off
372.Bl -bullet
373.It
374.Xo
375.Cm tap Ar N
376.Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
377.Op Cm \&,mtu= Ar N
378.Xc
379.It
380.Xo
381.Cm vmnet Ar N
382.Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
383.Op Cm \&,mtu= Ar N
384.Xc
385.It
386.Xo
387.Cm netgraph,path= Ar ADDRESS Cm \&,peerhook= Ar HOOK
388.Op Cm \&,socket= Ar NAME
389.Op Cm \&,hook= Ar HOOK
390.Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx
391.Op Cm \&,mtu= Ar N
392.Xc
393.El
394.Sm on
395.Pp
396If
397.Cm mac
398is not specified, the MAC address is derived from a fixed OUI and the
399remaining bytes from an MD5 hash of the slot and function numbers and
400the device name.
401.Pp
402The MAC address is an ASCII string in
403.Xr ethers 5
404format.
405.Pp
406With
407.Cm virtio-net
408devices, the
409.Cm mtu
410parameter can be specified to inform the guest about the largest MTU
411that should be allowed, expressed in bytes.
412.Pp
413With
414.Cm netgraph
415backend, the
416.Cm path
417and
418.Cm peerhook
419parameters must be specified to set the destination node and corresponding hook.
420The optional parameters
421.Cm socket
422and
423.Cm hook
424may be used to set the
425.Xr ng_socket 4
426node name and source hook.
427The
428.Ar ADDRESS ,
429.Ar HOOK ,
430and
431.Ar NAME
432must comply with
433.Xr netgraph 4
434addressing rules.
435.Pp
436Block storage device backends:
437.Sm off
438.Bl -bullet
439.It
440.Ar /filename Op Cm \&, Ar block-device-options
441.It
442.Ar /dev/xxx Op Cm \&, Ar block-device-options
443.El
444.Sm on
445.Pp
446The
447.Ar block-device-options
448are:
449.Bl -tag -width 10n
450.It Cm nocache
451Open the file with
452.Dv O_DIRECT .
453.It Cm direct
454Open the file using
455.Dv O_SYNC .
456.It Cm ro
457Force the file to be opened read-only.
458.It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc
459Specify the logical and physical sector sizes of the emulated disk.
460The physical sector size is optional and is equal to the logical sector size
461if not explicitly specified.
462.It Cm nodelete
463Disable emulation of guest trim requests via
464.Dv DIOCGDELETE
465requests.
466.El
467.Pp
468SCSI device backends:
469.Sm off
470.Bl -bullet
471.It
472.Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc
473.El
474.Sm on
475.Pp
476The
477.Ar scsi-device-options
478are:
479.Bl -tag -width 10n
480.It Cm iid= Ns Ar IID
481Initiator ID to use when sending requests to specified CTL port.
482The default value is 0.
483.El
484.Pp
4859P device backends:
486.Sm off
487.Bl -bullet
488.It
489.Ar sharename Cm = Ar /path/to/share Op Cm \&, Ar 9p-device-options
490.El
491.Sm on
492.Pp
493The
494.Ar 9p-device-options
495are:
496.Bl -tag -width 10n
497.It Cm ro
498Expose the share in read-only mode.
499.El
500.Pp
501TTY device backends:
502.Bl -tag -width 10n
503.It Cm stdio
504Connect the serial port to the standard input and output of
505the
506.Nm
507process.
508.It Ar /dev/xxx
509Use the host TTY device for serial port I/O.
510.El
511.Pp
512Boot ROM device backends:
513.Bl -tag -width 10n
514.It Ar romfile Ns Op Cm \&, Ns Ar varfile
515Map
516.Ar romfile
517in the guest address space reserved for boot firmware.
518If
519.Ar varfile
520is provided, that file is also mapped in the boot firmware guest
521address space, and any modifications the guest makes will be saved
522to that file.
523.El
524.Pp
525Fwcfg types:
526.Bl -tag -width 10n
527.It Ar fwcfg
528The fwcfg interface is used to pass information such as the CPU count or ACPI tables to the guest firmware.
529Supported values are
530.Ql bhyve
531and
532.Ql qemu .
533Due to backward compatibility reasons,
534.Ql bhyve
535is the default option.
536When
537.Ql bhyve
538is used, bhyve's fwctl interface is used.
539It currently reports only the CPU count to the guest firmware.
540The
541.Ql qemu
542option uses QEMU's fwcfg interface.
543This interface is widely used and allows user-defined information to be passed to the guest.
544It is used for passing the CPU count, ACPI tables, a boot order and many other things to the guest.
545Some operating systems such as Fedora CoreOS can be configured by qemu's fwcfg interface as well.
546.El
547.Pp
548Pass-through device backends:
549.Sm off
550.Bl -bullet
551.It
552.Cm ppt Ar N Oo , Ar passthru-device-options Oc
553.It
554.Ns Ar bus Cm \&/ Ar slot Cm \&/ Ar function
555.Op , Ar passthru-device-options
556.It
557.Cm pci Ar bus Cm : Ar slot Cm : Ns Ar function
558.Op , Ar passthru-device-options
559.El
560.Sm on
561.Pp
562Connect to a PCI device on the host either named ppt
563.Ns Ar N
564or at the selector described by
565.Ar slot ,
566.Ar bus ,
567and
568.Ar function
569numbers.
570.Pp
571The
572.Ar passthru-device-options
573are:
574.Bl -tag -width 10n
575.It Cm rom= Ns Ar romfile
576Add
577.Ar romfile
578as option ROM to the PCI device.
579The ROM will be loaded by firmware and should be capable of initializing the device.
580.El
581.Pp
582Guest memory must be wired using the
583.Fl S
584option when a pass-through device is configured.
585.Pp
586The host device must have been reserved at boot-time using the
587.Va pptdevs
588loader variable as described in
589.Xr vmm 4 .
590.Pp
591Virtio console device backends:
592.Bl -bullet
593.Sm off
594.It
595.Cm port1= Ns Ar /path/to/port1.sock Ns Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ...
596.Sm on
597.El
598.Pp
599A maximum of 16 ports per device can be created.
600Every port is named and corresponds to a Unix domain socket created by
601.Nm .
602.Nm
603accepts at most one connection per port at a time.
604.Pp
605Limitations:
606.Bl -bullet
607.It
608Due to lack of destructors in
609.Nm ,
610sockets on the filesystem must be cleaned up manually after
611.Nm
612exits.
613.It
614There is no way to use the
615.Dq console port
616feature, nor the console port
617resize at present.
618.It
619Emergency write is advertised, but no-op at present.
620.El
621.Pp
622Virtio input device backends:
623.Bl -tag -width 10n
624.It Ar /dev/input/eventX
625Send input events of
626.Ar /dev/input/eventX
627to guest by VirtIO Input Interface.
628.El
629.Pp
630Framebuffer devices backends:
631.Bl -bullet
632.Sm off
633.It
634.Op Cm rfb= Ar ip-and-port
635.Op Cm ,w= Ar width
636.Op Cm ,h= Ar height
637.Op Cm ,vga= Ar vgaconf
638.Op Cm ,wait
639.Op Cm ,password= Ar password
640.Sm on
641.El
642.Pp
643Configuration options are defined as follows:
644.Bl -tag -width 10n
645.It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port
646An IP address and a port VNC should listen on.
647There are two formats:
648.Pp
649.Bl -bullet -compact
650.It
651.Sm off
652.Op Ar IPv4 Cm \&:
653.Ar port
654.Sm on
655.It
656.Sm off
657.Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port
658.Sm on
659.El
660.Pp
661The default is to listen on localhost IPv4 address and default VNC port 5900.
662An IPv6 address must be enclosed in square brackets and may contain an
663optional zone identifier.
664.It Cm w= Ns Ar width No and Cm h= Ns Ar height
665A display resolution, width and height, respectively.
666If not specified, a default resolution of 1024x768 pixels will be used.
667Minimal supported resolution is 640x480 pixels,
668and maximum is 1920x1200 pixels.
669.It Cm vga= Ns Ar vgaconf
670Possible values for this option are
671.Cm io
672(default),
673.Cm on
674, and
675.Cm off .
676PCI graphics cards have a dual personality in that they are
677standard PCI devices with BAR addressing, but may also
678implicitly decode legacy VGA I/O space
679.Pq Ad 0x3c0-3df
680and memory space
681.Pq 64KB at Ad 0xA0000 .
682The default
683.Cm io
684option should be used for guests that attempt to issue BIOS calls which result
685in I/O port queries, and fail to boot if I/O decode is disabled.
686.Pp
687The
688.Cm on
689option should be used along with the CSM BIOS capability in UEFI
690to boot traditional BIOS guests that require the legacy VGA I/O and
691memory regions to be available.
692.Pp
693The
694.Cm off
695option should be used for the UEFI guests that assume that
696VGA adapter is present if they detect the I/O ports.
697An example of such a guest is
698.Ox
699in UEFI mode.
700.Pp
701Please refer to the
702.Nm
703.Fx
704wiki page
705.Pq Lk https://wiki.freebsd.org/bhyve
706for configuration notes of particular guests.
707.It Cm wait
708Instruct
709.Nm
710to only boot upon the initiation of a VNC connection, simplifying the
711installation of operating systems that require immediate keyboard input.
712This can be removed for post-installation use.
713.It Cm password= Ns Ar password
714This type of authentication is known to be cryptographically weak and is not
715intended for use on untrusted networks.
716Many implementations will want to use stronger security, such as running
717the session over an encrypted channel provided by IPsec or SSH.
718.El
719.Pp
720xHCI USB device backends:
721.Bl -tag -width 10n
722.It Cm tablet
723A USB tablet device which provides precise cursor synchronization
724when using VNC.
725.El
726.Pp
727NVMe device backends:
728.Bl -bullet
729.Sm off
730.It
731.Ar devpath
732.Op Cm ,maxq= Ar #
733.Op Cm ,qsz= Ar #
734.Op Cm ,ioslots= Ar #
735.Op Cm ,sectsz= Ar #
736.Op Cm ,ser= Ar #
737.Op Cm ,eui64= Ar #
738.Op Cm ,dsm= Ar opt
739.Sm on
740.El
741.Pp
742Configuration options are defined as follows:
743.Bl -tag -width 10n
744.It Ar devpath
745Accepted device paths are:
746.Ar /dev/blockdev
747or
748.Ar /path/to/image
749or
750.Cm ram= Ns Ar size_in_MiB .
751.It Cm maxq
752Max number of queues.
753.It Cm qsz
754Max elements in each queue.
755.It Cm ioslots
756Max number of concurrent I/O requests.
757.It Cm sectsz
758Sector size (defaults to blockif sector size).
759.It Cm ser
760Serial number with maximum 20 characters.
761.It Cm eui64
762IEEE Extended Unique Identifier (8 byte value).
763.It Cm dsm
764DataSet Management support.
765Supported values are:
766.Cm auto , enable ,
767and
768.Cm disable .
769.El
770.Pp
771AHCI device backends:
772.Bl -bullet
773.It
774.Sm off
775.Op Oo Cm hd\&: | cd\&: Oc Ar path
776.Op Cm ,nmrr= Ar nmrr
777.Op Cm ,ser= Ar #
778.Op Cm ,rev= Ar #
779.Op Cm ,model= Ar #
780.Sm on
781.El
782.Pp
783Configuration options are defined as follows:
784.Bl -tag -width 10n
785.It Cm nmrr
786Nominal Media Rotation Rate, known as RPM.
787Value 1 will indicate device as Solid State Disk.
788Default value is 0, not report.
789.It Cm ser
790Serial Number with maximum 20 characters.
791.It Cm rev
792Revision Number with maximum 8 characters.
793.It Cm model
794Model Number with maximum 40 characters.
795.El
796.Pp
797HD Audio device backends:
798.Bl -bullet
799.It
800.Sm off
801.Op Cm play= Ar playback
802.Op Cm ,rec= Ar recording
803.Sm on
804.El
805.Pp
806Configuration options are defined as follows:
807.Bl -tag -width 10n
808.It Cm play
809Playback device, typically
810.Ar /dev/dsp0 .
811.It Cm rec
812Recording device, typically
813.Ar /dev/dsp0 .
814.El
815.It Fl U Ar uuid
816Set the universally unique identifier
817.Pq UUID
818in the guest's System Management BIOS System Information structure.
819By default a UUID is generated from the host's hostname and
820.Ar vmname .
821.It Fl u
822RTC keeps UTC time.
823.It Fl W
824Force virtio PCI device emulations to use MSI interrupts instead of MSI-X
825interrupts.
826.It Fl w
827Ignore accesses to unimplemented Model Specific Registers (MSRs).
828This is intended for debug purposes.
829.It Fl x
830The guest's local APIC is configured in x2APIC mode.
831.It Fl Y
832Disable MPtable generation.
833.It Ar vmname
834Alphanumeric name of the guest.
835This should be the same as that created by
836.Xr bhyveload 8 .
837.El
838.Sh CONFIGURATION VARIABLES
839.Nm
840uses an internal tree of configuration variables to describe global and
841per-device settings.
842When
843.Nm
844starts,
845it parses command line options (including config files) in the order given
846on the command line.
847Each command line option sets one or more configuration variables.
848For example,
849the
850.Fl s
851option creates a new tree node for a PCI device and sets one or more variables
852under that node including the device model and device model-specific variables.
853Variables may be set multiple times during this parsing stage with the final
854value overriding previous values.
855.Pp
856Once all of the command line options have been processed,
857the configuration values are frozen.
858.Nm
859then uses the value of configuration values to initialize device models
860and global settings.
861.Pp
862More details on configuration variables can be found in
863.Xr bhyve_config 5 .
864.Sh DEBUG SERVER
865The current debug server provides limited support for debuggers.
866.Ss Registers
867Each virtual CPU is exposed to the debugger as a thread.
868.Pp
869General purpose registers can be queried for each virtual CPU, but other
870registers such as floating-point and system registers cannot be queried.
871.Ss Memory
872Memory (including memory mapped I/O regions) can be read and written by the debugger.
873Memory operations use virtual addresses that are resolved to physical addresses
874via the current virtual CPU's active address translation.
875.Ss Control
876The running guest can be interrupted by the debugger at any time
877.Pq for example, by pressing Ctrl-C in the debugger .
878.Pp
879Single stepping is only supported on Intel CPUs supporting the MTRAP VM exit.
880.Pp
881Breakpoints are supported on Intel CPUs that support single stepping.
882Note that continuing from a breakpoint while interrupts are enabled in the
883guest may not work as expected due to timer interrupts firing while single
884stepping over the breakpoint.
885.Sh SIGNAL HANDLING
886.Nm
887deals with the following signals:
888.Pp
889.Bl -tag -width SIGTERM -compact
890.It SIGTERM
891Trigger ACPI poweroff for a VM
892.El
893.Sh EXIT STATUS
894Exit status indicates how the VM was terminated:
895.Pp
896.Bl -tag -width indent -compact
897.It 0
898rebooted
899.It 1
900powered off
901.It 2
902halted
903.It 3
904triple fault
905.It 4
906exited due to an error
907.El
908.Sh EXAMPLES
909If not using a boot ROM, the guest operating system must have been loaded with
910.Xr bhyveload 8
911or a similar boot loader before
912.Xr bhyve 4
913can be run.
914Otherwise, the boot loader is not needed.
915.Pp
916To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio
917block device backed by the
918.Pa /my/image
919filesystem image, and a serial port for the console:
920.Bd -literal -offset indent
921bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \\
922  -l com1,stdio -A -H -P -m 1G vm1
923.Ed
924.Pp
925Run a 24GB single-CPU virtual machine with three network ports, one of which
926has a MAC address specified:
927.Bd -literal -offset indent
928bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\
929  -s 2:1,virtio-net,tap1 \\
930  -s 2:2,virtio-net,tap2,mac=00:be:fa:76:45:00 \\
931  -s 3,virtio-blk,/my/image -l com1,stdio \\
932  -A -H -P -m 24G bigvm
933.Ed
934.Pp
935Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI
936CD-ROM, a single virtio network port, an AMD hostbridge, and the console
937port connected to an
938.Xr nmdm 4
939null-modem device.
940.Bd -literal -offset indent
941bhyve -c 4 \\
942  -s 0,amd_hostbridge -s 1,lpc \\
943  -s 1:0,ahci,hd:/images/disk.1,hd:/images/disk.2,\\
944hd:/images/disk.3,hd:/images/disk.4,\\
945hd:/images/disk.5,hd:/images/disk.6,\\
946hd:/images/disk.7,hd:/images/disk.8,\\
947cd:/images/install.iso \\
948  -s 3,virtio-net,tap0 \\
949  -l com1,/dev/nmdm0A \\
950  -A -H -P -m 8G
951.Ed
952.Pp
953Run a UEFI virtual machine with a display resolution of 800 by 600 pixels
954that can be accessed via VNC at: 0.0.0.0:5900.
955.Bd -literal -offset indent
956bhyve -c 2 -m 4G -w -H \\
957  -s 0,hostbridge \\
958  -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\
959  -s 4,ahci-hd,disk.img \\
960  -s 5,virtio-net,tap0 \\
961  -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\
962  -s 30,xhci,tablet \\
963  -s 31,lpc -l com1,stdio \\
964  -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
965   uefivm
966.Ed
967.Pp
968Run a UEFI virtual machine with a VNC display that is bound to all IPv6
969addresses on port 5900.
970.Bd -literal -offset indent
971bhyve -c 2 -m 4G -w -H \\
972  -s 0,hostbridge \\
973  -s 4,ahci-hd,disk.img \\
974  -s 5,virtio-net,tap0 \\
975  -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\
976  -s 30,xhci,tablet \\
977  -s 31,lpc -l com1,stdio \\
978  -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
979   uefivm
980.Ed
981.Pp
982Run a UEFI virtual machine with a VARS file to save EFI variables.
983Note that
984.Nm
985will write guest modifications to the given VARS file.
986Be sure to create a per-guest copy of the template VARS file from
987.Pa /usr .
988.Bd -literal -offset indent
989bhyve -c 2 -m 4g -w -H \\
990  -s 0,hostbridge \\
991  -s 31,lpc -p com1,stdio \\
992  -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE.fd,BHYVE_UEFI_VARS.fd
993   uefivm
994.Ed
995.Sh SEE ALSO
996.Xr bhyve 4 ,
997.Xr netgraph 4 ,
998.Xr ng_socket 4 ,
999.Xr nmdm 4 ,
1000.Xr vmm 4 ,
1001.Xr bhyve_config 5 ,
1002.Xr ethers 5 ,
1003.Xr bhyvectl 8 ,
1004.Xr bhyveload 8
1005.Pp
1006.Rs
1007.%A Intel
1008.%B 64 and IA-32 Architectures Software Developer’s Manual
1009.%V Volume 3
1010.Re
1011.Sh HISTORY
1012.Nm
1013first appeared in
1014.Fx 10.0 .
1015.Sh AUTHORS
1016.An Neel Natu Aq Mt neel@freebsd.org
1017.An Peter Grehan Aq Mt grehan@freebsd.org
1018