xref: /freebsd/share/man/man4/vmm.4 (revision dd21556857e8d40f66bf5ad54754d9d52669ebf7)
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.Dd December 30, 2024
26.Dt VMM 4
27.Os
28.Sh NAME
29.Nm vmm.ko
30.Nd "bhyve virtual machine monitor"
31.Sh SYNOPSIS
32To load the driver as a module at boot, add this line to
33.Xr loader.conf 5 :
34.Bd -literal -offset indent
35.Cd vmm_load="YES"
36.Ed
37.Pp
38The module can also be loaded manually with
39.Xr kldload 8 :
40.Bd -literal -offset indent
41kldload vmm
42.Ed
43.Sh DESCRIPTION
44.Nm
45provides the kernel portion of the
46.Xr bhyve 4
47hypervisor.
48The following platforms are supported:
49.Bl -bullet -compat
50.It
51amd64: An Intel CPU with VT-x/EPT or AMD CPU with SVM support is required.
52.It
53arm64: The boot CPU must start in EL2 and the system must have a GICv3 interrupt
54controller.
55VHE support will be used if available.
56.It
57riscv: The CPUs must implement the H (hypervisor) RISC-V ISA extension.
58.El
59.Pp
60PCI device passthrough to a virtual machine requires
61hardware with VT-d support and is available only on amd64.
62.Sh PCI PASSTHROUGH
63On amd64 where the hardware supports VT-d,
64PCI devices can be reserved for use by the hypervisor.
65Entries consisting of the PCI
66.Ar bus Ns / Ns Ar slot Ns / Ns Ar function
67are added to the
68.Va pptdevs
69.Xr loader.conf 5
70variable.
71Additional entries are separated by spaces.
72Host PCI devices that match an entry will be assigned to the hypervisor
73and will not be probed by
74.Fx
75device drivers.
76See the
77.Sx EXAMPLES
78section below for sample usage.
79.Pp
80Note that
81.Nm vmm
82must be given first the right of refusal to all
83.Xr pci 4
84devices it may need to claim.
85As a result, the
86.Nm vmm
87kernel module almost certainly needs to be loaded from
88.Xr loader.conf 5
89rather than by adding it to
90.Va kld_list in
91.Xr rc.conf 5 .
92.Pp
93A large number of PCI device entries may require a string longer than the
94128-character limit of
95.Xr loader.conf 5
96variables.
97The
98.Va pptdevs2
99and
100.Va pptdevs3
101variables can be used for additional entries.
102.Sh LOADER TUNABLES
103Tunables can be set at the
104.Xr loader 8
105prompt before booting the kernel or stored in
106.Xr loader.conf 5 .
107.Bl -tag -width indent
108.It Va hw.vmm.maxcpu
109Maximum number of virtual CPUs.
110The default is the number of physical CPUs in the system.
111.El
112.Sh EXAMPLES
113Reserve three PCI devices for use by the hypervisor: bus 10 slot 0 function 0,
114bus 6 slot 5 function 0, and bus 6 slot 5 function 1.
115.Bd -literal -offset indent
116pptdevs="10/0/0 6/5/0 6/5/1"
117.Ed
118.Pp
119It is possible to detach
120.Va ppt
121from a PCI device without rebooting the host machine and then attach a host
122driver, using the
123.Xr devctl 8
124utility.
125Suppose
126.Va ppt
127is currently attached to
128.Va pci0:0:1:0
129and we want the host's
130.Xr xhci 4
131driver to be attached instead:
132.Bd -literal -offset indent
133# devctl set driver -f pci0:0:1:0 xhci
134.Ed
135.Pp
136The same can be applied to attach
137.Va ppt
138back:
139.Bd -literal -offset indent
140# devctl set driver -f pci0:0:1:0 ppt
141.Ed
142.Sh SEE ALSO
143.Xr bhyve 4 ,
144.Xr loader.conf 5 ,
145.Xr bhyve 8 ,
146.Xr bhyveload 8 ,
147.Xr devctl 8 ,
148.Xr kldload 8
149.Sh HISTORY
150.Nm vmm.ko
151first appeared in
152.Fx 10.0 .
153arm64 and riscv support first appeared in
154.Fx 15.0 .
155.Sh AUTHORS
156.An Neel Natu Aq neel@freebsd.org
157.An Peter Grehan Aq grehan@freebsd.org
158