1b13e60daSPeter Grehan.\" Copyright (c) 2013 Peter Grehan 2b13e60daSPeter Grehan.\" All rights reserved. 3b13e60daSPeter Grehan.\" 4b13e60daSPeter Grehan.\" Redistribution and use in source and binary forms, with or without 5b13e60daSPeter Grehan.\" modification, are permitted provided that the following conditions 6b13e60daSPeter Grehan.\" are met: 7b13e60daSPeter Grehan.\" 1. Redistributions of source code must retain the above copyright 8b13e60daSPeter Grehan.\" notice, this list of conditions and the following disclaimer. 9b13e60daSPeter Grehan.\" 2. Redistributions in binary form must reproduce the above copyright 10b13e60daSPeter Grehan.\" notice, this list of conditions and the following disclaimer in the 11b13e60daSPeter Grehan.\" documentation and/or other materials provided with the distribution. 12b13e60daSPeter Grehan.\" 13b13e60daSPeter Grehan.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 14b13e60daSPeter Grehan.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15b13e60daSPeter Grehan.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16b13e60daSPeter Grehan.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 17b13e60daSPeter Grehan.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18b13e60daSPeter Grehan.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19b13e60daSPeter Grehan.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20b13e60daSPeter Grehan.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21b13e60daSPeter Grehan.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22b13e60daSPeter Grehan.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23b13e60daSPeter Grehan.\" SUCH DAMAGE. 24b13e60daSPeter Grehan.\" 25b13e60daSPeter Grehan.\" $FreeBSD$ 26b13e60daSPeter Grehan.\" 27*84fe889cSChristian Brueffer.Dd August 7, 2015 28b13e60daSPeter Grehan.Dt BHYVE 8 29b13e60daSPeter Grehan.Os 30b13e60daSPeter Grehan.Sh NAME 31b13e60daSPeter Grehan.Nm bhyve 32b13e60daSPeter Grehan.Nd "run a guest operating system inside a virtual machine" 33b13e60daSPeter Grehan.Sh SYNOPSIS 34b13e60daSPeter Grehan.Nm 359b1aa8d6SNeel Natu.Op Fl abehuwxACHPSWY 36b13e60daSPeter Grehan.Op Fl c Ar numcpus 37b13e60daSPeter Grehan.Op Fl g Ar gdbport 38cde1f5b8SJohn Baldwin.Op Fl l Ar lpcdev Ns Op , Ns Ar conf 395749449dSJohn Baldwin.Op Fl m Ar size Ns Op Ar K|k|M|m|G|g|T|t 409b6155a2SNeel Natu.Op Fl p Ar vcpu:hostcpu 41b13e60daSPeter Grehan.Op Fl s Ar slot,emulation Ns Op , Ns Ar conf 425749449dSJohn Baldwin.Op Fl U Ar uuid 43b13e60daSPeter Grehan.Ar vmname 44b13e60daSPeter Grehan.Sh DESCRIPTION 45b13e60daSPeter Grehan.Nm 467fca1ad5SGlen Barberis a hypervisor that runs guest operating systems inside a 47b13e60daSPeter Grehanvirtual machine. 48b13e60daSPeter Grehan.Pp 49b13e60daSPeter GrehanParameters such as the number of virtual CPUs, amount of guest memory, and 50b13e60daSPeter GrehanI/O connectivity can be specified with command-line parameters. 51b13e60daSPeter Grehan.Pp 52b13e60daSPeter GrehanThe guest operating system must be loaded with 53*84fe889cSChristian Brueffer.Xr bhyveload 8 54b13e60daSPeter Grehanor a similar boot loader before running 55b13e60daSPeter Grehan.Nm . 56b13e60daSPeter Grehan.Pp 57b13e60daSPeter Grehan.Nm 58b13e60daSPeter Grehanruns until the guest operating system reboots or an unhandled hypervisor 59b13e60daSPeter Grehanexit is detected. 60b13e60daSPeter Grehan.Sh OPTIONS 61b13e60daSPeter Grehan.Bl -tag -width 10n 62b13e60daSPeter Grehan.It Fl a 639777ca20SNeel NatuThe guest's local APIC is configured in xAPIC mode. 64*84fe889cSChristian BruefferThe xAPIC mode is the default setting so this option is redundant. 65*84fe889cSChristian BruefferIt will be deprecated in a future version. 66b13e60daSPeter Grehan.It Fl A 67b13e60daSPeter GrehanGenerate ACPI tables. 68b13e60daSPeter GrehanRequired for 69b13e60daSPeter Grehan.Fx Ns /amd64 70b13e60daSPeter Grehanguests. 715749449dSJohn Baldwin.It Fl b 725749449dSJohn BaldwinEnable a low-level console device supported by 73aca4343cSEdward Tomasz Napierala.Fx 74aca4343cSEdward Tomasz Napieralakernels compiled with 755749449dSJohn Baldwin.Cd "device bvmconsole" . 765749449dSJohn BaldwinThis option will be deprecated in a future version. 77b13e60daSPeter Grehan.It Fl c Ar numcpus 78b13e60daSPeter GrehanNumber of guest virtual CPUs. 79b13e60daSPeter GrehanThe default is 1 and the maximum is 16. 800dd10c00SNeel Natu.It Fl C 810dd10c00SNeel NatuInclude guest memory in core file. 82cde1f5b8SJohn Baldwin.It Fl e 83cde1f5b8SJohn BaldwinForce 84cde1f5b8SJohn Baldwin.Nm 85cde1f5b8SJohn Baldwinto exit when a guest issues an access to an I/O port that is not emulated. 86cde1f5b8SJohn BaldwinThis is intended for debug purposes. 87b13e60daSPeter Grehan.It Fl g Ar gdbport 88b13e60daSPeter GrehanFor 895749449dSJohn Baldwin.Fx 905749449dSJohn Baldwinkernels compiled with 915749449dSJohn Baldwin.Cd "device bvmdebug" , 92b13e60daSPeter Grehanallow a remote kernel kgdb to be relayed to the guest kernel gdb stub 93b13e60daSPeter Grehanvia a local IPv4 address and this port. 94b13e60daSPeter GrehanThis option will be deprecated in a future version. 95cde1f5b8SJohn Baldwin.It Fl h 96cde1f5b8SJohn BaldwinPrint help message and exit. 97cde1f5b8SJohn Baldwin.It Fl H 98cde1f5b8SJohn BaldwinYield the virtual CPU thread when a HLT instruction is detected. 99cde1f5b8SJohn BaldwinIf this option is not specified, virtual CPUs will use 100% of a host CPU. 100cde1f5b8SJohn Baldwin.It Fl l Ar lpcdev Ns Op , Ns Ar conf 101cde1f5b8SJohn BaldwinAllow devices behind the LPC PCI-ISA bridge to be configured. 1029b1aa8d6SNeel NatuThe only supported devices are the TTY-class devices 1039b1aa8d6SNeel Natu.Ar com1 104cde1f5b8SJohn Baldwinand 1059b1aa8d6SNeel Natu.Ar com2 1069b1aa8d6SNeel Natuand the boot ROM device 1079b1aa8d6SNeel Natu.Ar bootrom . 108cde1f5b8SJohn Baldwin.It Fl m Ar size Ns Op Ar K|k|M|m|G|g|T|t 109cde1f5b8SJohn BaldwinGuest physical memory size in bytes. 110cde1f5b8SJohn BaldwinThis must be the same size that was given to 111cde1f5b8SJohn Baldwin.Xr bhyveload 8 . 112cde1f5b8SJohn Baldwin.Pp 113cde1f5b8SJohn BaldwinThe size argument may be suffixed with one of K, M, G or T (either upper 114cde1f5b8SJohn Baldwinor lower case) to indicate a multiple of kilobytes, megabytes, gigabytes, 115cde1f5b8SJohn Baldwinor terabytes. 116cde1f5b8SJohn BaldwinIf no suffix is given, the value is assumed to be in megabytes. 1179b6155a2SNeel Natu.It Fl p Ar vcpu:hostcpu 1189b6155a2SNeel NatuPin guest's virtual CPU 1199b6155a2SNeel Natu.Em vcpu 1209b6155a2SNeel Natuto 1219b6155a2SNeel Natu.Em hostcpu . 122b13e60daSPeter Grehan.It Fl P 123b13e60daSPeter GrehanForce the guest virtual CPU to exit when a PAUSE instruction is detected. 124b13e60daSPeter Grehan.It Fl s Ar slot,emulation Ns Op , Ns Ar conf 125b13e60daSPeter GrehanConfigure a virtual PCI slot and function. 126b13e60daSPeter Grehan.Pp 127*84fe889cSChristian Brueffer.Nm 128b13e60daSPeter Grehanprovides PCI bus emulation and virtual devices that can be attached to 129b13e60daSPeter Grehanslots on the bus. 130b13e60daSPeter GrehanThere are 32 available slots, with the option of providing up to 8 functions 131b13e60daSPeter Grehanper slot. 132b13e60daSPeter Grehan.Bl -tag -width 10n 133b13e60daSPeter Grehan.It Ar slot 13406db1b4aSNeel Natu.Ar pcislot[:function] 13506db1b4aSNeel Natu.Ar bus:pcislot:function 136b13e60daSPeter Grehan.Pp 137b13e60daSPeter GrehanThe 138b13e60daSPeter Grehan.Ar pcislot 139*84fe889cSChristian Brueffervalue is 0 to 31. 140*84fe889cSChristian BruefferThe optional 141*84fe889cSChristian Brueffer.Ar function 142*84fe889cSChristian Brueffervalue is 0 to 7. 143*84fe889cSChristian BruefferThe optional 14406db1b4aSNeel Natu.Ar bus 14506db1b4aSNeel Natuvalue is 0 to 255. 146*84fe889cSChristian BruefferIf not specified, the 147*84fe889cSChristian Brueffer.Ar function 148*84fe889cSChristian Brueffervalue defaults to 0. 149*84fe889cSChristian BruefferIf not specified, the 150*84fe889cSChristian Brueffer.Ar bus 151*84fe889cSChristian Brueffervalue defaults to 0. 152b13e60daSPeter Grehan.It Ar emulation 153b13e60daSPeter Grehan.Bl -tag -width 10n 154b13e60daSPeter Grehan.It Li hostbridge | Li amd_hostbridge 155b13e60daSPeter Grehan.Pp 156b13e60daSPeter GrehanProvide a simple host bridge. 157b13e60daSPeter GrehanThis is usually configured at slot 0, and is required by most guest 158b13e60daSPeter Grehanoperating systems. 159b13e60daSPeter GrehanThe 160b13e60daSPeter Grehan.Li amd_hostbridge 161b13e60daSPeter Grehanemulation is identical but uses a PCI vendor ID of 162b13e60daSPeter Grehan.Li AMD . 163b13e60daSPeter Grehan.It Li passthru 164b13e60daSPeter GrehanPCI pass-through device. 165b13e60daSPeter Grehan.It Li virtio-net 166b13e60daSPeter GrehanVirtio network interface. 167a8be8e5eSRemko Lodder.It Li virtio-blk 168b13e60daSPeter GrehanVirtio block storage interface. 1699d0c4e17SPeter Grehan.It Li virtio-rnd 1709d0c4e17SPeter GrehanVirtio RNG interface. 171b13e60daSPeter Grehan.It Li ahci-cd 172b13e60daSPeter GrehanAHCI controller attached to an ATAPI CD/DVD. 173b13e60daSPeter Grehan.It Li ahci-hd 174b13e60daSPeter GrehanAHCI controller attached to a SATA hard-drive. 175b13e60daSPeter Grehan.It Li uart 176b13e60daSPeter GrehanPCI 16550 serial device. 177b13e60daSPeter Grehan.It Li lpc 1789b1aa8d6SNeel NatuLPC PCI-ISA bridge with COM1 and COM2 16550 serial ports and a boot ROM. 1799b1aa8d6SNeel NatuThe LPC bridge emulation can only be configured on bus 0. 180b13e60daSPeter Grehan.El 181b13e60daSPeter Grehan.It Op Ar conf 182b13e60daSPeter GrehanThis optional parameter describes the backend for device emulations. 183b13e60daSPeter GrehanIf 184b13e60daSPeter Grehan.Ar conf 185b13e60daSPeter Grehanis not specified, the device emulation has no backend and can be 186b13e60daSPeter Grehanconsidered unconnected. 187b13e60daSPeter Grehan.Pp 188b13e60daSPeter GrehanNetwork devices: 189b13e60daSPeter Grehan.Bl -tag -width 10n 190b13e60daSPeter Grehan.It Ar tapN Ns Op , Ns Ar mac=xx:xx:xx:xx:xx:xx 191b13e60daSPeter Grehan.It Ar vmnetN Ns Op , Ns Ar mac=xx:xx:xx:xx:xx:xx 192b13e60daSPeter Grehan.Pp 193b13e60daSPeter GrehanIf 194b13e60daSPeter Grehan.Ar mac 195b13e60daSPeter Grehanis not specified, the MAC address is derived from a fixed OUI and the 196b13e60daSPeter Grehanremaining bytes from an MD5 hash of the slot and function numbers and 197b13e60daSPeter Grehanthe device name. 198b13e60daSPeter Grehan.Pp 199b13e60daSPeter GrehanThe MAC address is an ASCII string in 200b13e60daSPeter Grehan.Xr ethers 5 201b13e60daSPeter Grehanformat. 202b13e60daSPeter Grehan.El 203b13e60daSPeter Grehan.Pp 204b13e60daSPeter GrehanBlock storage devices: 205b13e60daSPeter Grehan.Bl -tag -width 10n 2064e43c1e8SNeel Natu.It Pa /filename Ns Oo , Ns Ar block-device-options Oc 2074e43c1e8SNeel Natu.It Pa /dev/xxx Ns Oo , Ns Ar block-device-options Oc 2084e43c1e8SNeel Natu.El 2094e43c1e8SNeel Natu.Pp 2104e43c1e8SNeel NatuThe 2114e43c1e8SNeel Natu.Ar block-device-options 2124e43c1e8SNeel Natuare: 213b13e60daSPeter Grehan.Bl -tag -width 8n 214b13e60daSPeter Grehan.It Li nocache 215b13e60daSPeter GrehanOpen the file with 216b13e60daSPeter Grehan.Dv O_DIRECT . 217b13e60daSPeter Grehan.It Li direct 218b13e60daSPeter GrehanOpen the file using 219b13e60daSPeter Grehan.Dv O_SYNC . 220b13e60daSPeter Grehan.It Li ro 221b13e60daSPeter GrehanForce the file to be opened read-only. 2224e43c1e8SNeel Natu.It Li sectorsize= Ns Ar logical Ns Oo / Ns Ar physical Oc 2234e43c1e8SNeel NatuSpecify the logical and physical sector sizes of the emulated disk. 2244e43c1e8SNeel NatuThe physical sector size is optional and is equal to the logical sector size 2254e43c1e8SNeel Natuif not explicitly specified. 226b13e60daSPeter Grehan.El 227b13e60daSPeter Grehan.Pp 228b13e60daSPeter GrehanTTY devices: 229b13e60daSPeter Grehan.Bl -tag -width 10n 230b13e60daSPeter Grehan.It Li stdio 231b13e60daSPeter GrehanConnect the serial port to the standard input and output of 232*84fe889cSChristian Bruefferthe 233*84fe889cSChristian Brueffer.Nm 234*84fe889cSChristian Bruefferprocess. 235b13e60daSPeter Grehan.It Pa /dev/xxx 236b13e60daSPeter GrehanUse the host TTY device for serial port I/O. 237b13e60daSPeter Grehan.El 238b13e60daSPeter Grehan.Pp 2399b1aa8d6SNeel NatuBoot ROM device: 2409b1aa8d6SNeel Natu.Bl -tag -width 10n 2419b1aa8d6SNeel Natu.It Pa romfile 2429b1aa8d6SNeel NatuMap 2439b1aa8d6SNeel Natu.Ar romfile 2449b1aa8d6SNeel Natuin the guest address space reserved for boot firmware. 2459b1aa8d6SNeel Natu.El 2469b1aa8d6SNeel Natu.Pp 247b13e60daSPeter GrehanPass-through devices: 248b13e60daSPeter Grehan.Bl -tag -width 10n 249b13e60daSPeter Grehan.It Ns Ar slot Ns / Ns Ar bus Ns / Ns Ar function 250b13e60daSPeter GrehanConnect to a PCI device on the host at the selector described by 251b13e60daSPeter Grehan.Ar slot , 252b13e60daSPeter Grehan.Ar bus , 253b13e60daSPeter Grehanand 254b13e60daSPeter Grehan.Ar function 255b13e60daSPeter Grehannumbers. 256b13e60daSPeter Grehan.El 257b13e60daSPeter Grehan.Pp 2589b1aa8d6SNeel NatuGuest memory must be wired using the 2599b1aa8d6SNeel Natu.Fl S 2609b1aa8d6SNeel Natuoption when a pass-through device is configured. 2619b1aa8d6SNeel Natu.Pp 262b13e60daSPeter GrehanThe host device must have been reserved at boot-time using the 263b13e60daSPeter Grehan.Va pptdev 264b13e60daSPeter Grehanloader variable as described in 265b13e60daSPeter Grehan.Xr vmm 4 . 266b13e60daSPeter Grehan.El 2679b1aa8d6SNeel Natu.It Fl S 2689b1aa8d6SNeel NatuWire guest memory. 269c9747678SNeel Natu.It Fl u 270c9747678SNeel NatuRTC keeps UTC time. 2715749449dSJohn Baldwin.It Fl U Ar uuid 2725749449dSJohn BaldwinSet the universally unique identifier 2735749449dSJohn Baldwin.Pq UUID 2745749449dSJohn Baldwinin the guest's System Management BIOS System Information structure. 2755749449dSJohn BaldwinBy default a UUID is generated from the host's hostname and 2765749449dSJohn Baldwin.Ar vmname . 277851d84f1SNeel Natu.It Fl w 278*84fe889cSChristian BruefferIgnore accesses to unimplemented Model Specific Registers (MSRs). 279*84fe889cSChristian BruefferThis is intended for debug purposes. 280cde1f5b8SJohn Baldwin.It Fl W 281cde1f5b8SJohn BaldwinForce virtio PCI device emulations to use MSI interrupts instead of MSI-X 282cde1f5b8SJohn Baldwininterrupts. 2839777ca20SNeel Natu.It Fl x 2849777ca20SNeel NatuThe guest's local APIC is configured in x2APIC mode. 285b100acf2SNeel Natu.It Fl Y 286b100acf2SNeel NatuDisable MPtable generation. 287b13e60daSPeter Grehan.It Ar vmname 288b13e60daSPeter GrehanAlphanumeric name of the guest. 289b13e60daSPeter GrehanThis should be the same as that created by 290b13e60daSPeter Grehan.Xr bhyveload 8 . 291b13e60daSPeter Grehan.El 292b13e60daSPeter Grehan.Sh EXAMPLES 293b13e60daSPeter GrehanThe guest operating system must have been loaded with 294*84fe889cSChristian Brueffer.Xr bhyveload 8 295b13e60daSPeter Grehanor a similar boot loader before 296b13e60daSPeter Grehan.Xr bhyve 4 297b13e60daSPeter Grehancan be run. 298b13e60daSPeter Grehan.Pp 299b13e60daSPeter GrehanTo run a virtual machine with 1GB of memory, two virtual CPUs, a virtio 300b13e60daSPeter Grehanblock device backed by the 301b13e60daSPeter Grehan.Pa /my/image 302b13e60daSPeter Grehanfilesystem image, and a serial port for the console: 303b13e60daSPeter Grehan.Bd -literal -offset indent 304b13e60daSPeter Grehanbhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \\ 305b13e60daSPeter Grehan -l com1,stdio -A -H -P -m 1G vm1 306b13e60daSPeter Grehan.Ed 307b13e60daSPeter Grehan.Pp 308b13e60daSPeter GrehanRun a 24GB single-CPU virtual machine with three network ports, one of which 309b13e60daSPeter Grehanhas a MAC address specified: 310b13e60daSPeter Grehan.Bd -literal -offset indent 311b13e60daSPeter Grehanbhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\ 312b13e60daSPeter Grehan -s 2:1,virtio-net,tap1 \\ 313b13e60daSPeter Grehan -s 2:2,virtio-net,tap2,mac=00:be:fa:76:45:00 \\ 314b13e60daSPeter Grehan -s 3,virtio-blk,/my/image -l com1,stdio \\ 315b13e60daSPeter Grehan -A -H -P -m 24G bigvm 316b13e60daSPeter Grehan.Ed 317b13e60daSPeter Grehan.Pp 318b13e60daSPeter GrehanRun an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI 319b13e60daSPeter GrehanCD-ROM, a single virtio network port, an AMD hostbridge, and the console 320b13e60daSPeter Grehanport connected to an 321b13e60daSPeter Grehan.Xr nmdm 4 322*84fe889cSChristian Brueffernull-modem device. 323b13e60daSPeter Grehan.Bd -literal -offset indent 324b13e60daSPeter Grehanbhyve -c 4 \e\ 325b13e60daSPeter Grehan -s 0,amd_hostbridge -s 1,lpc \\ 326b13e60daSPeter Grehan -s 1:0,ahci-hd,/images/disk.1 \\ 327b13e60daSPeter Grehan -s 1:1,ahci-hd,/images/disk.2 \\ 328b13e60daSPeter Grehan -s 1:2,ahci-hd,/images/disk.3 \\ 329b13e60daSPeter Grehan -s 1:3,ahci-hd,/images/disk.4 \\ 330b13e60daSPeter Grehan -s 1:4,ahci-hd,/images/disk.5 \\ 331b13e60daSPeter Grehan -s 1:5,ahci-hd,/images/disk.6 \\ 332b13e60daSPeter Grehan -s 1:6,ahci-hd,/images/disk.7 \\ 333b13e60daSPeter Grehan -s 1:7,ahci-hd,/images/disk.8 \\ 334b13e60daSPeter Grehan -s 2,ahci-cd,/images.install.iso \\ 335b13e60daSPeter Grehan -s 3,virtio-net,tap0 \\ 336b13e60daSPeter Grehan -l com1,/dev/nmdm0A \\ 337b13e60daSPeter Grehan -A -H -P -m 8G 338b13e60daSPeter Grehan.Ed 339b13e60daSPeter Grehan.Sh SEE ALSO 340b13e60daSPeter Grehan.Xr bhyve 4 , 341b13e60daSPeter Grehan.Xr nmdm 4 , 342b13e60daSPeter Grehan.Xr vmm 4 , 343b13e60daSPeter Grehan.Xr ethers 5 , 34405f7cd8bSJoel Dahl.Xr bhyvectl 8 , 34505f7cd8bSJoel Dahl.Xr bhyveload 8 346b13e60daSPeter Grehan.Sh HISTORY 347b13e60daSPeter Grehan.Nm 348b13e60daSPeter Grehanfirst appeared in 349b13e60daSPeter Grehan.Fx 10.0 . 350b13e60daSPeter Grehan.Sh AUTHORS 35101c2b8acSBaptiste Daroussin.An Neel Natu Aq Mt neel@freebsd.org 35201c2b8acSBaptiste Daroussin.An Peter Grehan Aq Mt grehan@freebsd.org 353