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