Installation guide
Adding a PCI device with virsh
109
Record the PCI device number; the number is needed in other steps.
2. Information on the domain, bus and function are available from output of the virsh nodedev-
dumpxml command:
# virsh nodedev-dumpxml pci_8086_3a6c
<device>
<name>pci_8086_3a6c</name>
<parent>computer</parent>
<capability type='pci'>
<domain>0</domain>
<bus>0</bus>
<slot>26</slot>
<function>7</function>
<id='0x3a6c'>82801JD/DO (ICH10 Family) USB2 EHCI Controller #2</product>
<vendor id='0x8086'>Intel Corporation</vendor>
</capability>
</device>
3. Detach the device from the system. Attached devices cannot be used and may cause various
errors if connected to a guest without detaching first.
# virsh nodedev-dettach pci_8086_3a6c
Device pci_8086_3a6c dettached
4. Convert slot and function values to hexadecimal values (from decimal) to get the PCI bus
addresses. Append "0x" to the beginning of the output to tell the computer that the value is a
hexadecimal number.
For example, if bus = 0, slot = 26 and function = 7 run the following:
$ printf %x 0
0
$ printf %x 26
1a
$ printf %x 7
7
The values to use:
bus='0x00'
slot='0x1a'
function='0x7'
5. Run virsh edit (or virsh attach device) and added a device entry in the <devices> section to
attach the PCI device to the guest.
# virsh edit win2k3
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x00' slot='0x1a' function='0x7'/>
</source>
</hostdev>
6. Once the guest system is configured to use the PCI address, the host system must be configured
to stop using the device. The ehci driver is loaded by default for the USB PCI controller.