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*19cb383dSMark Johnston.Dd December 30, 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. 48*19cb383dSMark JohnstonThe following platforms are supported: 49*19cb383dSMark Johnston.Bl -bullet -compat 50*19cb383dSMark Johnston.It 51*19cb383dSMark Johnstonamd64: An Intel CPU with VT-x/EPT or AMD CPU with SVM support is required. 52*19cb383dSMark Johnston.It 53*19cb383dSMark Johnstonarm64: The boot CPU must start in EL2 and the system must have a GICv3 interrupt 54*19cb383dSMark Johnstoncontroller. 55*19cb383dSMark JohnstonVHE support will be used if available. 56*19cb383dSMark Johnston.It 57*19cb383dSMark Johnstonriscv: The CPUs must implement the H (hypervisor) RISC-V ISA extension. 58*19cb383dSMark Johnston.El 59e1485d78SSean Bruno.Pp 60e1485d78SSean BrunoPCI device passthrough to a virtual machine requires 61*19cb383dSMark Johnstonhardware with VT-d support and is available only on amd64. 62e1485d78SSean Bruno.Sh PCI PASSTHROUGH 63*19cb383dSMark JohnstonOn amd64 where the hardware supports VT-d, 64e1485d78SSean BrunoPCI devices can be reserved for use by the hypervisor. 65e1485d78SSean BrunoEntries consisting of the PCI 66e1485d78SSean Bruno.Ar bus Ns / Ns Ar slot Ns / Ns Ar function 67e1485d78SSean Brunoare added to the 68e1485d78SSean Bruno.Va pptdevs 69e1485d78SSean Bruno.Xr loader.conf 5 70e1485d78SSean Brunovariable. 71e1485d78SSean BrunoAdditional entries are separated by spaces. 72e1485d78SSean BrunoHost PCI devices that match an entry will be assigned to the hypervisor 73e1485d78SSean Brunoand will not be probed by 74e1485d78SSean Bruno.Fx 75e1485d78SSean Brunodevice drivers. 76e1485d78SSean BrunoSee the 77e1485d78SSean Bruno.Sx EXAMPLES 78e1485d78SSean Brunosection below for sample usage. 79e1485d78SSean Bruno.Pp 80d0168b32SMichael GalassiNote that 81d0168b32SMichael Galassi.Nm vmm 82d0168b32SMichael Galassimust be given first the right of refusal to all 83d0168b32SMichael Galassi.Xr pci 4 84d0168b32SMichael Galassidevices it may need to claim. 85d0168b32SMichael GalassiAs a result, the 86d0168b32SMichael Galassi.Nm vmm 87d0168b32SMichael Galassikernel module almost certainly needs to be loaded from 88d0168b32SMichael Galassi.Xr loader.conf 5 89d0168b32SMichael Galassirather than by adding it to 90d0168b32SMichael Galassi.Va kld_list in 91d0168b32SMichael Galassi.Xr rc.conf 5 . 92d0168b32SMichael Galassi.Pp 93e1485d78SSean BrunoA large number of PCI device entries may require a string longer than the 94e1485d78SSean Bruno128-character limit of 95e1485d78SSean Bruno.Xr loader.conf 5 96e1485d78SSean Brunovariables. 97e1485d78SSean BrunoThe 98e1485d78SSean Bruno.Va pptdevs2 99e1485d78SSean Brunoand 100e1485d78SSean Bruno.Va pptdevs3 101e1485d78SSean Brunovariables can be used for additional entries. 102da202b0fSYuri Pankov.Sh LOADER TUNABLES 103da202b0fSYuri PankovTunables can be set at the 104da202b0fSYuri Pankov.Xr loader 8 105da202b0fSYuri Pankovprompt before booting the kernel or stored in 106da202b0fSYuri Pankov.Xr loader.conf 5 . 107da202b0fSYuri Pankov.Bl -tag -width indent 108da202b0fSYuri Pankov.It Va hw.vmm.maxcpu 109da202b0fSYuri PankovMaximum number of virtual CPUs. 110da202b0fSYuri PankovThe default is the number of physical CPUs in the system. 111da202b0fSYuri Pankov.El 112e1485d78SSean Bruno.Sh EXAMPLES 113e1485d78SSean BrunoReserve three PCI devices for use by the hypervisor: bus 10 slot 0 function 0, 114e1485d78SSean Brunobus 6 slot 5 function 0, and bus 6 slot 5 function 1. 115e1485d78SSean Bruno.Bd -literal -offset indent 116e1485d78SSean Brunopptdevs="10/0/0 6/5/0 6/5/1" 117e1485d78SSean Bruno.Ed 1189ad28915SChristos Margiolis.Pp 1199ad28915SChristos MargiolisIt is possible to detach 1209ad28915SChristos Margiolis.Va ppt 1219ad28915SChristos Margiolisfrom a PCI device without rebooting the host machine and then attach a host 1229ad28915SChristos Margiolisdriver, using the 1239ad28915SChristos Margiolis.Xr devctl 8 1249ad28915SChristos Margiolisutility. 1259ad28915SChristos MargiolisSuppose 1269ad28915SChristos Margiolis.Va ppt 1279ad28915SChristos Margiolisis currently attached to 1289ad28915SChristos Margiolis.Va pci0:0:1:0 1299ad28915SChristos Margiolisand we want the host's 1309ad28915SChristos Margiolis.Xr xhci 4 1319ad28915SChristos Margiolisdriver to be attached instead: 1329ad28915SChristos Margiolis.Bd -literal -offset indent 1339ad28915SChristos Margiolis# devctl set driver -f pci0:0:1:0 xhci 1349ad28915SChristos Margiolis.Ed 1359ad28915SChristos Margiolis.Pp 1369ad28915SChristos MargiolisThe same can be applied to attach 1379ad28915SChristos Margiolis.Va ppt 1389ad28915SChristos Margiolisback: 1399ad28915SChristos Margiolis.Bd -literal -offset indent 1409ad28915SChristos Margiolis# devctl set driver -f pci0:0:1:0 ppt 1419ad28915SChristos Margiolis.Ed 142e1485d78SSean Bruno.Sh SEE ALSO 143e1485d78SSean Bruno.Xr bhyve 4 , 144e1485d78SSean Bruno.Xr loader.conf 5 , 145e1485d78SSean Bruno.Xr bhyve 8 , 146e1485d78SSean Bruno.Xr bhyveload 8 , 1479ad28915SChristos Margiolis.Xr devctl 8 , 148e1485d78SSean Bruno.Xr kldload 8 149e1485d78SSean Bruno.Sh HISTORY 150e1485d78SSean Bruno.Nm vmm.ko 151e1485d78SSean Brunofirst appeared in 152e1485d78SSean Bruno.Fx 10.0 . 153*19cb383dSMark Johnstonarm64 and riscv support first appeared in 154*19cb383dSMark Johnston.Fx 15.0 . 155e1485d78SSean Bruno.Sh AUTHORS 156e1485d78SSean Bruno.An Neel Natu Aq neel@freebsd.org 157e1485d78SSean Bruno.An Peter Grehan Aq grehan@freebsd.org 158