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