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