tp-qemu
tp-qemu copied to clipboard
pci_devices test: device should be conneted to downstream port using device number 0
See this test for example:
065-type_specific.io-github-autotest-qemu.pci_devices.three_devices.xhci_controller.bus_in_bus.bridge_switch_switch
(BTW, its name is confusing. It should be called "root_switch_switch" test. But that's another issue and I filed https://github.com/autotest/tp-qemu/issues/1543 against it).
It generates this command line:
MALLOC_PERTURB_=1 /usr/bin/qemu-system-aarch64 \
...
-device ioh3420,id=test_pci_root1,bus=pcie.0, addr=0x1 \
-device x3130-upstream,id=test_pci_switch1,bus=test_pci_root1,addr=0x0 \
-device xio3130-downstream,bus=test_pci_switch1,id=test_pci_switch1.0,addr=0x0,chassis=1 \
-device x3130-upstream,id=test_pci_switch2,bus=test_pci_switch1.0,addr=0x0 \
-device xio3130-downstream,bus=test_pci_switch2,id=test_pci_switch2.0,addr=0x0,chassis=2 \
-device nec-usb-xhci,id=test_xhci1,addr=0x0,bus=test_pci_switch2.0 \
-device xio3130-downstream,bus=test_pci_switch2,id=test_pci_switch2.27,addr=0x1b,chassis=3 \
-device nec-usb-xhci,id=test_xhci2,addr=0x1b,bus=test_pci_switch2.27 \
-device xio3130-downstream,bus=test_pci_switch2,id=test_pci_switch2.31,addr=0x1f,chassis=4 \
-device nec-usb-xhci,id=test_xhci3,addr=0x1f,bus=test_pci_switch2.31 \
...
And then test fails. The symptom is that the second and third xhci controller is not seen by guest kernel.
I believe the issue is with their attr value. Downstream port can have only one slot. The device plugged into that slot should have its device number as 0. So, their attr value in QEMU CLI should be something like "0x0".
I did a quick look at the code and found the code that caused the issue was in virtest. I managed to change it and got the test working. I'll post a PR in avocado-vt repo later today.
@rayx Thanks for reporting it, this test is out of date, we might abandon this x3130-upstream and xio3130-downstream structure, have something else replacing them. @jingzhao84 Do we plan to replace it with new devices or remove the test?
@vivianQizhu Thanks for the information. I'll leave the issue open to help to track test failures and the change to be made. Feel free to close it if you like.
The issue in virttest QPCISwitchBus class code seems to be a common one. I'll file a separate issue in that repo.