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