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