xref: /freebsd/share/man/man4/vmm.4 (revision 9ad2891558729b1c1ad4ba02377b157e404a3da2)
1e1485d78SSean Bruno.\" Copyright (c) 2013 Peter Grehan
2e1485d78SSean Bruno.\" All rights reserved.
3e1485d78SSean Bruno.\"
4e1485d78SSean Bruno.\" Redistribution and use in source and binary forms, with or without
5e1485d78SSean Bruno.\" modification, are permitted provided that the following conditions
6e1485d78SSean Bruno.\" are met:
7e1485d78SSean Bruno.\" 1. Redistributions of source code must retain the above copyright
8e1485d78SSean Bruno.\"    notice, this list of conditions and the following disclaimer.
9e1485d78SSean Bruno.\" 2. Redistributions in binary form must reproduce the above copyright
10e1485d78SSean Bruno.\"    notice, this list of conditions and the following disclaimer in the
11e1485d78SSean Bruno.\"    documentation and/or other materials provided with the distribution.
12e1485d78SSean Bruno.\"
13e1485d78SSean Bruno.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14e1485d78SSean Bruno.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15e1485d78SSean Bruno.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16e1485d78SSean Bruno.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17e1485d78SSean Bruno.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18e1485d78SSean Bruno.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19e1485d78SSean Bruno.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20e1485d78SSean Bruno.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21e1485d78SSean Bruno.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22e1485d78SSean Bruno.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23e1485d78SSean Bruno.\" SUCH DAMAGE.
24e1485d78SSean Bruno.\"
25*9ad28915SChristos Margiolis.Dd September 27, 2024
26e1485d78SSean Bruno.Dt VMM 4
27e1485d78SSean Bruno.Os
28e1485d78SSean Bruno.Sh NAME
29e1485d78SSean Bruno.Nm vmm.ko
30e1485d78SSean Bruno.Nd "bhyve virtual machine monitor"
31e1485d78SSean Bruno.Sh SYNOPSIS
32e1485d78SSean BrunoTo load the driver as a module at boot, add this line to
33e1485d78SSean Bruno.Xr loader.conf 5 :
34e1485d78SSean Bruno.Bd -literal -offset indent
35e1485d78SSean Bruno.Cd vmm_load="YES"
36e1485d78SSean Bruno.Ed
37e1485d78SSean Bruno.Pp
38e1485d78SSean BrunoThe module can also be loaded manually with
39e1485d78SSean Bruno.Xr kldload 8 :
40e1485d78SSean Bruno.Bd -literal -offset indent
41e1485d78SSean Brunokldload vmm
42e1485d78SSean Bruno.Ed
43e1485d78SSean Bruno.Sh DESCRIPTION
44e1485d78SSean Bruno.Nm
45e1485d78SSean Brunoprovides the kernel portion of the
46e1485d78SSean Bruno.Xr bhyve 4
47e1485d78SSean Brunohypervisor.
48e1485d78SSean Bruno.Pp
49e1485d78SSean BrunoAn Intel CPU with VT-x/EPT or AMD CPU with SVM support is required.
50e1485d78SSean Bruno.Pp
51e1485d78SSean BrunoPCI device passthrough to a virtual machine requires
52e1485d78SSean Brunohardware with VT-d support.
53e1485d78SSean Bruno.Sh PCI PASSTHROUGH
54e1485d78SSean BrunoWhen the hardware supports VT-d, and
55e1485d78SSean Bruno.Nm
56e1485d78SSean Brunohas been loaded at boot time,
57e1485d78SSean BrunoPCI devices can be reserved for use by the hypervisor.
58e1485d78SSean BrunoEntries consisting of the PCI
59e1485d78SSean Bruno.Ar bus Ns / Ns Ar slot Ns / Ns Ar function
60e1485d78SSean Brunoare added to the
61e1485d78SSean Bruno.Va pptdevs
62e1485d78SSean Bruno.Xr loader.conf 5
63e1485d78SSean Brunovariable.
64e1485d78SSean BrunoAdditional entries are separated by spaces.
65e1485d78SSean BrunoHost PCI devices that match an entry will be assigned to the hypervisor
66e1485d78SSean Brunoand will not be probed by
67e1485d78SSean Bruno.Fx
68e1485d78SSean Brunodevice drivers.
69e1485d78SSean BrunoSee the
70e1485d78SSean Bruno.Sx EXAMPLES
71e1485d78SSean Brunosection below for sample usage.
72e1485d78SSean Bruno.Pp
73d0168b32SMichael GalassiNote that
74d0168b32SMichael Galassi.Nm vmm
75d0168b32SMichael Galassimust be given first the right of refusal to all
76d0168b32SMichael Galassi.Xr pci 4
77d0168b32SMichael Galassidevices it may need to claim.
78d0168b32SMichael GalassiAs a result, the
79d0168b32SMichael Galassi.Nm vmm
80d0168b32SMichael Galassikernel module almost certainly needs to be loaded from
81d0168b32SMichael Galassi.Xr loader.conf 5
82d0168b32SMichael Galassirather than by adding it to
83d0168b32SMichael Galassi.Va kld_list in
84d0168b32SMichael Galassi.Xr rc.conf 5 .
85d0168b32SMichael Galassi.Pp
86e1485d78SSean BrunoA large number of PCI device entries may require a string longer than the
87e1485d78SSean Bruno128-character limit of
88e1485d78SSean Bruno.Xr loader.conf 5
89e1485d78SSean Brunovariables.
90e1485d78SSean BrunoThe
91e1485d78SSean Bruno.Va pptdevs2
92e1485d78SSean Brunoand
93e1485d78SSean Bruno.Va pptdevs3
94e1485d78SSean Brunovariables can be used for additional entries.
95da202b0fSYuri Pankov.Sh LOADER TUNABLES
96da202b0fSYuri PankovTunables can be set at the
97da202b0fSYuri Pankov.Xr loader 8
98da202b0fSYuri Pankovprompt before booting the kernel or stored in
99da202b0fSYuri Pankov.Xr loader.conf 5 .
100da202b0fSYuri Pankov.Bl -tag -width indent
101da202b0fSYuri Pankov.It Va hw.vmm.maxcpu
102da202b0fSYuri PankovMaximum number of virtual CPUs.
103da202b0fSYuri PankovThe default is the number of physical CPUs in the system.
104da202b0fSYuri Pankov.El
105e1485d78SSean Bruno.Sh EXAMPLES
106e1485d78SSean BrunoReserve three PCI devices for use by the hypervisor: bus 10 slot 0 function 0,
107e1485d78SSean Brunobus 6 slot 5 function 0, and bus 6 slot 5 function 1.
108e1485d78SSean Bruno.Bd -literal -offset indent
109e1485d78SSean Brunopptdevs="10/0/0 6/5/0 6/5/1"
110e1485d78SSean Bruno.Ed
111*9ad28915SChristos Margiolis.Pp
112*9ad28915SChristos MargiolisIt is possible to detach
113*9ad28915SChristos Margiolis.Va ppt
114*9ad28915SChristos Margiolisfrom a PCI device without rebooting the host machine and then attach a host
115*9ad28915SChristos Margiolisdriver, using the
116*9ad28915SChristos Margiolis.Xr devctl 8
117*9ad28915SChristos Margiolisutility.
118*9ad28915SChristos MargiolisSuppose
119*9ad28915SChristos Margiolis.Va ppt
120*9ad28915SChristos Margiolisis currently attached to
121*9ad28915SChristos Margiolis.Va pci0:0:1:0
122*9ad28915SChristos Margiolisand we want the host's
123*9ad28915SChristos Margiolis.Xr xhci 4
124*9ad28915SChristos Margiolisdriver to be attached instead:
125*9ad28915SChristos Margiolis.Bd -literal -offset indent
126*9ad28915SChristos Margiolis# devctl set driver -f pci0:0:1:0 xhci
127*9ad28915SChristos Margiolis.Ed
128*9ad28915SChristos Margiolis.Pp
129*9ad28915SChristos MargiolisThe same can be applied to attach
130*9ad28915SChristos Margiolis.Va ppt
131*9ad28915SChristos Margiolisback:
132*9ad28915SChristos Margiolis.Bd -literal -offset indent
133*9ad28915SChristos Margiolis# devctl set driver -f pci0:0:1:0 ppt
134*9ad28915SChristos Margiolis.Ed
135e1485d78SSean Bruno.Sh SEE ALSO
136e1485d78SSean Bruno.Xr bhyve 4 ,
137e1485d78SSean Bruno.Xr loader.conf 5 ,
138e1485d78SSean Bruno.Xr bhyve 8 ,
139e1485d78SSean Bruno.Xr bhyveload 8 ,
140*9ad28915SChristos Margiolis.Xr devctl 8 ,
141e1485d78SSean Bruno.Xr kldload 8
142e1485d78SSean Bruno.Sh HISTORY
143e1485d78SSean Bruno.Nm vmm.ko
144e1485d78SSean Brunofirst appeared in
145e1485d78SSean Bruno.Fx 10.0 .
146e1485d78SSean Bruno.Sh AUTHORS
147e1485d78SSean Bruno.An Neel Natu Aq neel@freebsd.org
148e1485d78SSean Bruno.An Peter Grehan Aq grehan@freebsd.org
149