1.\" $OpenBSD: pvbus.4,v 1.15 2023/01/07 06:40:21 asou Exp $ 2.\" 3.\" Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org> 4.\" Copyright (c) 2006 Jason McIntyre <jmc@openbsd.org> 5.\" 6.\" Permission to use, copy, modify, and distribute this software for any 7.\" purpose with or without fee is hereby granted, provided that the above 8.\" copyright notice and this permission notice appear in all copies. 9.\" 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" 18.Dd $Mdocdate: January 7 2023 $ 19.Dt PVBUS 4 20.Os 21.Sh NAME 22.Nm pvbus 23.Nd paravirtual device tree root 24.Sh SYNOPSIS 25.Cd "pvbus0 at mainbus0" 26.Pp 27.In sys/types.h 28.In sys/ioctl.h 29.In dev/pv/pvvar.h 30.Sh DESCRIPTION 31.Nm 32is used on virtual machines that are running on hypervisors. 33It provides a pseudo-bus for all paravirtual devices that do not 34attach to a well-known bus like 35.Xr pci 4 . 36The 37.Nm 38driver is responsible for detecting the hypervisor interface, 39checking the capabilities, attaching the paravirtual devices, 40and providing access to supported information stores. 41.Ss Supported hypervisors 42.Bl -tag -width 13n -offset ind -compact 43.It KVM 44Kernel-based Virtual Machine 45.It Hyper-V 46Microsoft Hyper-V 47.It OpenBSD 48.Ox 49.Xr vmm 4 50.It VMware 51VMware vSphere Hypervisor and ESXi 52.It Xen 53Xen VMM 54.El 55.Pp 56Note that a hypervisor can attempt to emulate other hypervisors, so 57multiple hypervisor interfaces may be available on the same host. 58.Ss VMware paravirtual devices 59.Bl -tag -width 13n -offset ind -compact 60.It Xr vmt 4 61VMware Tools driver and 62.Dq guestinfo 63information store 64.El 65.Ss Hyper-V paravirtual devices 66.Bl -tag -width 13n -offset ind -compact 67.It Xr hvn 4 68Hyper-V virtual networking interface 69.It Xr hvs 4 70Hyper-V virtual disk 71.It Xr hyperv 4 72Hyper-V guest nexus device 73.El 74.Ss Xen paravirtual devices 75.Bl -tag -width 13n -offset ind -compact 76.It Xr xbf 4 77Xen Blkfront virtual disk 78.It Xr xen 4 79Xen domU nexus device and XenStore information store 80.It Xr xnf 4 81Xen Netfront virtual networking interface 82.El 83.Sh IOCTL INTERFACE 84.Nm 85supports 86.Xr ioctl 2 87commands to exchange information with the hypervisor interface, 88as implemented in the 89.Xr hostctl 8 90program. 91Each detected hypervisor interface is available as a character special 92device file, 93.Pa /dev/pvbus0 , 94.Pa /dev/pvbus1 , 95etc. 96All available commands use the same 97.Fa pvbus_req 98structure: 99.Bd -literal 100struct pvbus_req { 101 size_t pvr_keylen; 102 char *pvr_key; 103 size_t pvr_valuelen; 104 char *pvr_value; 105}; 106.Ed 107.Pp 108The caller is responsible for attaching character buffers to the 109.Fa pvr_key 110and 111.Fa pvr_value 112fields and to set their length in 113.Fa pvr_keylen 114and 115.Fa pvr_valuelen 116accordingly. 117All keys and values are nul-terminated strings. 118.Pp 119The following 120.Xr ioctl 2 121commands are available: 122.Bl -tag -width PVBUSIOC_KVWRITE 123.It Dv PVBUSIOC_KVREAD 124Read the value from 125.Fa pvr_key 126and return it in 127.Fa pvr_value . 128If 129.Fa pvr_valuelen 130is not enough for the value, 131the command will fail and 132.Xr errno 2 133is set to 134.Er ERANGE . 135.It Dv PVBUSIOC_KVTYPE 136Return the type of the attached hypervisor interface as a string in 137.Fa pvr_key ; 138see 139.Sx Supported hypervisors . 140.It Dv PVBUSIOC_KVWRITE 141Write the new value 142.Fa pvr_value 143to the key 144.Fa pvr_key . 145This command requires write permissions on the device file. 146.El 147.Sh FILES 148.Bl -tag -width "/dev/pvbusX" -compact 149.It /dev/pvbus Ns Ar u 150.Nm 151device unit 152.Ar u 153file. 154.El 155.Sh SEE ALSO 156.Xr autoconf 4 , 157.Xr intro 4 , 158.Xr mainbus 4 , 159.Xr vmm 4 , 160.Xr hostctl 8 161.Sh HISTORY 162The 163.Nm 164pseudo-bus first appeared in 165.Ox 5.8 . 166.Sh AUTHORS 167The 168.Nm 169pseudo-bus was written by 170.An Reyk Floeter Aq Mt reyk@openbsd.org . 171