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 April 26, 2024 26.Dt BHYVE 8 27.Os 28.Sh NAME 29.Nm bhyve 30.Nd "run a guest operating system inside a virtual machine" 31.Sh SYNOPSIS 32.Nm 33.Op Fl aCDeHhPSuWwxY 34.Oo 35.Sm off 36.Fl c\~ 37.Oo 38.Op Cm cpus= 39.Ar numcpus 40.Oc 41.Op Cm ,sockets= Ar n 42.Op Cm ,cores= Ar n 43.Op Cm ,threads= Ar n 44.Oc 45.Sm on 46.Oo Fl f 47.Sm off 48.Ar name Cm \&, 49.Oo 50.Cm string No | Cm file 51.Oc 52.Cm \&= Ar data 53.Sm on 54.Oc 55.Oo 56.Sm off 57.Fl G\~ 58.Oo Ar w Oc 59.Oo Ar bind_address Cm \&: Oc 60.Ar port 61.Sm on 62.Oc 63.Op Fl k Ar config_file 64.Op Fl K Ar layout 65.Oo Fl l 66.Sm off 67.Ar lpcdev Op Cm \&, Ar conf 68.Sm on 69.Oc 70.Sm off 71.Oo Fl m\~ 72.Ar memsize 73.Oo 74.Cm K | Cm k | Cm M | Cm m | Cm G | Cm g | Cm T | Cm t 75.Oc 76.Sm on 77.Oc 78.Op Fl o Ar var Ns Cm = Ns Ar value 79.Op Fl p Ar vcpu Ns Cm \&: Ns Ar hostcpu 80.Op Fl r Ar file 81.Sm off 82.Oo Fl s\~ 83.Ar slot Cm \&, Ar emulation Op Cm \&, Ar conf 84.Sm on 85.Oc 86.Op Fl U Ar uuid 87.Ar vmname 88.Nm 89.Fl l Cm help 90.Nm 91.Fl s Cm help 92.Sh DESCRIPTION 93.Nm 94is a hypervisor that runs guest operating systems inside a 95virtual machine. 96It can run guests on amd64 and arm64 platforms with suitable hardware support. 97.Pp 98Parameters such as the number of virtual CPUs, amount of guest memory, and 99I/O connectivity can be specified with command-line parameters. 100.Pp 101.Nm 102is typically used with a boot ROM that can load the guest operating system. 103On arm64 platforms, this is currently required. 104If not using a boot ROM, the guest operating system must be loaded with 105.Xr bhyveload 8 106or a similar boot loader before running 107.Nm , 108otherwise. 109On amd64, the 110.Pa edk2-bhyve 111package provides a UEFI firmware that can be used to boot the guest; 112on arm64 the 113.Pa u-boot-bhyve-arm64 114package provides a U-Boot image that can be used to boot the guest. 115.Pp 116.Nm 117runs until the guest operating system reboots or an unhandled hypervisor 118exit is detected. 119.Sh OPTIONS 120.Bl -tag -width 10n 121.It Fl a 122The guest's local APIC is configured in xAPIC mode. 123This option only applies to the amd64 platform. 124xAPIC mode is the default setting so this option is redundant. 125It will be deprecated in a future version. 126.It Fl C 127Include guest memory in core files. 128.It Fl c Op Ar setting ... 129Number of guest virtual CPUs 130and/or the CPU topology. 131The default value for each of 132.Ar numcpus , 133.Ar sockets , 134.Ar cores , 135and 136.Ar threads 137is 1. 138If 139.Ar numcpus 140is not specified then it will be calculated from the other arguments. 141The topology must be consistent in that the 142.Ar numcpus 143must equal the product of 144.Ar sockets , 145.Ar cores , 146and 147.Ar threads . 148If a 149.Ar setting 150is specified more than once the last one has precedence. 151.Pp 152The maximum number of virtual CPUs defaults to the number of active 153physical CPUs in the system available via the 154.Va hw.vmm.maxcpu 155.Xr sysctl 8 156variable. 157The limit can be adjusted via the 158.Va hw.vmm.maxcpu 159loader tunable. 160.It Fl D 161Destroy the VM on guest initiated power-off. 162.It Fl e 163Force 164.Nm 165to exit when a guest issues an access to an I/O port that is not emulated. 166This is intended for debug purposes and only applies to the amd64 platform. 167.It Fl f Ar name Ns Cm \&, Ns Oo Cm string Ns No | Ns Cm file Ns Oc Ns Cm \&= Ns Ar data 168Add a fw_cfg file 169.Ar name 170to the fw_cfg interface. 171If a 172.Cm string 173is specified, the fw_cfg file contains the string as data. 174If a 175.Cm file 176is specified, bhyve reads the file and adds the file content as fw_cfg data. 177.It Fl G Xo 178.Sm off 179.Oo Ar w Oc 180.Oo Ar bind_address Cm \&: Oc 181.Ar port 182.Sm on 183.Xc 184Start a debug server that uses the GDB protocol to export guest state to a 185debugger. 186An IPv4 TCP socket will be bound to the supplied 187.Ar bind_address 188and 189.Ar port 190to listen for debugger connections. 191Only a single debugger may be attached to the debug server at a time. 192If the option begins with 193.Sq w , 194.Nm 195will pause execution at the first instruction waiting for a debugger to attach. 196.It Fl H 197Yield the virtual CPU thread when a HLT instruction is detected. 198If this option is not specified, virtual CPUs will use 100% of a host CPU. 199This option applies only to the amd64 platform. 200.It Fl h 201Print help message and exit. 202.It Fl k Ar config_file 203Set configuration variables from a simple, key-value config file. 204Each line of the config file is expected to consist of a config variable 205name, an equals sign 206.Pq Sq = , 207and a value. 208No spaces are permitted between the variable name, equals sign, or 209value. 210Blank lines and lines starting with 211.Sq # 212are ignored. 213See 214.Xr bhyve_config 5 215for more details. 216.It Fl K Ar layout 217Specify the keyboard layout. 218The value that can be specified sets the file name in 219.Ar /usr/share/bhyve/kbdlayout . 220This specification only works when loaded with UEFI mode for VNC. 221When using a VNC client that supports QEMU Extended Key Event Message (e.g. 222TigerVNC), this option isn't needed. 223When using a VNC client that doesn't support QEMU Extended Key Event Message 224(e.g. tightVNC), the layout defaults to the US keyboard unless specified 225otherwise. 226.It Fl l Cm help 227Print a list of supported LPC devices. 228.It Fl l Ar lpcdev Ns Op Cm \&, Ns Ar conf 229Allow devices behind the LPC PCI-ISA bridge to be configured. 230The only supported devices are the TTY-class devices 231.Cm com1 , com2 , com3 , 232and 233.Cm com4 , 234the TPM module 235.Cm tpm , 236the boot ROM device 237.Cm bootrom , 238the 239.Cm fwcfg 240type and the debug/test device 241.Cm pc-testdev . 242.Pp 243The possible values for the 244.Ar conf 245argument are listed in the 246.Fl s 247flag description. 248.Pp 249This option applies only to the amd64 platform. 250On arm64, the console and boot ROM devices are configured using the 251more generic 252.Fl o 253option. 254.It Xo 255.Fl m Ar memsize Ns Oo 256.Sm off 257.Cm K | k | M | m | G | g | T | t 258.Sm on 259.Oc 260.Xc 261Set the guest physical memory size. 262This must be the same size that was given to 263.Xr bhyveload 8 . 264.Pp 265The size argument may be suffixed with one of 266.Cm K , M , G 267or 268.Cm T 269(either upper or lower case) 270to indicate a multiple of kilobytes, megabytes, gigabytes, or terabytes. 271If no suffix is given, the value is assumed to be in megabytes. 272.Pp 273The default is 256M. 274.It Fl o Ar var Ns Cm = Ns Ar value 275Set the configuration variable 276.Ar var 277to 278.Ar value . 279See 280.Xr bhyve_config 5 281for configuration options. 282.It Fl P 283Force the guest virtual CPU to exit when a PAUSE instruction is detected. 284This option applies only to the amd64 platform. 285.It Fl p Ar vcpu Ns Cm \& : Ns Ar hostcpu 286Pin guest's virtual CPU 287.Em vcpu 288to 289.Em hostcpu . 290Host CPUs and guest virtual CPUs are numbered starting from 0. 291A 292.Fl p 293option is required for every guest vCPU to be pinned. 294To map a 4 vCPU guest to host CPUs 12-15: 295.Bd -literal 296-p 0:12 -p 1:13 -p 2:14 -p 3:15 297.Ed 298.It Fl r Ar file 299Resume a guest from a snapshot. 300The guest memory contents are restored from 301.Ar file , 302and the guest device and vCPU state are restored from the file 303.Dq Ar file Ns .kern . 304.Pp 305Note that the current snapshot file format requires that the 306configuration of devices in the new VM match the VM from which the 307snapshot was taken by specifying the same 308.Fl s 309and 310.Fl l 311options. 312The count of vCPUs and memory configuration are read from the snapshot. 313.It Fl S 314Wire guest memory. 315.It Fl s Cm help 316Print a list of supported PCI devices. 317.It Fl s Ar slot Ns Cm \&, Ns Ar emulation Ns Op Cm \&, Ns Ar conf 318Configure a virtual PCI slot and function. 319.Pp 320.Nm 321provides PCI bus emulation and virtual devices that can be attached to 322slots on the bus. 323There are 32 available slots, with the option of providing up to 8 functions 324per slot. 325.Pp 326The 327.Ar slot 328can be specified in one of the following formats: 329.Pp 330.Bl -bullet -compact 331.It 332.Ar pcislot 333.It 334.Sm off 335.Ar pcislot Cm \&: Ar function 336.Sm on 337.It 338.Sm off 339.Ar bus Cm \&: Ar pcislot Cm \&: Ar function 340.Sm on 341.El 342.Pp 343The 344.Ar pcislot 345value is 0 to 31. 346The optional 347.Ar function 348value is 0 to 7. 349The optional 350.Ar bus 351value is 0 to 255. 352If not specified, the 353.Ar function 354value defaults to 0. 355If not specified, the 356.Ar bus 357value defaults to 0. 358.Pp 359See 360.Sx "PCI EMULATION" 361for available options for the 362.Ar emulation 363argument. 364.It Fl U Ar uuid 365Set the universally unique identifier 366.Pq UUID 367in the guest's System Management BIOS System Information structure. 368By default a UUID is generated from the host's hostname and 369.Ar vmname . 370.It Fl u 371RTC keeps UTC time. 372.It Fl W 373Force virtio PCI device emulations to use MSI interrupts instead of MSI-X 374interrupts. 375.It Fl w 376Ignore accesses to unimplemented Model Specific Registers (MSRs). 377This is intended for debug purposes. 378.It Fl x 379The guest's local APIC is configured in x2APIC mode. 380This option applies only to the amd64 platform. 381.It Fl Y 382Disable MPtable generation. 383This option applies only to the amd64 platform. 384.It Ar vmname 385Alphanumeric name of the guest. 386This should be the same as that created by 387.Xr bhyveload 8 . 388.El 389.Sh PCI EMULATION 390.Nm 391provides emulation for various PCI devices. 392They are specified by the 393.Fl s 394.Ar slot,emulation,conf 395configuration's 396.Ar emulation 397argument, which can be one of the following: 398.Bl -tag -width "amd_hostbridge" 399.It Cm hostbridge 400A simple host bridge. 401This is usually configured at slot 0, and is required by most guest 402operating systems. 403.It Cm amd_hostbridge 404Emulation identical to 405.Cm hostbridge 406using a PCI vendor ID of AMD. 407.It Cm passthru 408PCI pass-through device. 409.It Cm virtio-net 410Virtio network interface. 411.It Cm virtio-blk 412Virtio block storage interface. 413.It Cm virtio-scsi 414Virtio SCSI interface. 415.It Cm virtio-9p 416Virtio 9p (VirtFS) interface. 417.It Cm virtio-rnd 418Virtio RNG interface. 419.It Cm virtio-console 420Virtio console interface, which exposes multiple ports 421to the guest in the form of simple char devices for simple IO 422between the guest and host userspaces. 423.It Cm virtio-input 424Virtio input interface. 425.It Cm ahci 426AHCI controller attached to arbitrary devices. 427.It Cm ahci-cd 428AHCI controller attached to an ATAPI CD/DVD. 429.It Cm ahci-hd 430AHCI controller attached to a SATA hard drive. 431.It Cm e1000 432Intel e82545 network interface. 433.It Cm uart 434PCI 16550 serial device. 435.It Cm lpc 436LPC PCI-ISA bridge with COM1, COM2, COM3, and COM4 16550 serial ports, 437a boot ROM, and, 438optionally, a fwcfg type, and the debug/test device. 439The LPC bridge emulation can only be configured on bus 0. 440.It Cm fbuf 441Raw framebuffer device attached to VNC server. 442.It Cm xhci 443eXtensible Host Controller Interface (xHCI) USB controller. 444.It Cm nvme 445NVM Express (NVMe) controller. 446.It Cm hda 447High Definition Audio Controller. 448.El 449.Pp 450The optional parameter 451.Ar conf 452describes the backend for device emulations. 453If 454.Ar conf 455is not specified, the device emulation has no backend and can be 456considered unconnected. 457.Ss Network device backends 458.Sm off 459.Bl -bullet 460.It 461.Xo 462.Cm tap Ar N 463.Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx 464.Op Cm \&,mtu= Ar N 465.Xc 466.It 467.Xo 468.Cm vmnet Ar N 469.Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx 470.Op Cm \&,mtu= Ar N 471.Xc 472.It 473.Xo 474.Cm netgraph,path= Ar ADDRESS Cm \&,peerhook= Ar HOOK 475.Op Cm \&,socket= Ar NAME 476.Op Cm \&,hook= Ar HOOK 477.Op Cm \&,mac= Ar xx:xx:xx:xx:xx:xx 478.Op Cm \&,mtu= Ar N 479.Xc 480.It 481.Xo 482.Cm slirp,hostfwd= Ar proto : Ar hostaddr : Ar hostport - Ar guestaddr : Ar guestport 483.Xc 484.El 485.Sm on 486.Pp 487If 488.Cm mac 489is not specified, the MAC address is derived from a fixed OUI, and the 490remaining bytes from an MD5 hash of the slot and function numbers and 491the device name. 492.Pp 493The MAC address is an ASCII string in 494.Xr ethers 5 495format. 496.Pp 497With 498.Cm virtio-net 499devices, the 500.Cm mtu 501parameter can be specified to inform the guest about the largest MTU 502that should be allowed, expressed in bytes. 503.Pp 504With 505.Cm netgraph 506backend, the 507.Cm path 508and 509.Cm peerhook 510parameters must be specified to set the destination node and corresponding hook. 511The optional parameters 512.Cm socket 513and 514.Cm hook 515may be used to set the 516.Xr ng_socket 4 517node name and source hook. 518The 519.Ar ADDRESS , 520.Ar HOOK , 521and 522.Ar NAME 523must comply with 524.Xr netgraph 4 525addressing rules. 526.Pp 527The slirp backend can be used to provide a NATed network to the guest. 528This backend has poor performance but does not require any network 529configuration on the host system. 530It depends on the 531.Pa net/libslirp 532port. 533The 534.Cm hostfwd 535option takes a 5-tuple describing how connections from the host are to be 536forwarded to the guest. 537Multiple rules can be specified, separated by semicolons. 538Note that semicolons must be escaped or quoted to prevent the shell from 539interpreting them. 540.Ss Block storage device backends: 541.Bl -bullet 542.Sm off 543.It 544.Ar /filename Op Cm \&, Ar block-device-options 545.It 546.Ar /dev/xxx Op Cm \&, Ar block-device-options 547.Sm on 548.El 549.Pp 550The 551.Ar block-device-options 552are: 553.Bl -tag -width 10n 554.It Cm nocache 555Open the file with 556.Dv O_DIRECT . 557.It Cm direct 558Open the file using 559.Dv O_SYNC . 560.It Cm ro 561Force the file to be opened read-only. 562.It Cm sectorsize= Ns Ar logical Ns Oo Cm \&/ Ns Ar physical Oc 563Specify the logical and physical sector sizes of the emulated disk. 564The physical sector size is optional and is equal to the logical sector size 565if not explicitly specified. 566.It Cm nodelete 567Disable emulation of guest trim requests via 568.Dv DIOCGDELETE 569requests. 570.It Li bootindex= Ns Ar index 571Add the device to the bootorder at 572.Ar index . 573A fwcfg file is used to specify the bootorder. 574The guest firmware may ignore or doesn't support this fwcfg file. 575In that case, this feature doesn't work as expected. 576.El 577.Ss SCSI device backends 578.Bl -bullet 579.Sm off 580.It 581.Pa /dev/cam/ctl Oo Ar pp Cm \&. Ar vp Oc Oo Cm \&, Ar scsi-device-options Oc 582.Sm on 583.El 584.Pp 585The 586.Ar scsi-device-options 587are: 588.Bl -tag -width 10n 589.It Cm iid= Ns Ar IID 590Initiator ID to use when sending requests to specified CTL port. 591The default value is 0. 592.It Li bootindex= Ns Ar index 593Add the device to the bootorder at 594.Ar index . 595A fwcfg file is used to specify the bootorder. 596The guest firmware may ignore or doesn't support this fwcfg file. 597In that case, this feature doesn't work as expected. 598.El 599.Ss 9P device backends 600.Bl -bullet 601.Sm off 602.It 603.Ar sharename Cm = Ar /path/to/share Op Cm \&, Ar 9p-device-options 604.Sm on 605.El 606.Pp 607The 608.Ar 9p-device-options 609are: 610.Bl -tag -width 10n 611.It Cm ro 612Expose the share in read-only mode. 613.El 614.Ss TTY device backends 615.Bl -tag -width 10n 616.It Cm stdio 617Connect the serial port to the standard input and output of 618the 619.Nm 620process. 621.It Ar /dev/xxx 622Use the host TTY device for serial port I/O. 623.El 624.Ss TPM device backends 625.Bl -bullet 626.Sm off 627.It 628.Ar type Ns \&, Ns Ar path Ns Op Cm \&, Ns Ar tpm-device-options 629.Sm on 630.El 631.Pp 632Emulate a TPM device. The argument 633.Ar path 634needs to point to a valid TPM device path, i.e. 635.Pa /dev/tpm0 . 636.El 637.Pp 638Supported options for 639.Ar type : 640.Bl -tag -width 10n 641.It Cm passthru 642pass a physical TPM device through to the guest 643.El 644.Pp 645The 646.Ar tpm-device-options 647are: 648.Bl -tag -width 10n 649.It Cm version= Ns Ar version 650Version of the TPM device according to the TCG specification. 651Defaults to 652.Cm 2.0 653.El 654.Ss Boot ROM device backends 655.Sm off 656.Bl -bullet 657.It 658.Ar romfile Ns Op Cm \&, Ns Ar varfile 659.El 660.Sm on 661.Pp 662Map 663.Ar romfile 664in the guest address space reserved for boot firmware. 665.Pp 666If 667.Ar varfile 668is provided, that file is also mapped in the boot firmware guest 669address space, and any modifications the guest makes will be saved 670to that file. 671.Pp 672Fwcfg types: 673.Bl -tag -width 10n 674.It Ar fwcfg 675The fwcfg interface is used to pass information such as the CPU count 676or ACPI tables to the guest firmware. 677Supported values are 678.Ql bhyve 679and 680.Ql qemu . 681Due to backward compatibility reasons, 682.Ql bhyve 683is the default option. 684When 685.Ql bhyve 686is used, bhyve's fwctl interface is used. 687It currently reports only the CPU count to the guest firmware. 688The 689.Ql qemu 690option uses QEMU's fwcfg interface. 691This interface is widely used and allows user-defined information to 692be passed to the guest. 693It is used for passing the CPU count, ACPI tables, a boot order and 694many other things to the guest. 695Some operating systems such as Fedora CoreOS can be configured by 696qemu's fwcfg interface as well. 697.El 698.Ss Pass-through device backends 699.Sm off 700.Bl -bullet 701.It 702.Cm ppt Ar N Oo , Ar passthru-device-options Oc 703.It 704.Ns Ar bus Cm \&/ Ar slot Cm \&/ Ar function 705.Op , Ar passthru-device-options 706.It 707.Cm pci Ar bus Cm : Ar slot Cm : Ns Ar function 708.Op , Ar passthru-device-options 709.El 710.Sm on 711.Pp 712Connect to a PCI device on the host either named ppt 713.Ns Ar N 714or at the selector described by 715.Ar slot , 716.Ar bus , 717and 718.Ar function 719numbers. 720.Pp 721The 722.Ar passthru-device-options 723are: 724.Bl -tag -width 10n 725.It Cm rom= Ns Ar romfile 726Add 727.Ar romfile 728as option ROM to the PCI device. 729The ROM will be loaded by firmware and should be capable of 730initializing the device. 731.It Li bootindex= Ns Ar index 732Add the device to the bootorder at 733.Ar index . 734A fwcfg file is used to specify the bootorder. 735The guest firmware may ignore or doesn't support this fwcfg file. 736In that case, this feature doesn't work as expected. 737.El 738.Pp 739Guest memory must be wired using the 740.Fl S 741option when a pass-through device is configured. 742.Pp 743The host device must have been reserved at boot-time using the 744.Va pptdevs 745loader variable as described in 746.Xr vmm 4 . 747.Ss Virtio console device backends 748.Bl -bullet 749.Sm off 750.It 751.Cm port1= Ns Ar /path/to/port1.sock Ns Op Cm ,port Ns Ar N Cm \&= Ns Ar /path/to/port2.sock No \~ Ar ... 752.Sm on 753.El 754.Pp 755A maximum of 16 ports per device can be created. 756Every port is named and corresponds to a Unix domain socket created by 757.Nm . 758.Nm 759accepts at most one connection per port at a time. 760.Pp 761Limitations: 762.Bl -bullet 763.It 764Due to the lack of destructors in 765.Nm , 766sockets on the filesystem must be cleaned up manually after 767.Nm 768exits. 769.It 770There is no way to use the 771.Dq console port 772feature, nor the console port 773resize at present. 774.It 775Emergency write is advertised, but no-op at present. 776.El 777.Ss Virtio input device backends: 778.Bl -bullet 779.Sm off 780.It 781.Ar /dev/input/eventX 782.Sm on 783.El 784.Pp 785Send input events of 786.Ar /dev/input/eventX 787to guest by VirtIO Input Interface. 788.Ss Framebuffer device backends 789.Bl -bullet 790.Sm off 791.It 792.Op Cm rfb= Ar ip-and-port 793.Op Cm ,w= Ar width 794.Op Cm ,h= Ar height 795.Op Cm ,vga= Ar vgaconf 796.Op Cm ,wait 797.Op Cm ,password= Ar password 798.Sm on 799.El 800.Pp 801Configuration options are defined as follows: 802.Bl -tag -width 10n 803.It Cm rfb= Ns Ar ip-and-port Pq or Cm tcp= Ns Ar ip-and-port 804An IP address and a port VNC should listen on. 805There are two formats: 806.Pp 807.Bl -bullet -compact 808.It 809.Sm off 810.Op Ar IPv4 Cm \&: 811.Ar port 812.Sm on 813.It 814.Sm off 815.Cm \&[ Ar IPv6%zone Cm \&] Cm \&: Ar port 816.Sm on 817.El 818.Pp 819The default is to listen on localhost IPv4 address and default VNC port 5900. 820An IPv6 address must be enclosed in square brackets and may contain an 821optional zone identifier. 822.It Cm w= Ns Ar width No and Cm h= Ns Ar height 823A display resolution, width and height, respectively. 824If not specified, a default resolution of 1024x768 pixels will be used. 825Minimal supported resolution is 640x480 pixels, 826and maximum is 3840x2160 pixels. 827.It Cm vga= Ns Ar vgaconf 828Possible values for this option are 829.Cm io 830(default), 831.Cm on , 832and 833.Cm off . 834PCI graphics cards have a dual personality in that they are 835standard PCI devices with BAR addressing, but may also 836implicitly decode legacy VGA I/O space 837.Pq Ad 0x3c0-3df 838and memory space 839.Pq 64KB at Ad 0xA0000 . 840The default 841.Cm io 842option should be used for guests that attempt to issue BIOS calls which result 843in I/O port queries, and fail to boot if I/O decode is disabled. 844.Pp 845The 846.Cm on 847option should be used along with the CSM BIOS capability in UEFI 848to boot traditional BIOS guests that require the legacy VGA I/O and 849memory regions to be available. 850.Pp 851The 852.Cm off 853option should be used for the UEFI guests that assume that 854VGA adapter is present if they detect the I/O ports. 855An example of such a guest is 856.Ox 857in UEFI mode. 858.Pp 859Please refer to the 860.Nm 861.Fx 862wiki page 863.Pq Lk https://wiki.freebsd.org/bhyve 864for configuration notes of particular guests. 865.It Cm wait 866Instruct 867.Nm 868to only boot upon the initiation of a VNC connection, simplifying the 869installation of operating systems that require immediate keyboard input. 870This can be removed for post-installation use. 871.It Cm password= Ns Ar password 872This type of authentication is known to be cryptographically weak and is not 873intended for use on untrusted networks. 874Many implementations will want to use stronger security, such as running 875the session over an encrypted channel provided by IPsec or SSH. 876.El 877.Ss xHCI USB device backends 878.Bl -bullet 879.Sm off 880.It 881.Ar tablet 882.Sm on 883.El 884.Pp 885A USB tablet device that provides precise cursor synchronization 886when using VNC. 887.Ss NVMe device backends 888.Bl -bullet 889.Sm off 890.It 891.Ar devpath 892.Op Cm ,maxq= Ar # 893.Op Cm ,qsz= Ar # 894.Op Cm ,ioslots= Ar # 895.Op Cm ,sectsz= Ar # 896.Op Cm ,ser= Ar # 897.Op Cm ,eui64= Ar # 898.Op Cm ,dsm= Ar opt 899.Sm on 900.El 901.Pp 902Configuration options are defined as follows: 903.Bl -tag -width 10n 904.It Ar devpath 905Accepted device paths are: 906.Ar /dev/blockdev 907or 908.Ar /path/to/image 909or 910.Cm ram= Ns Ar size_in_MiB . 911.It Cm maxq 912Max number of queues. 913.It Cm qsz 914Max elements in each queue. 915.It Cm ioslots 916Max number of concurrent I/O requests. 917.It Cm sectsz 918Sector size (defaults to blockif sector size). 919.It Cm ser 920Serial number with maximum 20 characters. 921.It Cm eui64 922IEEE Extended Unique Identifier (8 byte value). 923.It Cm dsm 924DataSet Management support. 925Supported values are: 926.Cm auto , enable , 927and 928.Cm disable . 929.El 930.Ss AHCI device backends 931.Bl -bullet 932.It 933.Sm off 934.Op Oo Cm hd\&: | cd\&: Oc Ar path 935.Op Cm ,nmrr= Ar nmrr 936.Op Cm ,ser= Ar # 937.Op Cm ,rev= Ar # 938.Op Cm ,model= Ar # 939.Sm on 940.El 941.Pp 942Configuration options are defined as follows: 943.Bl -tag -width 10n 944.It Cm nmrr 945Nominal Media Rotation Rate, known as RPM. 946Value 1 will indicate device as Solid State Disk. 947Default value is 0, not report. 948.It Cm ser 949Serial Number with maximum 20 characters. 950.It Cm rev 951Revision Number with maximum 8 characters. 952.It Cm model 953Model Number with maximum 40 characters. 954.El 955.Ss HD Audio device backends 956.Bl -bullet 957.It 958.Sm off 959.Op Cm play= Ar playback 960.Op Cm ,rec= Ar recording 961.Sm on 962.El 963.Pp 964Configuration options are defined as follows: 965.Bl -tag -width 10n 966.It Cm play 967Playback device, typically 968.Ar /dev/dsp0 . 969.It Cm rec 970Recording device, typically 971.Ar /dev/dsp0 . 972.El 973.Sh CONFIGURATION VARIABLES 974.Nm 975uses an internal tree of configuration variables to describe global and 976per-device settings. 977When 978.Nm 979starts, 980it parses command line options (including config files) in the order given 981on the command line. 982Each command line option sets one or more configuration variables. 983For example, 984the 985.Fl s 986option creates a new tree node for a PCI device and sets one or more variables 987under that node including the device model and device model-specific variables. 988Variables may be set multiple times during this parsing stage with the final 989value overriding previous values. 990.Pp 991Once all of the command line options have been processed, 992the configuration values are frozen. 993.Nm 994then uses the value of configuration values to initialize device models 995and global settings. 996.Pp 997More details on configuration variables can be found in 998.Xr bhyve_config 5 . 999.Sh CONFIGURATION FILE CREATION 1000The 1001.Fl k 1002flag allows one to provide a path to a configuration file holding all 1003settings, which otherwise would need to be defined by providing a long 1004list of program arguments to 1005.Nm . 1006.Pp 1007There is a very simple way to translate a complex set of program 1008arguments to an equivalent configuration file in 1009.Xr bhyve_config 5 1010format. 1011.Pp 1012Use 1013.Fl o 1014.Ar config.dump=1 1015to make 1016.Nm 1017dump a configuration file representing the used flags and arguments to 1018stdout. You can pipe the output into a file to persist the generated settings. 1019.Pp 1020Make sure to remove the 1021.Ar config.dump 1022line from the resulting configuration file before using it to start 1023.Nm . 1024.Sh DEBUG SERVER 1025The current debug server provides limited support for debuggers. 1026.Ss Registers 1027Each virtual CPU is exposed to the debugger as a thread. 1028.Pp 1029General purpose registers can be queried for each virtual CPU, but other 1030registers such as floating-point and system registers cannot be queried. 1031.Ss Memory 1032Memory (including memory mapped I/O regions) can be read and written 1033by the debugger. 1034Memory operations use virtual addresses that are resolved to physical 1035addresses via the current virtual CPU's active address translation. 1036.Ss Control 1037The running guest can be interrupted by the debugger at any time 1038.Pq for example, by pressing Ctrl-C in the debugger . 1039.Pp 1040Single stepping is only supported on Intel CPUs supporting the MTRAP VM exit. 1041.Pp 1042Breakpoints are supported on Intel CPUs that support single stepping. 1043Note that continuing from a breakpoint while interrupts are enabled in the 1044guest may not work as expected due to timer interrupts firing while single 1045stepping over the breakpoint. 1046.Sh SIGNAL HANDLING 1047.Nm 1048deals with the following signals: 1049.Pp 1050.Bl -tag -width SIGTERM -compact 1051.It SIGTERM 1052Trigger ACPI poweroff for a VM 1053.El 1054.Sh EXIT STATUS 1055Exit status indicates how the VM was terminated: 1056.Pp 1057.Bl -tag -width indent -compact 1058.It 0 1059rebooted 1060.It 1 1061powered off 1062.It 2 1063halted 1064.It 3 1065triple fault 1066.It 4 1067exited due to an error 1068.El 1069.Sh EXAMPLES 1070If not using a boot ROM, the guest operating system must have been loaded with 1071.Xr bhyveload 8 1072or a similar boot loader before 1073.Xr bhyve 4 1074can be run. 1075Otherwise, the boot loader is not needed. 1076.Pp 1077To run a virtual machine with 1GB of memory, two virtual CPUs, a virtio 1078block device backed by the 1079.Pa /my/image 1080filesystem image, and a serial port for the console: 1081.Bd -literal -offset indent 1082bhyve -c 2 -s 0,hostbridge -s 1,lpc -s 2,virtio-blk,/my/image \\ 1083 -l com1,stdio -H -P -m 1G vm1 1084.Ed 1085.Pp 1086To do the same on arm64: 1087.Bd -literal -offset indent 1088.Ed 1089bhyve -c 2 -s 0,hostbridge -s 1,virtio-blk,/my/image -o console=stdio \\ 1090 -o bootrom=/usr/local/share/u-boot/u-boot-bhyve-arm64/u-boot.bin -m 1G vm1 1091.Pp 1092Run a 24GB single-CPU virtual machine with three network ports, one of which 1093has a MAC address specified: 1094.Bd -literal -offset indent 1095bhyve -s 0,hostbridge -s 1,lpc -s 2:0,virtio-net,tap0 \\ 1096 -s 2:1,virtio-net,tap1 \\ 1097 -s 2:2,virtio-net,tap2,mac=00:be:fa:76:45:00 \\ 1098 -s 3,virtio-blk,/my/image -l com1,stdio \\ 1099 -H -P -m 24G bigvm 1100.Ed 1101.Pp 1102Run an 8GB quad-CPU virtual machine with 8 AHCI SATA disks, an AHCI ATAPI 1103CD-ROM, a single virtio network port, an AMD hostbridge, and the console 1104port connected to an 1105.Xr nmdm 4 1106null-modem device. 1107.Bd -literal -offset indent 1108bhyve -c 4 \\ 1109 -s 0,amd_hostbridge -s 1,lpc \\ 1110 -s 1:0,ahci,hd:/images/disk.1,hd:/images/disk.2,\\ 1111hd:/images/disk.3,hd:/images/disk.4,\\ 1112hd:/images/disk.5,hd:/images/disk.6,\\ 1113hd:/images/disk.7,hd:/images/disk.8,\\ 1114cd:/images/install.iso \\ 1115 -s 3,virtio-net,tap0 \\ 1116 -l com1,/dev/nmdm0A \\ 1117 -H -P -m 8G 1118.Ed 1119.Pp 1120Run a UEFI virtual machine with a display resolution of 800 by 600 pixels 1121that can be accessed via VNC at: 0.0.0.0:5900. 1122.Bd -literal -offset indent 1123bhyve -c 2 -m 4G -w -H \\ 1124 -s 0,hostbridge \\ 1125 -s 3,ahci-cd,/path/to/uefi-OS-install.iso \\ 1126 -s 4,ahci-hd,disk.img \\ 1127 -s 5,virtio-net,tap0 \\ 1128 -s 29,fbuf,tcp=0.0.0.0:5900,w=800,h=600,wait \\ 1129 -s 30,xhci,tablet \\ 1130 -s 31,lpc -l com1,stdio \\ 1131 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ 1132 uefivm 1133.Ed 1134.Pp 1135Run a UEFI virtual machine with a VNC display that is bound to all IPv6 1136addresses on port 5900. 1137.Bd -literal -offset indent 1138bhyve -c 2 -m 4G -w -H \\ 1139 -s 0,hostbridge \\ 1140 -s 4,ahci-hd,disk.img \\ 1141 -s 5,virtio-net,tap0 \\ 1142 -s 29,fbuf,tcp=[::]:5900,w=800,h=600 \\ 1143 -s 30,xhci,tablet \\ 1144 -s 31,lpc -l com1,stdio \\ 1145 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \\ 1146 uefivm 1147.Ed 1148.Pp 1149Run a UEFI virtual machine with a VARS file to save EFI variables. 1150Note that 1151.Nm 1152will write guest modifications to the given VARS file. 1153Be sure to create a per-guest copy of the template VARS file from 1154.Pa /usr . 1155.Bd -literal -offset indent 1156bhyve -c 2 -m 4g -w -H \\ 1157 -s 0,hostbridge \\ 1158 -s 31,lpc -l com1,stdio \\ 1159 -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE.fd,BHYVE_UEFI_VARS.fd 1160 uefivm 1161.Ed 1162.Pp 1163To create a configuration file 1164.Pa configfile 1165for a virtual machine, use 1166.Fl o 1167.Ar config.dump=1 : 1168.Bd -literal -offset indent 1169/usr/sbin/bhyve -c 2 -m 256 -A -H -P \\ 1170 -s 0:0,hostbridge -s 1:0,virtio-net,tap0 \\ 1171 -s 2:0,ahci-hd,./vm0.img \\ 1172 -s 31,lpc -l com1,stdio \\ 1173 -o config.dump=1 vm0 > configfile 1174.Ed 1175.Pp 1176Then use an editor of your choice to remove the line "config.dump=1" 1177from the newly generated 1178.Pa configfile . 1179.Pp 1180To start 1181.Nm 1182using this configuration file, use flag 1183.Fl k : 1184.Bd -literal -offset indent 1185/usr/sbin/bhyve -k configfile vm0 1186.Ed 1187.Sh SEE ALSO 1188.Xr bhyve 4 , 1189.Xr netgraph 4 , 1190.Xr ng_socket 4 , 1191.Xr nmdm 4 , 1192.Xr vmm 4 , 1193.Xr bhyve_config 5 , 1194.Xr ethers 5 , 1195.Xr bhyvectl 8 , 1196.Xr bhyveload 8 1197.Pp 1198.Rs 1199.%A Intel 1200.%B 64 and IA-32 Architectures Software Developer’s Manual 1201.%V Volume 3 1202.Re 1203.Sh HISTORY 1204.Nm 1205first appeared in 1206.Fx 10.0 . 1207.Sh AUTHORS 1208.An Neel Natu Aq Mt neel@freebsd.org 1209.An Peter Grehan Aq Mt grehan@freebsd.org 1210