Hotplug Device Does Not Show Correctly in Guest OS
After creating a hotplug device from the BlueField side, probing virtio drivers does not create the virtio-net device correctly.
The problem may happen due to the following reasons.
BAR 0
Possible failure on BAR 0. check dmesg from guest OS for corresponding hotplug BDF:
[10.874845
] pci 0000
:87
:00.1
: BAR 0
: failed to assign [mem size 0x00100000
]
In this example, the hotplug PCIe BDF is 87:00.1. This value can be retrieved using "lspci | grep -i virtio" from the guest OS.
This can be normally resolved by adding "pci=realloc" in the Linux command line (grub).
BAR 14/15
Possible failure on other PCIe BAR. Check the dmesg from the guest OS for the corresponding hotplug BDF:
[ 2893.484281
] pcieport 0000
:10
:01.0
: bridge window [mem 0x00100000
-0x000fffff
] to [bus 12
] add_size 200000
add_align 100000
[ 2893.484285
] pcieport 0000
:10
:01.0
: BAR 14
: no space for
[mem size 0x00200000
]
[ 2893.484287
] pcieport 0000
:10
:01.0
: BAR 14
: failed to assign [mem size 0x00200000
]
[ 2893.484289
] pcieport 0000
:10
:01.0
: BAR 14
: no space for
[mem size 0x00200000
]
[ 2893.484290
] pcieport 0000
:10
:01.0
: BAR 14
: failed to assign [mem size 0x00200000
]
In this example, the hotplug PCIe BDF is 10:01.0. This value can be retrieved using "lspci | grep -i virtio" from the guest OS.
This is mostly due to there being insufficient BAR resources. Try to reduce the PF BAR size by performing the following from the BlueField side:
# mlxconfig -d
03
:00.0
s PF_LOG_BAR_SIZE=0
This can also be caused by the BIOS provider not reserving enough memory. Check the guest OS's dmesg for similar messages for the PCIe bus of the BlueField device:
[
3.979061
] pci_bus0000
:a0: root bus resource [mem0x41c0800000
-0x41c10fffff
window] (9M) [3.979062
] pci_bus0000
:a0: root bus resource [bus a0-bf] [4.017770
] pci0000
:a4:00.0
: bridge window [mem0x41c0800000
-0x41c0ffffff
64bit pref] (8M) [4.018243
] pci0000
:a4:00.0
: BAR15
: no spacefor
[mem size0x05800000
64bit pref] (88M) [4.018245
] pci0000
:a4:00.0
: BAR15
: failed to assign [mem size0x05800000
64bit pref]On the host, the prefetchable memory limit of the root bus ( a0 ) is only 9 M. This means that all the devices under this bus (including BlueField) can only be allocated 9M prefetchable memory in total.
The BAR 15 is the total prefetchable memory limit on the bridge (a4) of the device. The PCI bridge window of the BlueField for prefetchable memory is 8M, but the bridge requires 88M for its child device ( BlueField ). A fter several attempts, the PCIe bridge did not find sufficient IO memory to allocate for BlueField BARs. This can be solved by contacting the BIOS provider to provide enough memory to the PCI root.
Rescan
If the the hotplug operation from the BlueField Arm side is performed before the guest OS is up, and the virtio device is not found by the command "lspci | grep -i virtio". Try to rescan from guest OS:
# echo 1
>/sys/bus/pci/rescan
No Hotplug from BIOS
The server BIOS may not support hotplug device. This can be confirmed by looking at guest OS dmesg:
[8.209406
] acpi PNP0A08:03
: _OSC: platform does not support [PCIeHotplug PME]
Try to enable hotplug from the BIOS:
Force Hotplug
Guest OS may be running a kernel older than 4.19, the virtio device is not found by "lspci | grep -i virtio". Add the entry pciehp.pciehp_force=1 to the grub command line.