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