xref: /freebsd/usr.sbin/bhyve/bhyve.8 (revision 5f4c09dd85bff675e0ca63c55ea3c517e0fddfcc)
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 October 12, 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.It Fl K Ar layout
200Specify the keyboard layout.
201The value that can be specified sets the file name in
202.Ar /usr/share/bhyve/kbdlayout .
203This specification only works when loaded with UEFI mode for VNC.
204When using a VNC client that supports QEMU Extended Key Event Message (e.g.
205TigerVNC), this option isn't needed.
206When using a VNC client that doesn't support QEMU Extended Key Event Message
207(e.g. tightVNC), the layout defaults to the US keyboard unless specified
208otherwise.
209.Pq Sq = ,
210and a value.
211No spaces are permitted between the variable name, equals sign, or
212value.
213Blank lines and lines starting with
214.Sq #
215are ignored.
216See
217.Xr bhyve_config 5
218for more details.
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.El
430.Sm on
431.Pp
432If
433.Cm mac
434is not specified, the MAC address is derived from a fixed OUI and the
435remaining bytes from an MD5 hash of the slot and function numbers and
436the device name.
437.Pp
438The MAC address is an ASCII string in
439.Xr ethers 5
440format.
441.Pp
442With
443.Cm virtio-net
444devices, the
445.Cm mtu
446parameter can be specified to inform the guest about the largest MTU
447that should be allowed, expressed in bytes.
448.Pp
449With
450.Cm netgraph
451backend, the
452.Cm path
453and
454.Cm peerhook
455parameters must be specified to set the destination node and corresponding hook.
456The optional parameters
457.Cm socket
458and
459.Cm hook
460may be used to set the
461.Xr ng_socket 4
462node name and source hook.
463The
464.Ar ADDRESS ,
465.Ar HOOK ,
466and
467.Ar NAME
468must comply with
469.Xr netgraph 4
470addressing rules.
471.Pp
472Block storage device backends:
473.Sm off
474.Bl -bullet
475.It
476.Ar /filename Op Cm \&, Ar block-device-options
477.It
478.Ar /dev/xxx Op Cm \&, Ar block-device-options
479.El
480.Sm on
481.Pp
482The
483.Ar block-device-options
484are:
485.Bl -tag -width 10n
486.It Cm nocache
487Open the file with
488.Dv O_DIRECT .
489.It Cm direct
490Open the file using
491.Dv O_SYNC .
492.It Cm ro
493Force the file to be opened read-only.
494.It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc
495Specify the logical and physical sector sizes of the emulated disk.
496The physical sector size is optional and is equal to the logical sector size
497if not explicitly specified.
498.It Cm nodelete
499Disable emulation of guest trim requests via
500.Dv DIOCGDELETE
501requests.
502.It Li bootindex= Ns Ar index
503Add the device to the bootorder at
504.Ar index .
505A fwcfg file is used to specify the bootorder.
506The guest firmware may ignore or doesn't support this fwcfg file.
507In that case, this feature doesn't work as expected.
508.El
509.Pp
510SCSI device backends:
511.Sm off
512.Bl -bullet
513.It
514.Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc
515.El
516.Sm on
517.Pp
518The
519.Ar scsi-device-options
520are:
521.Bl -tag -width 10n
522.It Cm iid= Ns Ar IID
523Initiator ID to use when sending requests to specified CTL port.
524The default value is 0.
525.It Li bootindex= Ns Ar index
526Add the device to the bootorder at
527.Ar index .
528A fwcfg file is used to specify the bootorder.
529The guest firmware may ignore or doesn't support this fwcfg file.
530In that case, this feature doesn't work as expected.
531.El
532.Pp
5339P device backends:
534.Sm off
535.Bl -bullet
536.It
537.Ar sharename Cm = Ar /path/to/share Op Cm \&, Ar 9p-device-options
538.El
539.Sm on
540.Pp
541The
542.Ar 9p-device-options
543are:
544.Bl -tag -width 10n
545.It Cm ro
546Expose the share in read-only mode.
547.El
548.Pp
549TTY device backends:
550.Bl -tag -width 10n
551.It Cm stdio
552Connect the serial port to the standard input and output of
553the
554.Nm
555process.
556.It Ar /dev/xxx
557Use the host TTY device for serial port I/O.
558.El
559.Pp
560TPM device backends:
561.Bl -tag -width 10n
562.It Ar type Ns \&, Ns Ar path Ns Op Cm \&, Ns Ar tpm-device-options
563Emulate a TPM device.
564.El
565.Pp
566The
567.Ar tpm-device-options
568are:
569.Bl -tag -width 10n
570.It Cm version= Ns Ar version
571Version of the TPM device according to the TCG specification.
572Defaults to
573.Cm 2.0
574.El
575.Pp
576Boot ROM device backends:
577.Bl -tag -width 10n
578.It Ar romfile Ns Op Cm \&, Ns Ar varfile
579Map
580.Ar romfile
581in the guest address space reserved for boot firmware.
582If
583.Ar varfile
584is provided, that file is also mapped in the boot firmware guest
585address space, and any modifications the guest makes will be saved
586to that file.
587.El
588.Pp
589Fwcfg types:
590.Bl -tag -width 10n
591.It Ar fwcfg
592The fwcfg interface is used to pass information such as the CPU count
593or ACPI tables to the guest firmware.
594Supported values are
595.Ql bhyve
596and
597.Ql qemu .
598Due to backward compatibility reasons,
599.Ql bhyve
600is the default option.
601When
602.Ql bhyve
603is used, bhyve's fwctl interface is used.
604It currently reports only the CPU count to the guest firmware.
605The
606.Ql qemu
607option uses QEMU's fwcfg interface.
608This interface is widely used and allows user-defined information to
609be passed to the guest.
610It is used for passing the CPU count, ACPI tables, a boot order and
611many other things to the guest.
612Some operating systems such as Fedora CoreOS can be configured by
613qemu's fwcfg interface as well.
614.El
615.Pp
616Pass-through device backends:
617.Sm off
618.Bl -bullet
619.It
620.Cm ppt Ar N Oo , Ar passthru-device-options Oc
621.It
622.Ns Ar bus Cm \&/ Ar slot Cm \&/ Ar function
623.Op , Ar passthru-device-options
624.It
625.Cm pci Ar bus Cm : Ar slot Cm : Ns Ar function
626.Op , Ar passthru-device-options
627.El
628.Sm on
629.Pp
630Connect to a PCI device on the host either named ppt
631.Ns Ar N
632or at the selector described by
633.Ar slot ,
634.Ar bus ,
635and
636.Ar function
637numbers.
638.Pp
639The
640.Ar passthru-device-options
641are:
642.Bl -tag -width 10n
643.It Cm rom= Ns Ar romfile
644Add
645.Ar romfile
646as option ROM to the PCI device.
647The ROM will be loaded by firmware and should be capable of
648initializing the device.
649.It Li bootindex= Ns Ar index
650Add the device to the bootorder at
651.Ar index .
652A fwcfg file is used to specify the bootorder.
653The guest firmware may ignore or doesn't support this fwcfg file.
654In that case, this feature doesn't work as expected.
655.El
656.Pp
657Guest memory must be wired using the
658.Fl S
659option when a pass-through device is configured.
660.Pp
661The host device must have been reserved at boot-time using the
662.Va pptdevs
663loader variable as described in
664.Xr vmm 4 .
665.Pp
666TPM devices:
667.Bl -tag -width 10n
668.It Ns Ar type
669Specifies the type of the TPM device.
670.Pp
671Supported types:
672.Bl -tag -width 10n
673.It Cm passthru
674.El
675.It Cm version= Ns Ar version
676The
677.Ar version
678of the emulated TPM device according to the TCG specification.
679.Pp
680Supported versions:
681.Bl -tag -width 10n
682.It Cm 2.0
683.El
684.El
685.Pp
686Virtio console device backends:
687.Bl -bullet
688.Sm off
689.It
690.Cm port1= Ns Ar /path/to/port1.sock Ns Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ...
691.Sm on
692.El
693.Pp
694A maximum of 16 ports per device can be created.
695Every port is named and corresponds to a Unix domain socket created by
696.Nm .
697.Nm
698accepts at most one connection per port at a time.
699.Pp
700Limitations:
701.Bl -bullet
702.It
703Due to lack of destructors in
704.Nm ,
705sockets on the filesystem must be cleaned up manually after
706.Nm
707exits.
708.It
709There is no way to use the
710.Dq console port
711feature, nor the console port
712resize at present.
713.It
714Emergency write is advertised, but no-op at present.
715.El
716.Pp
717Virtio input device backends:
718.Bl -tag -width 10n
719.It Ar /dev/input/eventX
720Send input events of
721.Ar /dev/input/eventX
722to guest by VirtIO Input Interface.
723.El
724.Pp
725Framebuffer devices backends:
726.Bl -bullet
727.Sm off
728.It
729.Op Cm rfb= Ar ip-and-port
730.Op Cm ,w= Ar width
731.Op Cm ,h= Ar height
732.Op Cm ,vga= Ar vgaconf
733.Op Cm ,wait
734.Op Cm ,password= Ar password
735.Sm on
736.El
737.Pp
738Configuration options are defined as follows:
739.Bl -tag -width 10n
740.It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port
741An IP address and a port VNC should listen on.
742There are two formats:
743.Pp
744.Bl -bullet -compact
745.It
746.Sm off
747.Op Ar IPv4 Cm \&:
748.Ar port
749.Sm on
750.It
751.Sm off
752.Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port
753.Sm on
754.El
755.Pp
756The default is to listen on localhost IPv4 address and default VNC port 5900.
757An IPv6 address must be enclosed in square brackets and may contain an
758optional zone identifier.
759.It Cm w= Ns Ar width No and Cm h= Ns Ar height
760A display resolution, width and height, respectively.
761If not specified, a default resolution of 1024x768 pixels will be used.
762Minimal supported resolution is 640x480 pixels,
763and maximum is 1920x1200 pixels.
764.It Cm vga= Ns Ar vgaconf
765Possible values for this option are
766.Cm io
767(default),
768.Cm on
769, and
770.Cm off .
771PCI graphics cards have a dual personality in that they are
772standard PCI devices with BAR addressing, but may also
773implicitly decode legacy VGA I/O space
774.Pq Ad 0x3c0-3df
775and memory space
776.Pq 64KB at Ad 0xA0000 .
777The default
778.Cm io
779option should be used for guests that attempt to issue BIOS calls which result
780in I/O port queries, and fail to boot if I/O decode is disabled.
781.Pp
782The
783.Cm on
784option should be used along with the CSM BIOS capability in UEFI
785to boot traditional BIOS guests that require the legacy VGA I/O and
786memory regions to be available.
787.Pp
788The
789.Cm off
790option should be used for the UEFI guests that assume that
791VGA adapter is present if they detect the I/O ports.
792An example of such a guest is
793.Ox
794in UEFI mode.
795.Pp
796Please refer to the
797.Nm
798.Fx
799wiki page
800.Pq Lk https://wiki.freebsd.org/bhyve
801for configuration notes of particular guests.
802.It Cm wait
803Instruct
804.Nm
805to only boot upon the initiation of a VNC connection, simplifying the
806installation of operating systems that require immediate keyboard input.
807This can be removed for post-installation use.
808.It Cm password= Ns Ar password
809This type of authentication is known to be cryptographically weak and is not
810intended for use on untrusted networks.
811Many implementations will want to use stronger security, such as running
812the session over an encrypted channel provided by IPsec or SSH.
813.El
814.Pp
815xHCI USB device backends:
816.Bl -tag -width 10n
817.It Cm tablet
818A USB tablet device which provides precise cursor synchronization
819when using VNC.
820.El
821.Pp
822NVMe device backends:
823.Bl -bullet
824.Sm off
825.It
826.Ar devpath
827.Op Cm ,maxq= Ar #
828.Op Cm ,qsz= Ar #
829.Op Cm ,ioslots= Ar #
830.Op Cm ,sectsz= Ar #
831.Op Cm ,ser= Ar #
832.Op Cm ,eui64= Ar #
833.Op Cm ,dsm= Ar opt
834.Sm on
835.El
836.Pp
837Configuration options are defined as follows:
838.Bl -tag -width 10n
839.It Ar devpath
840Accepted device paths are:
841.Ar /dev/blockdev
842or
843.Ar /path/to/image
844or
845.Cm ram= Ns Ar size_in_MiB .
846.It Cm maxq
847Max number of queues.
848.It Cm qsz
849Max elements in each queue.
850.It Cm ioslots
851Max number of concurrent I/O requests.
852.It Cm sectsz
853Sector size (defaults to blockif sector size).
854.It Cm ser
855Serial number with maximum 20 characters.
856.It Cm eui64
857IEEE Extended Unique Identifier (8 byte value).
858.It Cm dsm
859DataSet Management support.
860Supported values are:
861.Cm auto , enable ,
862and
863.Cm disable .
864.El
865.Pp
866AHCI device backends:
867.Bl -bullet
868.It
869.Sm off
870.Op Oo Cm hd\&: | cd\&: Oc Ar path
871.Op Cm ,nmrr= Ar nmrr
872.Op Cm ,ser= Ar #
873.Op Cm ,rev= Ar #
874.Op Cm ,model= Ar #
875.Sm on
876.El
877.Pp
878Configuration options are defined as follows:
879.Bl -tag -width 10n
880.It Cm nmrr
881Nominal Media Rotation Rate, known as RPM.
882Value 1 will indicate device as Solid State Disk.
883Default value is 0, not report.
884.It Cm ser
885Serial Number with maximum 20 characters.
886.It Cm rev
887Revision Number with maximum 8 characters.
888.It Cm model
889Model Number with maximum 40 characters.
890.El
891.Pp
892HD Audio device backends:
893.Bl -bullet
894.It
895.Sm off
896.Op Cm play= Ar playback
897.Op Cm ,rec= Ar recording
898.Sm on
899.El
900.Pp
901Configuration options are defined as follows:
902.Bl -tag -width 10n
903.It Cm play
904Playback device, typically
905.Ar /dev/dsp0 .
906.It Cm rec
907Recording device, typically
908.Ar /dev/dsp0 .
909.El
910.It Fl U Ar uuid
911Set the universally unique identifier
912.Pq UUID
913in the guest's System Management BIOS System Information structure.
914By default a UUID is generated from the host's hostname and
915.Ar vmname .
916.It Fl u
917RTC keeps UTC time.
918.It Fl W
919Force virtio PCI device emulations to use MSI interrupts instead of MSI-X
920interrupts.
921.It Fl w
922Ignore accesses to unimplemented Model Specific Registers (MSRs).
923This is intended for debug purposes.
924.It Fl x
925The guest's local APIC is configured in x2APIC mode.
926.It Fl Y
927Disable MPtable generation.
928.It Ar vmname
929Alphanumeric name of the guest.
930This should be the same as that created by
931.Xr bhyveload 8 .
932.El
933.Sh CONFIGURATION VARIABLES
934.Nm
935uses an internal tree of configuration variables to describe global and
936per-device settings.
937When
938.Nm
939starts,
940it parses command line options (including config files) in the order given
941on the command line.
942Each command line option sets one or more configuration variables.
943For example,
944the
945.Fl s
946option creates a new tree node for a PCI device and sets one or more variables
947under that node including the device model and device model-specific variables.
948Variables may be set multiple times during this parsing stage with the final
949value overriding previous values.
950.Pp
951Once all of the command line options have been processed,
952the configuration values are frozen.
953.Nm
954then uses the value of configuration values to initialize device models
955and global settings.
956.Pp
957More details on configuration variables can be found in
958.Xr bhyve_config 5 .
959.Sh DEBUG SERVER
960The current debug server provides limited support for debuggers.
961.Ss Registers
962Each virtual CPU is exposed to the debugger as a thread.
963.Pp
964General purpose registers can be queried for each virtual CPU, but other
965registers such as floating-point and system registers cannot be queried.
966.Ss Memory
967Memory (including memory mapped I/O regions) can be read and written
968by the debugger.
969Memory operations use virtual addresses that are resolved to physical
970addresses via the current virtual CPU's active address translation.
971.Ss Control
972The running guest can be interrupted by the debugger at any time
973.Pq for example, by pressing Ctrl-C in the debugger .
974.Pp
975Single stepping is only supported on Intel CPUs supporting the MTRAP VM exit.
976.Pp
977Breakpoints are supported on Intel CPUs that support single stepping.
978Note that continuing from a breakpoint while interrupts are enabled in the
979guest may not work as expected due to timer interrupts firing while single
980stepping over the breakpoint.
981.Sh SIGNAL HANDLING
982.Nm
983deals with the following signals:
984.Pp
985.Bl -tag -width SIGTERM -compact
986.It SIGTERM
987Trigger ACPI poweroff for a VM
988.El
989.Sh EXIT STATUS
990Exit status indicates how the VM was terminated:
991.Pp
992.Bl -tag -width indent -compact
993.It 0
994rebooted
995.It 1
996powered off
997.It 2
998halted
999.It 3
1000triple fault
1001.It 4
1002exited due to an error
1003.El
1004.Sh EXAMPLES
1005If not using a boot ROM, the guest operating system must have been loaded with
1006.Xr bhyveload 8
1007or a similar boot loader before
1008.Xr bhyve 4
1009can be run.
1010Otherwise, the boot loader is not needed.
1011.Pp
1012To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio
1013block device backed by the
1014.Pa /my/image
1015filesystem image, and a serial port for the console:
1016.Bd -literal -offset indent
1017bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \\
1018  -l com1,stdio -A -H -P -m 1G vm1
1019.Ed
1020.Pp
1021Run a 24GB single-CPU virtual machine with three network ports, one of which
1022has a MAC address specified:
1023.Bd -literal -offset indent
1024bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\
1025  -s 2:1,virtio-net,tap1 \\
1026  -s 2:2,virtio-net,tap2,mac=00:be:fa:76:45:00 \\
1027  -s 3,virtio-blk,/my/image -l com1,stdio \\
1028  -A -H -P -m 24G bigvm
1029.Ed
1030.Pp
1031Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI
1032CD-ROM, a single virtio network port, an AMD hostbridge, and the console
1033port connected to an
1034.Xr nmdm 4
1035null-modem device.
1036.Bd -literal -offset indent
1037bhyve -c 4 \\
1038  -s 0,amd_hostbridge -s 1,lpc \\
1039  -s 1:0,ahci,hd:/images/disk.1,hd:/images/disk.2,\\
1040hd:/images/disk.3,hd:/images/disk.4,\\
1041hd:/images/disk.5,hd:/images/disk.6,\\
1042hd:/images/disk.7,hd:/images/disk.8,\\
1043cd:/images/install.iso \\
1044  -s 3,virtio-net,tap0 \\
1045  -l com1,/dev/nmdm0A \\
1046  -A -H -P -m 8G
1047.Ed
1048.Pp
1049Run a UEFI virtual machine with a display resolution of 800 by 600 pixels
1050that can be accessed via VNC at: 0.0.0.0:5900.
1051.Bd -literal -offset indent
1052bhyve -c 2 -m 4G -w -H \\
1053  -s 0,hostbridge \\
1054  -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\
1055  -s 4,ahci-hd,disk.img \\
1056  -s 5,virtio-net,tap0 \\
1057  -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\
1058  -s 30,xhci,tablet \\
1059  -s 31,lpc -l com1,stdio \\
1060  -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
1061   uefivm
1062.Ed
1063.Pp
1064Run a UEFI virtual machine with a VNC display that is bound to all IPv6
1065addresses on port 5900.
1066.Bd -literal -offset indent
1067bhyve -c 2 -m 4G -w -H \\
1068  -s 0,hostbridge \\
1069  -s 4,ahci-hd,disk.img \\
1070  -s 5,virtio-net,tap0 \\
1071  -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\
1072  -s 30,xhci,tablet \\
1073  -s 31,lpc -l com1,stdio \\
1074  -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\
1075   uefivm
1076.Ed
1077.Pp
1078Run a UEFI virtual machine with a VARS file to save EFI variables.
1079Note that
1080.Nm
1081will write guest modifications to the given VARS file.
1082Be sure to create a per-guest copy of the template VARS file from
1083.Pa /usr .
1084.Bd -literal -offset indent
1085bhyve -c 2 -m 4g -w -H \\
1086  -s 0,hostbridge \\
1087  -s 31,lpc -l com1,stdio \\
1088  -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE.fd,BHYVE_UEFI_VARS.fd
1089   uefivm
1090.Ed
1091.Sh SEE ALSO
1092.Xr bhyve 4 ,
1093.Xr netgraph 4 ,
1094.Xr ng_socket 4 ,
1095.Xr nmdm 4 ,
1096.Xr vmm 4 ,
1097.Xr bhyve_config 5 ,
1098.Xr ethers 5 ,
1099.Xr bhyvectl 8 ,
1100.Xr bhyveload 8
1101.Pp
1102.Rs
1103.%A Intel
1104.%B 64 and IA-32 Architectures Software Developer’s Manual
1105.%V Volume 3
1106.Re
1107.Sh HISTORY
1108.Nm
1109first appeared in
1110.Fx 10.0 .
1111.Sh AUTHORS
1112.An Neel Natu Aq Mt neel@freebsd.org
1113.An Peter Grehan Aq Mt grehan@freebsd.org
1114