pci: single device at function != 0
Hi!
It turned out that it is possible to start QEMU with a single PCI device placed at 0:0:1.1. I.e. function#1 and there is no function#0. The existing QEMU only fails if there is function#0 AND the multifunction bit is not set which is not the case.
Is it supposed to work anywhere (x86 may be)?
In our case SLOF does not scan other functions if there is nothing at function#0. And the linux kernel does the same thing - it scans other functions only if sees "multifunction" on function#0.
But I cannot see anywhere in the PCI spec that this configuration is illegal and must not work. Normally "pseries" guest does not scan PCI and uses what it gets via the device tree and if we put there devices at 0:0:1.1, it is expected to see the device and work (but not sure).
So - is it a SLOF bug? Or QEMU just does not have right place before starting the machine to verify that some devices do not have a PCI function at 0 and print a warning that they won't be detected by the guest? Thanks.
This is the command line example:
./qemu-system-ppc64 \
-trace "events=qemu_trace_events" \
-L "qemu-ppc64-bios/" \
-nographic \
-vga "none" \
-device \
virtio-blk-pci,scsi=off,bus=pci,addr=1.1,drive=drive-virtio-disk53,id=virtio-disk53 \
-drive \
file=virtimg/test1,if=none,id=drive-virtio-disk53,format=qcow2,cache=none \
-S \
-m "2048" \
-machine "pseries" \
-enable-kvm \
-kernel "vml312-probe-pci" \
-initrd "1.cpio"
Signature · 1 line
Alexey
Quoted 8 lines · Alexey Kardashevskiy
Hi!
It turned out that it is possible to start QEMU with a single PCI device placed at 0:0:1.1. I.e. function#1 and there is no function#0. The existing QEMU only fails if there is function#0 AND the multifunction bit is not set which is not the case.
Is it supposed to work anywhere (x86 may be)?
Not on normal x86 nor any "real" PCI ... but it does exist in some PAPR cases, usually old stuff, where pHyp would expose individual functions to guests.
Quoted 8 lines
In our case SLOF does not scan other functions if there is nothing at function#0. And the linux kernel does the same thing - it scans other functions only if sees "multifunction" on function#0.
But I cannot see anywhere in the PCI spec that this configuration is illegal and must not work. Normally "pseries" guest does not scan PCI and uses what it gets via the device tree and if we put there devices at 0:0:1.1, it is expected to see the device and work (but not sure).
It is not really a legal configuration
Quoted 25 lines
So - is it a SLOF bug? Or QEMU just does not have right place before starting the machine to verify that some devices do not have a PCI function at 0 and print a warning that they won't be detected by the guest? Thanks.
This is the command line example:
./qemu-system-ppc64 \
-trace "events=qemu_trace_events" \
-L "qemu-ppc64-bios/" \
-nographic \
-vga "none" \
-device \
virtio-blk-pci,scsi=off,bus=pci,addr=1.1,drive=drive-virtio-disk53,id=virtio-disk53 \
-drive \
file=virtimg/test1,if=none,id=drive-virtio-disk53,format=qcow2,cache=none \
-S \
-m "2048" \
-machine "pseries" \
-enable-kvm \
-kernel "vml312-probe-pci" \
-initrd "1.cpio"