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