I have been investigating pci pass-through for virtualized guests and the documentation I have found seems to me to lack a certain consistency in its example. This may be due to my not understanding what it is trying to inform me.
What I wish to do is to configure a pci multi-port serial i/o card for use by a single virtual host.
I start by running lspci -v on the host to identify the serial card:
03:00.0 Serial controller: Oxford Semiconductor Ltd OX16PCI954 (Quad 16950 UART) function 0 (Uart) (prog-if 06 [16950]) Subsystem: Oxford Semiconductor Ltd Device 0000 Flags: medium devsel, IRQ 17 I/O ports at d040 [size=32] Memory at d0702000 (32-bit, non-prefetchable) [size=4K] I/O ports at d020 [size=32] Memory at d0701000 (32-bit, non-prefetchable) [size=4K] Capabilities: [40] Power Management version 2 Kernel driver in use: serial
I then check for possible multiple IRQ assignment:
lspci -v | grep ' IRQ 17' Flags: medium devsel, IRQ 17
I next use lspci -n to identify the vendor codes:
lspci -n | grep '00:03.0' 00:03.0 0780: 8086:2e24 (rev 03)
So this is an Intel chipset and the device id is 2e24. Now this is the point in the example where the documentation and I part company. In the examples I have found, although the pci device ids listed from virsh nodedev-list are uniformly of the form pci_0000_00_03_0 those used in the examples then switch and use the form pci_8086_3a6c for the subsequent steps.
This pattern appears to be the prefix pci followed by the manufacturer's code followed by the device id. There is no other mapping to the pci device ids previously reported by virsh nodedev-list and lspci in the examples that I can discern.
However, if I attempt to use the manufacturer and device ids in the next step of the example, substituting those used in the example with those reported on my own system, then I get a device not found reported:
virsh nodedev-dumpxml pci_8086_2e24 error: Could not find matching device 'pci_8086_2e24' error: Node device not found
If instead I use the pci device ids exactly as reported by virsh nodedev-list then I get what I expect:
virsh nodedev-dumpxml pci_0000_00_03_0 <device> <name>pci_0000_00_03_0</name> <parent>computer</parent> <capability type='pci'> <domain>0</domain> <bus>0</bus> <slot>3</slot> <function>0</function> <product id='0x2e24'>4 Series Chipset HECI Controller</product> <vendor id='0x8086'>Intel Corporation</vendor> <capability type='virt_functions'> </capability> </capability> </device>
My question is: Why does the documentation change the form of the pci identifiers used in the second half of the example from those reported previously in the same example? Is this change significant? What does it mean? Am I missing something important here?
On Fri, February 3, 2012 10:34, James B. Byrne wrote:
I have been investigating pci pass-through for virtualized guests and the documentation I have found seems to me to lack a certain consistency in its example. This may be due to my not understanding what it is trying to inform me.
Following along in the example and working on the basis that what is reported by virsh nodedev-dumpxml pci_0000_00_03_0 is what I should use I get to the point where I try the readline command, and discover there is no such link.
Proceeding past this point I detach the pci device from the host. I then edit the guest config file as given in the example only to discover that the changes are not saved. it reported that the configuration was edted by opening the configuration in virtsh edit a second time shows that the added <hostdev></hostdev> section was not saved. Perhaps this is because the example provides no context as to where it is nested within the xml file and my placing it directly within the <domain> </domain> tags is invalid.
Further, the requirement to set setsebool -P virt_manage_sysfs 1 cannot be met since an SELinux boolean of that name does not exist (apparently it was renamed to virt_use_nfs).
The reference I am using is found at:
http://www.linuxtopia.org/online_books/rhel6/rhel_6_virtualization/rhel_6_vi...
However, I do not think that I can recommend it based on my experience.
Evidently I should be using
http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualiza...
Which I had looked for but google apparently does not report. I had to search the RedHat web site using their search interface to locate it. The other site purports to be a rhel6 essentials book.
Nonetheless, while the inconsistencies of the previous documents are resolved in this new reference the example edit of the virtual guest configuration still fails to provide a context for the insertion:
# virsh edit guest1-rhel6-64 <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x000' bus='0x03' slot='0x00' function='0x0'/> </source> </hostdev>
Where does this go inside the rest of the guest configuration?
<domain type='kvm'> <name>inet08.harte-lyne.ca</name> <uuid>6409d721-cfcf-2169-f65e-8f583b685f58</uuid> <description>Inet08 [216.185.71.28] virtual hosts: none</description> <memory>4194304</memory> <currentMemory>4194304</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='rhel6.2.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='block' device='disk'> <driver name='qemu' type='raw' cache='none' io='native'/> <source dev='/dev/vg_vhost01/lv_vm_inet08.harte-lyne.ca_00'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </disk> <disk type='block' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'> <mac address='52:54:00:bf:e9:ac'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <target port='0'/> </serial> <serial type='dev'> <source path='/dev/ttyS0'/> <target port='1'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <sound model='ich6'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </memballoon> </devices> </domain>
I have tried placing the <hostdev> tags after the <devices> tag but the changes simply disappear.
On 02/03/2012 05:32 PM, James B. Byrne wrote:
Where does this go inside the rest of the guest configuration?
virt-manager GUI places PCI device pass-through inside <devices> ... </devices>:
<devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='file' device='cdrom'> <driver name='qemu' type='raw' io='threads'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <disk type='block' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source dev='/dev/storage/win7'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='network'> <mac address='52:54:fe:ab:28:c0'/> <source network='default'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'/> <sound model='ich6'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> <model type='vga' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/> </source> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </hostdev> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices>