9.4. Setting Addresses for Devices
9.4. Setting Addresses for Devices Many devices have an optional <address> sub-element which is used to describe where the device is placed on the virtual bus presented to the guest virtual machine. If an address (or any optional attribute within an address) is omitted on input, libvirt will generate an appropriate address; but an explicit address is required if more control over layout is required. See Figure 9.6, "XML example for PCI device assignment" for domain XML device examples including an <address> element. Every address has a mandatory attribute type that describes which bus the device is on. The choice of which address to use for a given device is constrained in part by the device and the architecture of the guest virtual machine. For example, a <disk> device uses type='drive' , while a <console> device would use type='pci' on i686 or x86_64 guest virtual machine architectures. Each address type has further optional attributes that control where on the bus the device will be placed as described in the table: Table 9.1. Supported device address types Address type Description type='pci' PCI addresses have the following additional attributes: domain (a 2-byte hex integer, not currently used by qemu) bus (a hex value between 0 and 0xff, inclusive) slot (a hex value between 0x0 and 0x1f, inclusive) function (a value between 0 and 7, inclusive) multifunction controls turning on the multifunction bit for a particular slot/function in the PCI control register By default it is set to 'off', but should be set to 'on' for function 0 of a slot that will have multiple functions used. type='drive' Drive addresses have the following additional attributes: controller (a 2-digit controller number) bus (a 2-digit bus number target (a 2-digit bus number) unit (a 2-digit unit number on the bus) type='virtio-serial' Each virtio-serial address has the following additional attributes: controller (a 2-digit controller number) bus (a 2-digit bus number) slot (a 2-digit slot within the bus) type='ccid' A CCID address, for smart-cards, has the following additional attributes: bus (a 2-digit bus number) slot attribute (a 2-digit slot within the bus) type='usb' USB addresses have the following additional attributes: bus (a hex value between 0 and 0xfff, inclusive) port (a dotted notation of up to four octets, such as 1.2 or 2.1.3.1) type='isa' ISA addresses have the following additional attributes: iobase irq