On 06-May-21 4:09 PM, Bruce Richardson wrote:
If after a bus scan, there are no devices using a particular bus, then that bus should not be taken into account when deciding whether DPDK should be run in VA or PA addressing mode. This becomes an issue when the DSA bus driver code is used on a system without an IOMMU. The PCI bus correctly reports that it only works in PA mode, while the DSA bus - also correctly - reports that it works only in VA mode. The difference is that there will be no devices found in a scan for the DSA bus, since the kernel driver can only present those to userspace in the presence of an IOMMU.While we could change DSA instance to always report that it does not care about the addressing mode, this would imply that it could be used with DPDK in PA mode which is not the case. Therefore, this patch changes the driver to report DC (don't care) in the case where no devices are present, and VA otherwise. NOTE: this addressing mode use of VA-only applies only in the case of using DSA through the idxd kernel driver. The use of DSA though vfio-pci is unaffected and works as with other PCI devices. Fixes: b7aaf417f936 ("raw/ioat: add bus driver for device scanning automatically") Reported-by: Harry van Haaren <[email protected]> Signed-off-by: Bruce Richardson <[email protected]> ---
This would be a good opportunity to start a discussion on a "proper" fix for this, because while this hack is acceptable being so close to release, IMO we need a more general solution. Maybe a bus API reporting number of scanned devices would be nice to have, as EAL will then be able to ignore the opinion of those buses who don't have any devices.
The "number of devices" is a bit of a fluid concept, as number of scanned devices may not be the same as number of *probed* devices, and there's also hotplug. However, i think that we can ignore all that, because we care about initialization only - any other issues can be addressed by forcing --iova-mode by the user, as we cannot really do anything about hotplug or devices that fail to probe.
Thoughts? -- Thanks, Anatoly

