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