20.16.3. Device Addresses
Many devices have an optional
<address>
sub-element to describe where the device placed on the virtual bus is 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 below for 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='disk'
, while a console device would use type='pci'
on the 32-bit AMD and Intel architecture or AMD64 and Intel 64 guest virtual machines, or type='spapr-vio'
on PowerPC64 pseries guest virtual machines. Each address <type>
has additional optional attributes that control where on the bus the device will be placed. The additional attributes are as follows:
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)- Also available is the
multifunction
attribute, which controls turning on the multifunction bit for a particular slot/function in the PCI control register. This multifunction attribute defaults 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, used 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='spapr-vio
- On PowerPC pseries guest virtual machines, devices can be assigned to the SPAPR-VIO bus. It has a flat 64-bit address space; by convention, devices are generally assigned at a non-zero multiple of 0x1000, but other addresses are valid and permitted by libvirt. The additional attribute: reg (the hex value address of the starting register) can be assigned to this attribute.