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