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