xref: /illumos-gate/usr/src/man/man5/bhyve_config.5 (revision 38aced4fb3d60e34a44207b22d0b0dd4909bf4d1)
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.\" Portions Copyright 2022 OmniOS Community Edition (OmniOSce) Association.
27.\"
28.Dd April 6, 2022
29.Dt BHYVE_CONFIG 5
30.Os
31.Sh NAME
32.Nm bhyve_config
33.Nd "bhyve configuration variables"
34.Sh DESCRIPTION
35.Xr bhyve 8
36uses a hierarchical tree of configuration variables to describe global and
37per-device settings.
38Internal nodes in this tree do not have a value,
39only leaf nodes have values.
40This manual describes the configuration variables understood by
41.Xr bhyve 8 .
42If additional variables are defined,
43.Xr bhyve 8
44will ignore them and will not emit errors for unknown variables.
45However, these additional variables can be referenced by other
46variables as described below.
47.Sh VARIABLE VALUES
48Configuration variable values are stored as strings.
49A configuration variable value may refer to one or more other
50configuration values by name.
51Instances of the pattern
52.Sq % Ns Pq Ar var
53are replaced by the value of the configuration variable
54.Va var .
55To avoid unwanted expansion,
56.Sq %
57characters can be escaped by a leading
58.Sq % .
59For example,
60if a configuration variable
61.Va disk
62uses the value
63.Pa /dev/zvol/bhyve/%(name) ,
64then the final value of the
65.Va disk
66variable will be set to the path of a ZFS volume whose name matches
67the name of the virtual machine on the pool
68.Pa bhyve .
69.Pp
70Some configuration variables may be interpreted as a boolean value.
71For those variables the following case-insensitive values may be used to
72indicate true:
73.Pp
74.Bl -bullet -offset indent -compact
75.It
76true
77.It
78on
79.It
80yes
81.It
821
83.El
84.Pp
85The following values may be used to indicate false:
86.Pp
87.Bl -bullet -offset indent -compact
88.It
89false
90.It
91off
92.It
93no
94.It
950
96.El
97.Pp
98Some configuration variables may be interpreted as an integer.
99For those variables,
100any syntax supported by
101.Xr strtoul 3C
102may be used.
103.Sh GLOBAL SETTINGS
104.Ss Architecture Neutral Settings
105.Bl -column "memory.guest_in_core" "integer" "Default"
106.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
107.It Va name Ta string Ta Ta
108The name of the VM.
109.It Va cpus Ta integer Ta 1 Ta
110The total number of virtual CPUs.
111.It Va cores Ta integer Ta 1 Ta
112The number of virtual cores in each virtual socket.
113.It Va threads Ta integer Ta 1 Ta
114The number of virtual CPUs in each virtual core.
115.It Va sockets Ta integer Ta 1 Ta
116The number of virtual sockets.
117.It Va memory.size Ta string Ta 256M Ta
118Guest physical memory size.
119The size argument may be suffixed with one of K, M, G or T (either upper
120or lower case) to indicate a multiple of kibibytes, mebibytes, gibibytes,
121or tebibytes.
122If no suffix is given, the value is assumed to be in mebibytes.
123.It Va memory.wired Ta bool Ta false Ta
124Wire guest memory.
125.It Va acpi_tables Ta bool Ta false Ta
126Generate ACPI tables; these tables are
127.Em not
128used on illumos.
129.It Va destroy_on_poweroff Ta bool Ta false Ta
130Destroy the VM on guest-initiated power-off.
131.It Va gdb.address Ta string Ta localhost Ta
132Hostname, IP address, or IPv6 address for the debug server.
133.It Va gdb.port Ta integer Ta 0 Ta
134TCP port number for the debug server.
135If this is set to a non-zero value, a debug server
136will listen for connections on this port.
137.It Va gdb.wait Ta bool Ta false Ta
138If the debug server is enabled, wait for a debugger to connect
139before starting the guest.
140.It Va keyboard.layout Ta string Ta Ta
141Specify the keyboard layout name with the file name in
142.Pa /usr/share/bhyve/kbdlayout .
143This value only works when loaded with UEFI mode for VNC, and when a VNC client
144that doesn't support the QEMU Extended Key Event Message us used.
145.It Va rtc.use_localtime Ta bool Ta true Ta
146The real time clock uses the local time of the host.
147If this is set to false, the real time clock uses UTC.
148.It Va uuid Ta string Ta Ta
149The universally unique identifier (UUID) to use in the guest's
150System Management BIOS System Information structure.
151If an explicit value is not set, a valid UUID is generated from
152the host's hostname and the VM name.
153.It Va virtio_msix Ta bool Ta true Ta
154Use MSI-X interrupts for PCI VirtIO devices.
155If set to false, MSI interrupts are used instead.
156.It Va config.dump Ta bool Ta false Ta
157If this value is set to true then, after parsing command line options,
158.Xr bhyve 8
159will write all of its configuration variables to
160.Dv stdout
161and exit.
162No VM will be started.
163.It Va privileges.debug Ta bool Ta false Ta
164Enable debug messages relating to privilege management.
165These messages are sent to
166.Dv stdout .
167.It Va rfb.debug Ta bool Ta false Ta
168Enable debug messages relating to the RFB
169.Pq VNC
170server.
171.It Va xhci.debug Ta bool Ta false Ta
172Enable debug messages relating to the emulated XHCI
173.Pq USB
174controller.
175These messages are sent to
176.Dv stderr .
177.El
178.Ss x86-Specific Settings
179.Bl -column "x86.vmexit_on_pause" "integer" "Default"
180.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
181.It Va x86.mptable Ta bool Ta true Ta
182Generate an MPTable.
183.It Va x86.x2apic Ta bool Ta false Ta
184Configure guest's local APICs in x2APIC mode.
185.It Va x86.strictio Ta bool Ta false Ta
186Exit if a guest accesses an I/O port that is not emulated.
187By default, writes are ignored and reads return all bits set.
188.It Va x86.strictmsr Ta bool Ta true Ta
189Inject a general protection fault if a guest accesses a Model Specific
190Register (MSR) that is not emulated.
191If this is false, writes are ignored and reads return zero.
192.It Va x86.vmexit_on_hlt Ta bool Ta false Ta
193Force a VM exit when a guest CPU executes the
194.Dv HLT
195instruction.
196This allows idle guest CPUs to yield the host CPU.
197.It Va x86.vmexit_on_pause Ta bool Ta false Ta
198Force a VM exit when a guest CPU executes the
199.Dv PAUSE
200instruction.
201.El
202.Sh DEVICE SETTINGS
203Device settings are stored under a device node.
204The device node's name is set by the parent bus of the device.
205.Ss PCI Device Settings
206PCI devices are described by a device node named
207.Dq pci . Ns Ar bus . Ns Ar slot . Ns Ar function
208where each of
209.Ar bus ,
210.Ar slot ,
211and
212.Ar function
213are formatted as decimal values with no padding.
214All PCI device nodes must contain a configuration variable named
215.Dq device
216which specifies the device model to use.
217The following PCI device models are supported:
218.Bl -tag -width indent
219.It Li hostbridge
220Provide a simple PCI-Host bridge device.
221This is usually configured at pci0:0:0 and is required by most guest
222operating systems.
223.It Li ahci
224AHCI storage controller.
225.It Li e1000
226Intel e82545 network interface.
227.It Li fbuf
228VGA framebuffer device attached to VNC server.
229.It Li lpc
230LPC PCI-ISA bridge with COM1-COM4 16550 serial ports,
231a boot ROM,
232and an optional debug/test device.
233This device must be configured on bus 0.
234.It Li nvme
235NVM Express (NVMe) controller.
236.It Li passthru
237PCI pass-through device.
238.It Li uart
239PCI 16550 serial device.
240.It Li virtio-9p
241VirtIO 9p (VirtFS) interface.
242.It Li virtio-blk
243VirtIO block storage interface.
244.It Li virtio-console
245VirtIO console interface.
246.It Li virtio-net-viona
247Accelerated VirtIO network interface.
248.It Li net-viona
249Legacy VirtIO network interface.
250.It Li virtio-rnd
251VirtIO random number generator interface.
252.It Li xhci
253Extensible Host Controller Interface (XHCI) USB controller.
254.El
255.Ss USB Device Settings
256USB controller devices contain zero or more child USB devices
257attached to slots.
258Each USB device stores its settings in a node named
259.Dq slot. Ns Va N
260under the controller's device node.
261.Va N
262is the number of the slot to which the USB device is attached.
263Note that USB slot numbers begin at 1.
264All USB device nodes must contain a configuration variable named
265.Dq device
266which specifies the device model to use.
267The following USB device models are supported:
268.Bl -tag -width indent
269.It Li tablet
270A USB tablet device which provides precise cursor synchronization
271when using VNC.
272.El
273.Ss Block Device Settings
274Block devices use the following settings to configure their backing store.
275These settings are stored in the configuration node of the respective device.
276.Bl -column "sectorsize" "logical[/physical]" "Default"
277.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
278.It path Ta string Ta Ta
279The path of the file or disk device to use as the backing store.
280.It nocache Ta bool Ta false Ta
281Disable caching on the backing file by opening the backing file with
282.Dv O_DIRECT .
283.It nodelete Ta bool Ta false Ta
284Disable emulation of guest trim requests via
285.Dv DIOCGDELETE
286requests.
287.It sync Ta bool Ta false Ta
288Write changes to the backing file with synchronous writes.
289.It direct Ta bool Ta false Ta
290An alias for
291.Va sync .
292.It ro Ta bool Ta false Ta
293Disable writes to the backing file.
294.It sectorsize Ta Va logical Ns Op / Ns Va physical Ta Ta
295Specify the logical and physical sector size of the emulated disk.
296If the physical size is not specified, it is set to be equal to the logical
297size.
298.El
299.Ss virtio-net-viona Network Backend Settings
300Viona network devices use the following settings to configure their backend.
301.Bl -column "feature_flags" "string" "Default"
302.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
303.It vnic Ta string Ta Ta
304The VNIC to use for the network connection.
305.It feature_mask Ta integer Ta 0 Ta
306Specify a mask to apply to the virtio features advertised to the guest.
307.El
308.Ss Other Network Backend Settings
309Other network devices use the following settings to configure their backend.
310.Bl -column "feature_flags" "string" "Default"
311.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
312.It vnic Ta string Ta Ta
313The VNIC to use for the network connection.
314.It promiscphys Ta bool Ta false Ta
315Enable promiscuous mode at the physical level.
316.It promiscsap Ta bool Ta true Ta
317Enable promiscuous mode at the SAP level.
318.It promiscmulti Ta bool Ta true Ta
319Enable promiscuous mode for all multicast addresses.
320.It promiscrxonly Ta bool Ta true Ta
321The selected promiscuous modes are only enabled for received traffic.
322.El
323.Ss UART Device Settings
324.Bl -column "Name" "Format" "Default"
325.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
326.It Va path Ta path Ta Ta
327Backend device for the serial port.
328Either the pathname of a character device or
329.Dq stdio
330to use standard input and output of the
331.Xr bhyve 8
332process.
333.El
334.Ss Host Bridge Settings
335Host Bridge devices use the following settings.
336When configuring parameters, either the
337.Va model
338by itself, or both of
339.Va vendor
340and
341.Va devid
342must be specified.
343.Bl -column "vendor" "integer" "Default"
344.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
345.It Va model Ta string Ta netapp Ta
346Specify a hostbridge model to emulate.
347Valid model strings, and their associated vendor and device IDs are:
348.Sy amd Pq 0x1022/0x7432 ,
349.Sy netapp Pq 0x1275/0x1275 ,
350.Sy i440fx Pq 0x8086/0x1237
351and
352.Sy q35 Pq 0x8086/0x29b0 .
353.It Va vendor Ta integer Ta 0x1275 Ta
354PCI vendor ID.
355.It Va devid Ta integer Ta 0x1275 Ta
356PCI device ID.
357.El
358.Ss AHCI Controller Settings
359AHCI controller devices contain zero or more ports each of which
360provides a storage device.
361Each port stores its settings in a node named
362.Dq port. Ns Va N
363under the controller's device node.
364The
365.Va N
366values are formatted as successive decimal values starting with 0.
367In addition to the block device settings described above, each
368port supports the following settings:
369.Bl -column "model" "integer" "generated"
370.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
371.It Va type Ta string Ta Ta
372The type of storage device to emulate.
373Must be set to either
374.Dq cd
375or
376.Dq hd .
377.It Va nmrr Ta integer Ta 0 Ta
378Nominal Media Rotation Rate, also known as RPM.
379A value 1 of indicates a device with no rate such as a Solid State Disk.
380.It Va ser Ta string Ta generated Ta
381Serial number of up to twenty characters.
382A default serial number is generated using a hash of the backing
383store's pathname.
384.It Va rev Ta string Ta 001 Ta
385Revision number of up to eight characters.
386.It Va model Ta string Ta Ta
387Model number of up to forty characters.
388Separate default model strings are used for
389.Dq cd
390and
391.Dq hd
392device types.
393.El
394.Ss Frame Buffer Settings
395.Bl -column "password" "[IP:]port" "127.0.0.1:5900"
396.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
397.It Va wait Ta bool Ta false Ta
398Wait for a remote connection before starting the VM.
399.It Va rfb Ta Oo Ar IP Ns \&: Oc Ns Ar port Ta 127.0.0.1:5900 Ta
400TCP address to listen on for remote connections.
401The IP address must be given as a numeric address.
402IPv6 addresses must be enclosed in square brackets and
403support scoped identifiers as described in
404.Xr getaddrinfo 3SOCKET .
405A bare port number may be given in which case the IPv4
406localhost address is used.
407.It Va unix Ta string Ta Ta
408UNIX socket to listen on for VNC connections.
409.It Va vga Ta string Ta io Ta
410VGA configuration.
411More details are provided in
412.Xr bhyve 8 .
413.It Va w Ta integer Ta 1024 Ta
414Frame buffer width in pixels.
415.It Va h Ta integer Ta 768 Ta
416Frame buffer height in pixels.
417.It Va password Ta string Ta Ta
418Password to use for VNC authentication.
419This type of authentication is known to be cryptographically weak and is not
420intended for use on untrusted networks.
421.El
422.Ss LPC Device Settings
423The LPC bridge stores its configuration under a top-level
424.Va lpc
425node rather than under the PCI LPC device's node.
426The following nodes are available under
427.Va lpc :
428.Bl -column "pc-testdev" "Format" "Default"
429.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
430.It Va bootrom Ta path Ta Ta
431Path to a boot ROM.
432The contents of this file are copied into the guest's
433memory ending just before the 4GB physical address.
434If a boot ROM is present, a firmware interface device is
435also enabled for use by the boot ROM.
436.It Va bootvars Ta path Ta Ta
437Path to boot variables file.
438The contents of this file are copied beneath the boot ROM.
439Firmware can write to it to save variables.
440Variables will be persistent across guest reboots.
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 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 (DSM) 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 path Ta string Ta Ta
498Path to a PCI passthrough device in the form
499.Pa /dev/ppt Ns Ar N
500where
501.Ar N
502is the device number.
503.It Va rom Ta path Ta Ta
504ROM file of the device which will be executed by OVMF to initialise the device.
505.El
506.Ss VirtIO 9p Settings
507Each VirtIO 9p device exposes a single filesystem from a host path.
508.Bl -column "sharename" "Format" "Default"
509.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
510.It Va sharename Ta string Ta Ta
511The share name exposed to the guest.
512.It Va path Ta path Ta Ta
513The path of a directory on the host to export to the guest.
514.It Va ro Ta bool Ta false Ta
515If true, the guest filesystem is read-only.
516.El
517.Ss VirtIO Block Device Settings
518In addition to the block device settings described above, each
519VirtIO block device supports the following settings:
520.Bl -column "model" "integer" "generated"
521.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
522.It Va ser Ta string Ta generated Ta
523Serial number of up to twenty characters.
524A default serial number is generated using a hash of the backing
525store's pathname.
526.El
527.Ss VirtIO Console Device Settings
528Each VirtIO Console device contains one or more console ports.
529Each port stores its settings in a node named
530.Dq port. Ns Va N
531under the controller's device node.
532The
533.Va N
534values are formatted as successive decimal values starting with 0.
535Each port supports the following settings:
536.Bl -column "Name" "Format" "Default"
537.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description
538.It Va name Ta string Ta Ta
539The name of the port exposed to the guest.
540.It Va path Ta path Ta Ta
541The path of a UNIX domain socket providing the host connection for the port.
542.El
543.Sh SEE ALSO
544.Xr strtoul 3C ,
545.Xr getaddrinfo 3SOCKET ,
546.Xr bhyve 8
547