xref: /illumos-gate/usr/src/man/man8/bhyve.8 (revision 5d9d9091f564c198a760790b0bfa72c44e17912b)
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.\" Portions Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
26.\"
27.Dd June 1, 2022
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 aCDdeHhPSuWwxY
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
49.Sm off
50.Fl G\~
51.Oo Ar w Oc
52.Oo Ar bind_address Cm \&: Oc
53.Ar port
54.Oc
55.Sm on
56.Oo Fl B
57.Sm off
58.Ar type Ns \&,
59.Op Ar key Ns = Ns Ar value
60.Oo \&, Ns Ar key Ns = Ns Ar value Ns Oc \&...
61.Oc
62.Sm on
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 | k | M | m | G | g | T | t
75.Oc
76.Sm on
77.Oc
78.Op Fl o Ar var Ns Cm = Ns Ar value
79.Op Fl r Ar file
80.Sm off
81.Oo Fl s\~
82.Ar slot Cm \&, Ar emulation Op Cm \&, Ar conf
83.Sm on
84.Oc
85.Op Fl U Ar uuid
86.Ar vmname
87.Nm
88.Fl l Cm help
89.Nm
90.Fl s Cm help
91.Sh DESCRIPTION
92.Nm
93is a hypervisor that runs guest operating systems inside a
94virtual machine.
95.Pp
96Parameters such as the number of virtual CPUs, amount of guest memory, and
97I/O connectivity can be specified with command-line parameters.
98.Pp
99.Nm
100runs until the guest operating system reboots or an unhandled hypervisor
101exit is detected.
102.Sh OPTIONS
103.Bl -tag -width 10n
104.It Fl a
105The guest's local APIC is configured in xAPIC mode.
106The xAPIC mode is the default setting so this option is redundant.
107It will be deprecated in a future version.
108.It Xo
109.Fl B
110.Sm off
111.Ar type Ns \&,
112.Op Ar key Ns = Ns Ar value
113.Oo \&, Ns Ar key Ns = Ns Ar value Ns Oc \&...
114.Sm on
115.Xc
116Configure smbios data.
117.Ar type
118must be set to one of
119.Cm 0 , 1 , 2
120or
121.Cm 3 .
122Supported keys for each type are:
123.Bl -tag -width XXX -offset XXX
124.It Cm 0
125.Cm vendor , version , release_date .
126.It Cm 1
127.Cm manufacturer ,
128.Cm product_name Pq or Cm product ,
129.Cm version ,
130.Cm serial_number Pq or Cm serial ,
131.Cm sku ,
132.Cm family_name Pq or Cm family ,
133.Cm uuid .
134.It Cm 2
135.Cm manufacturer , product_name , version , serial_number , asset_tag ,
136.Cm location
137.It Ic 3
138.Cm manufacturer , version , serial_number , asset_tag, sku .
139.El
140.It Xo Fl c
141.Sm off
142.Op Oo Cm cpus= Oc Ar numcpus
143.Op Cm ,sockets= Ar n
144.Op Cm ,cores= Ar n
145.Op Cm ,threads= Ar n
146.Xc
147.Sm on
148Number of guest virtual CPUs
149and/or the CPU topology.
150The default value for each of
151.Ar numcpus ,
152.Ar sockets ,
153.Ar cores ,
154and
155.Ar threads
156is 1.
157The current maximum number of guest virtual CPUs is 32.
158If
159.Ar numcpus
160is not specified then it will be calculated from the other arguments.
161The topology must be consistent in that the
162.Ar numcpus
163must equal the product of
164.Ar sockets ,
165.Ar cores ,
166and
167.Ar threads .
168If a
169.Ar setting
170is specified more than once the last one has precedence.
171.It Fl C
172Include guest memory in core file.
173.It Fl D
174Destroy the VM on guest initiated power-off.
175.It Fl d
176Suspend CPUs at boot.
177.It Fl e
178Force
179.Nm
180to exit when a guest issues an access to an I/O port that is not emulated.
181This is intended for debug purposes.
182.It Fl G Xo
183.Sm off
184.Oo Ar w Oc
185.Oo Ar bind_address Cm \&: Oc
186.Ar port
187.Sm on
188.Xc
189Start a debug server that uses the GDB protocol to export guest state to a
190debugger.
191An IPv4 TCP socket will be bound to the supplied
192.Ar bind_address
193and
194.Ar port
195to listen for debugger connections.
196Only a single debugger may be attached to the debug server at a time.
197If the option begins with
198.Sq w ,
199.Nm
200will pause execution at the first instruction waiting for a debugger to attach.
201.It Fl H
202Yield the virtual CPU thread when a HLT instruction is detected.
203If this option is not specified, virtual CPUs will use 100% of a host CPU.
204.It Fl h
205Print help message and exit.
206.It Fl k Ar config_file
207Set configuration variables from a simple, key-value config file.
208Each line of the config file is expected to consist of a config variable
209name, an equals sign
210.Pq Sq = ,
211and a value.
212No spaces are permitted between the variable name, equals sign, or
213value.
214Blank lines and lines starting with
215.Sq #
216are ignored.
217See
218.Xr bhyve_config 5
219for more details.
220.It Fl K Ar layout
221Specify the keyboard layout.
222The value that can be specified sets the file name in
223.Pa /usr/share/bhyve/kbdlayout .
224This specification only works when loaded with UEFI mode for VNC.
225When using a VNC client that supports QEMU Extended Key Event Message
226.Pq e.g. TigerVNC ,
227this option isn't needed.
228When using a VNC client that doesn't support QEMU Extended Key Event Message
229.Pq e.g. tightVNC ,
230the layout defaults to the US keyboard unless specified otherwise.
231.It Fl l Cm help
232Print a list of supported LPC devices.
233.It Fl l Ar lpcdev Ns Op \&, Ns Ar conf
234Allow devices behind the LPC PCI-ISA bridge to be configured.
235The only supported devices are the TTY-class devices
236.Cm com1 , com2 , com3
237and
238.Cm com4 ,
239the boot ROM device
240.Cm bootrom ,
241and the debug/test device
242.Cm pc-testdev .
243.Pp
244The possible values for the
245.Ar conf
246argument are listed in the
247.Fl s
248flag description.
249.It Xo
250.Fl m Ar memsize Ns Oo
251.Sm off
252.Cm K | k | M | m | G | g | T | t
253.Sm on
254.Oc
255.Xc
256Set the guest physical memory size.
257The size argument may be suffixed with one of
258.Cm K , M , G
259or
260.Cm T
261.Pq either upper or lower case
262to indicate a multiple of kibibytes, mebibytes, gibibytes, or tebibytes.
263If no suffix is given, the value is assumed to be in mebibytes.
264.Pp
265The default is 256MiB.
266.It Fl o Ar var Ns Cm = Ns Ar value
267Set the configuration variable
268.Ar var
269to
270.Ar value .
271.It Fl P
272Force the guest virtual CPU to exit when a PAUSE instruction is detected.
273.It Fl S
274Wire guest memory.
275.It Fl s Cm help
276Print a list of supported PCI devices.
277.It Fl s Ar slot Ns Cm \&, Ns Ar emulation Ns Op Cm \&, Ns Ar conf
278Configure a virtual PCI slot and function.
279.Pp
280.Nm
281provides PCI bus emulation and virtual devices that can be attached to
282slots on the bus.
283There are 32 available slots, with the option of providing up to 8 functions
284per slot.
285.Pp
286The
287.Ar slot
288can be specified in one of the following formats:
289.Pp
290.Bl -bullet -compact
291.It
292.Ar pcislot
293.It
294.Sm off
295.Ar pcislot Cm \&: Ar function
296.Sm on
297.It
298.Sm off
299.Ar bus Cm \&: Ar pcislot Cm \&: Ar function
300.Sm on
301.El
302.Pp
303The
304.Ar pcislot
305value is 0 to 31.
306The optional
307.Ar function
308value is 0 to 7.
309The optional
310.Ar bus
311value is 0 to 255.
312If not specified, the
313.Ar function
314value defaults to 0.
315If not specified, the
316.Ar bus
317value defaults to 0.
318.Pp
319The
320.Ar emulation
321argument can be one of the following:
322.Bl -tag -width "amd_hostbridge"
323.It Cm hostbridge
324A simple host bridge.
325This is usually configured at slot 0, and is required by most guest
326operating systems.
327.It Cm amd_hostbridge
328Emulation identical to
329.Cm hostbridge
330but using a PCI vendor ID of AMD.
331.It Cm passthru
332PCI pass-through device.
333.It Cm virtio-net-viona
334Accelerated Virtio network interface.
335.It Cm virtio-net
336Legacy Virtio network interface.
337.It Cm virtio-blk
338Virtio block storage interface.
339.It Cm virtio-9p
340Virtio 9p (VirtFS) interface.
341.It Cm virtio-rnd
342Virtio random number generator interface.
343.It Cm virtio-console
344Virtio console interface, which exposes multiple ports
345to the guest in the form of simple char devices for simple IO
346between the guest and host userspaces.
347.It Cm ahci
348AHCI controller attached to arbitrary devices.
349.It Cm ahci-cd
350AHCI controller attached to an ATAPI CD/DVD.
351.It Cm ahci-hd
352AHCI controller attached to a SATA hard drive.
353.It Cm e1000
354Intel e82545 network interface.
355.It Cm uart
356PCI 16550 serial device.
357.It Cm lpc
358LPC PCI-ISA bridge with COM1, COM2, COM3, and COM4 16550 serial ports,
359a boot ROM, and, optionally, the debug/test device.
360The LPC bridge emulation can only be configured on bus 0.
361.It Cm fbuf
362Raw framebuffer device attached to VNC server.
363.It Cm xhci
364eXtensible Host Controller Interface (xHCI) USB controller.
365.It Cm nvme
366NVM Express (NVMe) controller.
367.El
368.Pp
369The optional parameter
370.Ar conf
371describes the backend for device emulations.
372If
373.Ar conf
374is not specified, the device emulation has no backend and can be
375considered unconnected.
376.Pp
377.Sy Host Bridge Devices
378.Bl -tag -width 10n
379.It Cm model Ns = Ns Ar model
380Specify a hostbridge model to emulate.
381Valid model strings, and their associated vendor and device IDs are:
382.Sy amd Pq 0x1022/0x7432 ,
383.Sy netapp Pq 0x1275/0x1275 ,
384.Sy i440fx Pq 0x8086/0x1237
385and
386.Sy q35 Pq 0x8086/0x29b0 .
387The default value of
388.Ar model
389is
390.Cm netapp .
391.It Cm vendor Ns = Ns Ar vendor
392PCI vendor ID.
393.It Cm devid Ns = Ns Ar devid
394PCI device ID.
395.El
396.Pp
397Providing extra configuration parameters for a host bridge is optional, but if
398parameters are provided then either
399.Va model
400by itself, or both of
401.Va vendor
402and
403.Va devid
404must be specified.
405.Pp
406.Sy Accelerated Virtio Network Backends :
407.Bl -tag -width 10n
408.It Oo Cm vnic Ns = Oc Ns Ar vnic Ns Oo , Ns Cm feature_mask Ns = Ns Ar mask Oc
409.Pp
410.Ar vnic
411is the name of a configured virtual NIC on the system.
412.Ar mask
413is applied to the virtio feature flags which are advertised to the guest.
414Bits set in the
415.Ar mask
416value are removed from the advertised features.
417.El
418.Pp
419.Sy Other Network Backends :
420.Bl -tag -width 10n
421.It Oo Cm vnic Ns = Oc Ns Ar vnic Ns Oo , Ns Ar network-backend-options Oc
422.Pp
423.Ar vnic
424is the name of a configured virtual NIC on the system.
425.El
426.Pp
427The
428.Ar network-backend-options
429are:
430.Bl -tag -width 8n
431.It Cm promiscphys
432Enable promiscuous mode at the physical level (default: false)
433.It Cm promiscsap
434Enable promiscuous mode at the SAP level (default: true)
435.It Cm promiscmulti
436Enable promiscuous mode for all multicast addresses (default: true)
437.It Cm promiscrxonly
438The selected promiscuous modes are only enabled for received traffic
439(default: true).
440.El
441.Pp
442.Sy Block storage device backends :
443.Sm off
444.Bl -bullet
445.It
446.Pa /filename Op Cm \&, Ar block-device-options
447.It
448.Pa /dev/xxx Op Cm \&, Ar block-device-options
449.El
450.Sm on
451.Pp
452The
453.Ar block-device-options
454are:
455.Bl -tag -width 10n
456.It Cm nocache
457Open the file with
458.Dv O_DIRECT .
459.It Cm direct
460Open the file using
461.Dv O_SYNC .
462.It Cm ro
463Force the file to be opened read-only.
464.It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc
465Specify the logical and physical sector sizes of the emulated disk.
466The physical sector size is optional and is equal to the logical sector size
467if not explicitly specified.
468.It Cm nodelete
469Disable emulation of guest trim requests via
470.Dv DIOCGDELETE
471requests.
472.El
473.Pp
474.Sy 9P device backends :
475.Sm off
476.Bl -bullet
477.It
478.Ar sharename Cm = Ar /path/to/share Op Cm \&, Ar 9p-device-options
479.El
480.Sm on
481.Pp
482The
483.Ar 9p-device-options
484are:
485.Bl -tag -width 10n
486.It Cm ro
487Expose the share in read-only mode.
488.El
489.Pp
490.Sy TTY device backends :
491.Bl -tag -width 10n
492.It Cm stdio
493Connect the serial port to the standard input and output of
494the
495.Nm
496process.
497.It Pa /dev/xxx
498Use the host TTY device for serial port I/O.
499.El
500.Pp
501.Sy Boot ROM device backends :
502.Bl -tag -width 10n
503.It Pa romfile Ns Op Cm \&, Ns Ar varfile
504Map
505.Ar romfile
506in the guest address space reserved for boot firmware.
507If
508.Ar varfile
509is provided, that file is also mapped in the boot firmware guest
510address space, and any modifications the guest makes will be saved
511to that file.
512.El
513.Pp
514.Sy Pass-through device backends :
515.Bl -tag -width 10n
516.It Pa /dev/ppt Ns Ar N
517Connect to a PCI device on the host identified by the specified path.
518.It Cm rom= Ns Ar romfile
519Add
520.Ar romfile
521as option ROM to the PCI device.
522The ROM will be loaded by firmware and should be capable of initialising the
523device.
524.El
525.Pp
526Guest memory must be wired using the
527.Fl S
528option when a pass-through device is configured.
529.Pp
530The host device must have been previously attached to the
531.Sy ppt
532driver.
533.Pp
534.Sy Virtio console device backends :
535.Bl -bullet
536.Sm off
537.It
538.Cm port1= Ns Ar /path/to/port1.sock Ns
539.Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ...
540.Sm on
541.El
542.Pp
543A maximum of 16 ports per device can be created.
544Every port is named and corresponds to a UNIX domain socket created by
545.Nm .
546.Nm
547accepts at most one connection per port at a time.
548.Pp
549Limitations:
550.Bl -bullet
551.It
552Due to lack of destructors in
553.Nm ,
554sockets on the filesystem must be cleaned up manually after
555.Nm
556exits.
557.It
558There is no way to use the
559.Dq console port
560feature, nor the console port resize at present.
561.It
562Emergency write is advertised, but no-op at present.
563.El
564.Pp
565.Sy Framebuffer device backends :
566.Bl -bullet
567.Sm off
568.It
569.Op Cm rfb= Ar ip-and-port
570.Op Cm ,w= Ar width
571.Op Cm ,h= Ar height
572.Op Cm ,vga= Ar vgaconf
573.Op Cm ,wait
574.Op Cm ,password= Ar password
575.Sm on
576.El
577.Pp
578Configuration options are defined as follows:
579.Bl -tag -width 10n
580.It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port
581An IP address and a port VNC should listen on.
582There are two formats:
583.Pp
584.Bl -bullet -compact
585.It
586.Sm off
587.Op Ar IPv4 Cm \&:
588.Ar port
589.Sm on
590.It
591.Sm off
592.Cm \&[ Ar IPv6 Cm \&] Cm \&: Ar port
593.Sm on
594.El
595.Pp
596The default is to listen on localhost IPv4 address and default VNC port 5900.
597An IPv6 address must be enclosed in square brackets.
598.It Cm unix Ns = Ns Ar path
599The path to a UNIX socket which will be created and where
600.Nm
601will accept VNC connections.
602.It Cm w= Ns Ar width No and Cm h= Ns Ar height
603A display resolution, width and height, respectively.
604If not specified, a default resolution of 1024x768 pixels will be used.
605Minimal supported resolution is 640x480 pixels,
606and maximum is 1920x1200 pixels.
607.It Cm vga= Ns Ar vgaconf
608Possible values for this option are
609.Cm io
610(default),
611.Cm on
612, and
613.Cm off .
614PCI graphics cards have a dual personality in that they are
615standard PCI devices with BAR addressing, but may also
616implicitly decode legacy VGA I/O space
617.Pq Ad 0x3c0-3df
618and memory space
619.Pq 64KB at Ad 0xA0000 .
620The default
621.Cm io
622option should be used for guests that attempt to issue BIOS calls which result
623in I/O port queries, and fail to boot if I/O decode is disabled.
624.Pp
625The
626.Cm on
627option should be used along with the CSM BIOS capability in UEFI
628to boot traditional BIOS guests that require the legacy VGA I/O and
629memory regions to be available.
630.Pp
631The
632.Cm off
633option should be used for the UEFI guests that assume that
634VGA adapter is present if they detect the I/O ports.
635An example of such a guest is
636.Ox
637in UEFI mode.
638.It Cm wait
639Instruct
640.Nm
641to only boot upon the initiation of a VNC connection, simplifying the
642installation of operating systems that require immediate keyboard input.
643This can be removed for post-installation use.
644.It Cm password= Ns Ar password
645This type of authentication is known to be cryptographically weak and is not
646intended for use on untrusted networks.
647Many implementations will want to use stronger security, such as running
648the session over an encrypted channel provided by IPsec or SSH.
649.El
650.Pp
651.Sy xHCI USB device backends :
652.Bl -tag -width 10n
653.It Cm tablet
654A USB tablet device which provides precise cursor synchronization
655when using VNC.
656.El
657.Pp
658.Sy NVMe device backends :
659.Bl -bullet
660.Sm off
661.It
662.Ar devpath
663.Op Cm ,maxq= Ar #
664.Op Cm ,qsz= Ar #
665.Op Cm ,ioslots= Ar #
666.Op Cm ,sectsz= Ar #
667.Op Cm ,ser= Ar #
668.Op Cm ,eui64= Ar #
669.Op Cm ,dsm= Ar opt
670.Sm on
671.El
672.Pp
673Configuration options are defined as follows:
674.Bl -tag -width 10n
675.It Ar devpath
676Accepted device paths are:
677.Ar /dev/blockdev
678or
679.Ar /path/to/image
680or
681.Cm ram= Ns Ar size_in_MiB .
682.It Cm maxq
683Max number of queues.
684.It Cm qsz
685Max elements in each queue.
686.It Cm ioslots
687Max number of concurrent I/O requests.
688.It Cm sectsz
689Sector size (defaults to blockif sector size).
690.It Cm ser
691Serial number with maximum 20 characters.
692.It Cm eui64
693IEEE Extended Unique Identifier (8 byte value).
694.It Cm dsm
695DataSet Management support.
696Supported values are:
697.Cm auto , enable ,
698and
699.Cm disable .
700.El
701.Pp
702.Sy AHCI device backends :
703.Bl -bullet
704.It
705.Sm off
706.Op Oo Cm hd\&: | cd\&: Oc Ar path
707.Op Cm ,nmrr= Ar nmrr
708.Op Cm ,ser= Ar #
709.Op Cm ,rev= Ar #
710.Op Cm ,model= Ar #
711.Sm on
712.El
713.Pp
714Configuration options are defined as follows:
715.Bl -tag -width 10n
716.It Cm nmrr
717Nominal Media Rotation Rate, known as RPM.
718Value 1 will indicate device as Solid State Disk.
719Default value is 0, not report.
720.It Cm ser
721Serial Number with maximum 20 characters.
722.It Cm rev
723Revision Number with maximum 8 characters.
724.It Cm model
725Model Number with maximum 40 characters.
726.El
727.It Fl U Ar uuid
728Set the universally unique identifier
729.Pq UUID
730in the guest's System Management BIOS System Information structure.
731By default a UUID is generated from the host's hostname and
732.Ar vmname .
733.It Fl u
734RTC keeps UTC time.
735.It Fl W
736Force virtio PCI device emulations to use MSI interrupts instead of MSI-X
737interrupts.
738.It Fl w
739Ignore accesses to unimplemented Model Specific Registers (MSRs).
740This is intended for debug purposes.
741.It Fl x
742The guest's local APIC is configured in x2APIC mode.
743.It Fl Y
744Disable MPtable generation.
745.It Ar vmname
746Alphanumeric name of the guest.
747.El
748.Sh CONFIGURATION VARIABLES
749.Nm
750uses an internal tree of configuration variables to describe global and
751per-device settings.
752When
753.Nm
754starts,
755it parses command line options (including config files) in the order given
756on the command line.
757Each command line option sets one or more configuration variables.
758For example,
759the
760.Fl s
761option creates a new tree node for a PCI device and sets one or more variables
762under that node including the device model and device model-specific variables.
763Variables may be set multiple times during this parsing stage with the final
764value overriding previous values.
765.Pp
766Once all of the command line options have been processed,
767the configuration values are frozen.
768.Nm
769then uses the value of configuration values to initialize device models
770and global settings.
771.Pp
772More details on configuration variables can be found in
773.Xr bhyve_config 5 .
774.Sh SIGNAL HANDLING
775.Nm
776deals with the following signals:
777.Pp
778.Bl -tag -width SIGTERM -compact
779.It SIGTERM
780Trigger ACPI poweroff for a VM
781.El
782.Sh EXIT STATUS
783Exit status indicates how the VM was terminated:
784.Pp
785.Bl -tag -width indent -compact
786.It 0
787rebooted
788.It 1
789powered off
790.It 2
791halted
792.It 3
793triple fault
794.It 4
795exited due to an error
796.El
797.Sh EXAMPLES
798To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio
799block device backed by the
800.Pa /my/image
801filesystem image, and a serial port for the console:
802.Bd -literal -offset indent
803bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \e
804  -l com1,stdio -H -P -m 1G vm1
805.Ed
806.Pp
807Run a 24GB single-CPU virtual machine with three network ports.
808.Bd -literal -offset indent
809bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net-viona,vmvnic0 \e
810  -s 2:1,virtio-net-viona,vmvnic1 -s 2:2,virtio-net-viona,vmvnic2 \e
811  -s 3,virtio-blk,/my/image -l com1,stdio \e
812  -H -P -m 24G bigvm
813.Ed
814.Pp
815Run an 8GB virtual machine with 2 quad core CPUs, 2 NVMe disks and one other
816disk attached as a Virtio block device, an AHCI ATAPI CD-ROM, a single viona
817network port, an i440fx hostbridge, and the console port connected to a socket.
818.Bd -literal -offset indent
819bhyve -c sockets=2,cores=4,threads=2 \e
820  -s 0,hostbridge,model=i440fx -s 1,lpc \e
821  -s 1:0,nvme,/dev/zvol/rdsk/tank/hdd0 \e
822  -s 1:1,nvme,/dev/zvol/rdsk/tank/hdd1 \e
823  -s 1:2,virtio-blk,/dev/zvol/rdsk/tank/hdd1 \e
824  -s 2:0,ahci,cd:/images/install.iso \e
825  -s 3,virtio-net-viona,vnic=vmvnic0 \e
826  -l com1,socket,/tmp/vm.com1,wait \e
827  -H -P -m 8G
828.Ed
829.Pp
830Run a UEFI virtual machine with a display resolution of 800 by 600 pixels
831that can be accessed via VNC at: 0.0.0.0:5900.
832.Bd -literal -offset indent
833bhyve -c 2 -m 4G -w -H \e
834  -s 0,hostbridge \e
835  -s 3,ahci-cd,/path/to/uefi-OS-install.iso \e
836  -s 4,nvme,/dev/zvol/rdsk/tank/hdd0 \e
837  -s 5,virtio-net-viona,vnic=vnmic0 \e
838  -s 29,fbuf,vga=off,rfb=0.0.0.0:5900,w=800,h=600,wait \e
839  -s 30,xhci,tablet \e
840  -s 31,lpc -l com1,stdio \e
841  -l bootrom,/usr/share/bhyve/firmware/BHYVE_UEFI.fd \e
842   uefivm
843.Ed
844.Pp
845Run a UEFI virtual machine with a VARS file to save EFI variables.
846Note that
847.Nm
848will write guest modifications to the given VARS file.
849Be sure to create a per-guest copy of the template VARS file from
850.Pa /usr/share/bhyve/firmware .
851.Bd -literal -offset indent
852bhyve -c 2 -m 4g -w -H \e
853  -s 0,hostbridge \e
854  -s 31,lpc -p com1,stdio \e
855  -l bootrom,/usr/share/bhyve/firmware/BHYVE_UEFI.fd,BHYVE_UEFI_VARS.fd \e
856   uefivm
857.Ed
858.Sh SEE ALSO
859.Xr bhyve_config 5 ,
860.Xr bhyvectl 8
861.Pp
862.Rs
863.%A Intel
864.%B 64 and IA-32 Architectures Software Developers' Manual
865.%V Volume 3
866.Re
867