xref: /freebsd/usr.sbin/bhyve/bhyve_config.5 (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1.\" SPDX-License-Identifier: BSD-2-Clause
2.\"
3.\" Copyright (c) 2021 John H. Baldwin <jhb@FreeBSD.org>
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd April 20, 2021
27.Dt BHYVE_CONFIG 5
28.Os
29.Sh NAME
30.Nm bhyve_config
31.Nd "bhyve configuration variables"
32.Sh DESCRIPTION
33.Xr bhyve 8
34uses a hierarchical tree of configuration variables to describe global and
35per-device settings.
36Internal nodes in this tree do not have a value,
37only leaf nodes have values.
38This manual describes the configuration variables understood by
39.Xr bhyve 8 .
40If additional variables are defined,
41.Xr bhyve 8
42will ignore them and will not emit errors for unknown variables.
43However, these additional variables can be referenced by other
44variables as described below.
45.Sh VARIABLE VALUES
46Configuration variable values are stored as strings.
47A configuration variable value may refer to one or more other
48configuration values by name.
49Instances of the pattern
50.Sq % Ns Pq Ar var
51are replaced by the value of the configuration variable
52.Va var .
53To avoid unwanted expansion,
54.Sq %
55characters can be escaped by a leading
56.Sq % .
57For example,
58if a configuration variable
59.Va disk
60uses the value
61.Pa /dev/zvol/bhyve/%(name) ,
62then the final value of the
63.Va disk
64variable will be set to the path of a ZFS volume whose name matches
65the name of the virtual machine on the pool
66.Pa bhyve .
67.Pp
68Some configuration variables may be interpreted as a boolean value.
69For those variables the following case-insensitive values may be used to
70indicate true:
71.Pp
72.Bl -bullet -offset indent -compact
73.It
74true
75.It
76on
77.It
78yes
79.It
801
81.El
82.Pp
83The following values may be used to indicate false:
84.Pp
85.Bl -bullet -offset indent -compact
86.It
87false
88.It
89off
90.It
91no
92.It
930
94.El
95.Pp
96Some configuration variables may be interperted as an integer.
97For those variables,
98any syntax supported by
99.Xr strtol 3
100may be used.
101.Sh GLOBAL SETTINGS
102.Ss Architecture Neutral Settings
103.Bl -column "memory.guest_in_core" "integer" "Default"
104.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
105.It Va name Ta string Ta Ta
106The name of the VM.
107.It Va cpus Ta integer Ta 1 Ta
108The total number of virtual CPUs.
109.It Va cores Ta integer Ta 1 Ta
110The number of virtual cores in each virtual socket.
111.It Va threads Ta integer Ta 1 Ta
112The number of virtual CPUs in each virtual core.
113.It Va sockets Ta integer Ta 1 Ta
114The number of virtual sockets.
115.It Va memory.guest_in_core Ta bool Ta false Ta
116Include guest memory in core file.
117.It Va memory.size Ta string Ta 256M Ta
118Guest physical memory size in bytes.
119The value must be formatted as described in
120.Xr expand_number 3 .
121.It Va memory.wired Ta bool Ta false Ta
122Wire guest memory.
123.It Va acpi_tables Ta bool Ta false Ta
124Generate ACPI tables.
125.It Va destroy_on_poweroff Ta bool Ta false Ta
126Destroy the VM on guest-initiated power-off.
127.It Va gdb.port Ta integer Ta 0 Ta
128TCP port number for the debug server.
129If this is set to a non-zero value, a debug server
130will listen for connections on this port.
131.It Va gdb.wait Ta bool Ta false Ta
132If the debug server is enabled, wait for a debugger to connect
133before starting the guest.
134.It Va rtc.use_localtime Ta bool Ta true Ta
135The real time clock uses the local time of the host.
136If this is set to false, the real time clock uses UTC.
137.It Va uuid Ta string Ta Ta
138The universally unique identifier (UUID) to use in the guest's
139System Management BIOS System Information structure.
140If an explicit value is not set, a valid UUID is generated from
141the host's hostname and the VM name.
142.It Va virtio_msix Ta bool Ta true Ta
143Use MSI-X interrupts for PCI VirtIO devices.
144If set to false, MSI interrupts are used instead.
145.It Va config.dump Ta bool Ta false Ta
146If this value is set to true after
147.Xr bhyve 8
148has finished parsing command line options,
149then
150.Xr bhyve 8
151will write all of its configuration variables to stdout and exit.
152No VM will be started.
153.El
154.Ss x86-Specific Settings
155.Bl -column "x86.vmexit_on_pause" "integer" "Default"
156.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
157.It Va x86.mptable Ta bool Ta true Ta
158Generate an MPTable.
159.It Va x86.x2apic Ta bool Ta false Ta
160Configure guest's local APICs in x2APIC mode.
161.It Va x86.strictio Ta bool Ta false Ta
162Exit if a guest accesses an I/O port that is not emulated.
163By default, writes are ignored and reads return all bits set.
164.It Va x86.strictmsr Ta bool Ta true Ta
165Inject a general protection fault if a guest accesses a Model Specific
166Register (MSR) that is not emulated.
167If this is false, writes are ignored and reads return zero.
168.It Va x86.vmexit_on_hlt Ta bool Ta false Ta
169Force a VM exit when a guest CPU executes the
170.Dv HLT
171instruction.
172This allows idle guest CPUs to yield the host CPU.
173.It Va x86.vmexit_on_pause Ta bool Ta false Ta
174Force a VM exit when a guest CPU executes the
175.Dv PAUSE
176instruction.
177.El
178.Sh DEVICE SETTINGS
179Device settings are stored under a device node.
180The device node's name is set by the parent bus of the device.
181.Ss PCI Device Settings
182PCI devices are described by a device node named
183.Dq pci Ns Ar bus . Ns Ar slot . Ns Ar function
184where each of
185.Ar bus ,
186.Ar slot ,
187and
188.Ar function
189are formatted as decimal values with no padding.
190All PCI device nodes must contain a configuration variable named
191.Dq device
192which specifies the device model to use.
193The following PCI device models are supported:
194.Bl -tag -indent
195.It Li hostbridge
196Provide a simple PCI-Host bridge device.
197This is usually configured at pci0:0:0 and is required by most guest
198operating systems.
199.It Li ahci
200AHCI storage controller.
201.It Li e1000
202Intel e82545 network interface.
203.It Li fbuf
204VGA framebuffer device attached to VNC server.
205.It Li lpc
206LPC PCI-ISA bridge with COM1-COM4 16550 serial ports,
207a boot ROM,
208and an optional debug/test device.
209This device must be configured on bus 0.
210.It Li hda
211High Definition audio controller.
212.It Li nvme
213NVM Express (NVMe) controller.
214.It Li passthru
215PCI pass-through device.
216.It Li uart
217PCI 16550 serial device.
218.It Li virtio-9p
219VirtIO 9p (VirtFS) interface.
220.It Li virtio-blk
221VirtIO block storage interface.
222.It Li virtio-console
223VirtIO console interface.
224.It Li virtio-net
225VirtIO network interface.
226.It Li virtio-rnd
227VirtIO RNG interface.
228.It Li virtio-scsi
229VirtIO SCSI interface.
230.It Li xhci
231Extensible Host Controller Interface (XHCI) USB controller.
232.El
233.Ss USB Device Settings
234USB controller devices contain zero or more child USB devices
235attached to slots.
236Each USB device stores its settings in a node named
237.Dq slot. Ns Va N
238under the controller's device node.
239.Va N
240is the number of the slot to which the USB device is attached.
241Note that USB slot numbers begin at 1.
242All USB device nodes must contain a configuration variable named
243.Dq device
244which specifies the device model to use.
245The following USB device models are supported:
246.Bl -tag -indent
247.It Li tablet
248A USB tablet device which provides precise cursor synchronization
249when using VNC.
250.El
251.Ss Block Device Settings
252Block devices use the following settings to configure their backing store.
253These settings are stored in the configuration node of the respective device.
254.Bl -column "sectorsize" "logical[/physical]" "Default"
255.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
256.It path Ta string Ta Ta
257The path of the file or disk device to use as the backing store.
258.It nocache Ta bool Ta false Ta
259Disable caching on the backing file by opening the backing file with
260.Dv O_DIRECT .
261.It nodelete Ta bool Ta false Ta
262Disable emulation of guest trim requests via
263.Dv DIOCGDELETE
264requests.
265.It sync Ta bool Ta false Ta
266Write changes to the backing file with synchronous writes.
267.It direct Ta bool Ta false Ta
268An alias for
269.Va sync .
270.It ro Ta bool Ta false Ta
271Disable writes to the backing file.
272.It sectorsize Ta Va logical Ns Op / Ns Va physical Ta Ta
273Specify the logical and physical sector size of the emulated disk.
274If the physical size is not specified,
275it is equal to the logical size.
276.El
277.Ss Network Backend Settings
278Network devices use the following settings to configure their backend.
279The backend is responsible for passing packets between the device model
280and a desired destination.
281Configuring a backend requires setting the
282.Va backend
283variable to one of the following values:
284.Bl -tag
285.It tap Ns Va N
286Use the named
287.Xr tap 4
288interface as the backend.
289.It vmnet Ns Va N
290Use the named
291.Xr vmnet 4
292interface as the backend.
293.It netgraph
294Use a
295.Xr netgraph 4
296socket hook as the backend.
297This backend uses the following additional variables:
298.Bl -column "peerhook" "Format" "Default"
299.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
300.It Va path Ta string Ta Ta
301The name of the
302.Xr netgraph 4
303destination node.
304.It Va peerhook Ta string Ta Ta
305The name of the destination hook.
306.It Va socket Ta string Ta Ta
307The name of the created
308.Xr ng_socket 4
309node.
310.It Va hook Ta string Ta vmlink Ta
311The name of the source hook on the created
312.Xr ng_socket 4
313node.
314.El
315.It netmap: Ns Va interface
316Use
317.Xr netmap 4
318on a network interface as the backend.
319.It vale Ns Va bridge : Ns Va port
320Use a port on a
321.Xr vale 4
322bridge as the backend.
323.El
324.Ss UART Device Settings
325.Bl -column "Name" "Format" "Default"
326.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
327.It Va path Ta path Ta Ta
328Backend device for the serial port.
329Either the pathname of a character device or
330.Dq stdio
331to use standard input and output of the
332.Xr bhyve 8
333process.
334.El
335.Ss Host Bridge Settings
336.Bl -column "vendor" "integer" "Default"
337.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
338.It Va vendor Ta integer Ta 0x1275 Ta
339PCI vendor ID.
340.It Va devid Ta integer Ta 0x1275 Ta
341PCI device ID.
342.El
343.Ss AHCI Controller Settings
344AHCI controller devices contain zero or more ports each of which
345provides a storage device.
346Each port stores its settings in a node named
347.Dq port. Ns Va N
348under the controller's device node.
349The
350.Va N
351values are formatted as successive decimal values starting with 0.
352In addition to the block device settings described above, each
353port supports the following settings:
354.Bl -column "model" "integer" "generated"
355.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
356.It Va type Ta string Ta Ta
357The type of storage device to emulate.
358Must be set to either
359.Dq cd
360or
361.Dq hd .
362.It Va nmrr Ta integer Ta 0 Ta
363Nominal Media Rotation Rate, also known as RPM.
364A value 1 of indicates a device with no rate such as a Solid State Disk.
365.It Va ser Ta string Ta generated Ta
366Serial number of up to twenty characters.
367A default serial number is generated using a hash of the backing
368store's pathname.
369.It Va rev Ta string Ta 001 Ta
370Revision number of up to eight characters.
371.It Va model Ta string Ta Ta
372Model number of up to forty characters.
373Separate default model strings are used for
374.Dq cd
375and
376.Dq hd
377device types.
378.El
379.Ss e1000 Settings
380In addition to the network backend settings,
381Intel e82545 network interfaces support the following variables:
382.Bl -column "Name" "MAC address" "generated"
383.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
384.It Va mac Ta MAC address Ta generated Ta
385MAC address.
386If an explicit address is not provided,
387a MAC address is generated from a hash of the device's PCI address.
388.El
389.Ss Frame Buffer Settings
390.Bl -column "password" "[IP:]port" "127.0.0.1:5900"
391.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
392.It Va wait Ta bool Ta false Ta
393Wait for a remote connection before starting the VM.
394.It Va rfb Ta Oo Ar IP Ns : Oc Ns Ar port Ta 127.0.0.1:5900 Ta
395TCP address to listen on for remote connections.
396The IP address must be given as a numeric address.
397IPv6 addresses must be enclosed in square brackets and
398support scoped identifiers as described in
399.Xr getaddrinfo 3 .
400A bare port number may be given in which case the IPv4
401localhost address is used.
402.It Va vga Ta string Ta io Ta
403VGA configuration.
404More details are provided in
405.Xr bhyve 8 .
406.It Va w Ta integer Ta 1024 Ta
407Frame buffer width in pixels.
408.It Va h Ta integer Ta 768 Ta
409Frame buffer height in pixels.
410.It Va password Ta string Ta Ta
411Password to use for VNC authentication.
412This type of authentication is known to be cryptographically weak and is not
413intended for use on untrusted networks.
414.El
415.Ss High Definition Audio Settings
416.Bl -column "Name" "Format" "Default"
417.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
418.It Va play Ta path Ta Ta
419Host playback device,
420typically
421.Pa /dev/dsp0 .
422.It Va rec Ta path Ta Ta
423Host recording device,
424typically
425.Pa /dev/dsp0 .
426.El
427.Ss LPC Device Settings
428The LPC bridge stores its configuration under a top-level
429.Va lpc
430node rather than under the PCI LPC device's node.
431The following nodes are available under
432.Va lpc :
433.Bl -column "pc-testdev" "Format" "Default"
434.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
435.It Va bootrom Ta path Ta Ta
436Path to a boot ROM.
437The contents of this file are copied into the guest's
438memory ending just before the 4GB physical address.
439If a boot ROM is present, a firmware interface device is
440also enabled for use by the boot ROM.
441.It Va com1 Ta node Ta Ta
442Settings for the COM1 serial port device.
443.It Va com2 Ta node Ta Ta
444Settings for the COM2 serial port device.
445.It Va com3 Ta node Ta Ta
446Settings for the COM3 serial port device.
447.It Va com4 Ta node Ta Ta
448Settings for the COM4 serial port device.
449.It Va pc-testdev Ta bool Ta false Ta
450Enable the PC debug/test device.
451.El
452.Ss NVMe Controller Settings
453Each NVMe controller supports a single storage device.
454The device can be backed either by a memory disk described by the
455.Va ram
456variable, or a block device using the the block device settings described above.
457In addition, each controller supports the following settings:
458.Bl -column "ioslots" "Format" "Default"
459.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
460.It Va maxq Ta integer Ta 16 Ta
461Maximum number of I/O submission and completion queue pairs.
462.It Va qsz Ta integer Ta 2058 Ta
463Number of elements in each I/O queue.
464.It Va ioslots Ta integer Ta 8 Ta
465Maximum number of concurrent I/O requests.
466.It Va sectsz Ta integer Ta Ta
467Sector size.
468Can be one of 512, 4096, or 8192.
469Devices backed by a memory disk use 4096 as the default.
470Devices backed by a block device use the block device's sector size
471as the default.
472.It Va ser Ta string Ta Ta
473Serial number of up to twenty characters.
474A default serial number is generated using a hash of the device's PCI address.
475.It Va eui64 Ta integer Ta Ta
476IEEE Extended Unique Identifier.
477If an EUI is not provided, a default is generated using a checksum of the
478device's PCI address.
479.It Va dsm Ta string Ta auto Ta
480Whether or not to advertise DataSet Management support.
481One of
482.Dq auto ,
483.Dq enable ,
484or
485.Dq disable .
486The
487.Dq auto
488setting only advertises support if the backing store supports
489resource freeing, for example via TRIM.
490.It Va ram Ta integer Ta Ta
491If set, allocate a memory disk as the backing store.
492The value of this variable is the size of the memory disk in megabytes.
493.El
494.Ss PCI Passthrough Settings
495.Bl -column "Name" "integer" "Default"
496.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
497.It Va bus Ta integer Ta Ta
498Host PCI bus address of device to pass through.
499.It Va slot Ta integer Ta Ta
500Host PCI slot address of device to pass through.
501.It Va func Ta integer Ta Ta
502Host PCI function address of device to pass through.
503.El
504.Ss VirtIO 9p Settings
505Each VirtIO 9p device exposes a single filesystem from a host path.
506.Bl -column "sharename" "Format" "Default"
507.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
508.It Va sharename Ta string Ta Ta
509The share name exposed to the guest.
510.It Va path Ta path Ta Ta
511The path of a directory on the host to export to the guest.
512.It Va ro Ta bool Ta false Ta
513If true, the guest filesystem is read-only.
514.El
515.Ss VirtIO Console Device Settings
516Each VirtIO Console device contains one or more console ports.
517Each port stores its settings in a node named
518.Dq port. Ns Va N
519under the controller's device node.
520The
521.Va N
522values are formatted as successive decimal values starting with 0.
523Each port supports the following settings:
524.Bl -column "Name" "Format" "Default"
525.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
526.It Va name Ta string Ta Ta
527The name of the port exposed to the guest.
528.It Va path Ta path Ta Ta
529The path of a UNIX domain socket providing the host connection for the port.
530.El
531.Ss VirtIO Network Interface Settings
532In addition to the network backend settings,
533VirtIO network interfaces support the following variables:
534.Bl -column "Name" "MAC address" "generated"
535.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
536.It Va mac Ta MAC address Ta generated Ta
537MAC address.
538If an explicit address is not provided,
539a MAC address is generated from a hash of the device's PCI address.
540.It Va mtu Ta integer Ta 1500 Ta
541The largest supported MTU advertised to the guest.
542.El
543.Ss VirtIO SCSI Settings
544.Bl -column "Name" "integer" "Default"
545.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
546.It Va dev Ta path Ta Ta
547The path of a CAM target layer (CTL) device to export:
548.Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc .
549.It Va iid Ta integer Ta 0 Ta
550Initiator ID to use when sending requests to the CTL port.
551.El
552.Sh SEE ALSO
553.Xr expand_number 3 ,
554.Xr getaddrinfo 3 ,
555.Xr strtol 3 ,
556.Xr netgraph 4 ,
557.Xr netmap 4 ,
558.Xr ng_socket 4 ,
559.Xr tap 4 ,
560.Xr vale 4 ,
561.Xr vmnet 4 ,
562.Xr bhyve 8
563