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