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