path: root/drivers/bus
AgeCommit message (Collapse)Author
2018-11-12devargs: do not replace already inserted deviceThomas Monjalon
The devargs of a device can be replaced by a newly allocated one when trying to probe again the same device (multi-process or multi-ports scenarios). This is breaking some pointer references. It can be avoided by copying the new content, freeing the new devargs, and returning the already inserted pointer. Signed-off-by: Thomas Monjalon <> Tested-by: Darek Stojaczyk <> Tested-by: Qi Zhang <> Tested-by: Viacheslav Ovsiienko <>
2018-11-06bus/pci: fix config r/w accessFan Zhang
The recent change to rte_pci_read/write_config() missed uio_pci_generic case. Fixes: 630deed612ca ("bus/pci: compare kernel driver instead of interrupt handler") Cc: Signed-off-by: Fan Zhang <> Signed-off-by: Thomas Monjalon <>
2018-11-05bus/pci: avoid call to DMA mask checkAlejandro Lucero
Calling rte_mem_check_dma_mask when memory has not been initialized yet is wrong. This patch use rte_mem_set_dma_mask instead. Once memory initialization is done, the dma mask set will be used for checking memory mapped is within the specified mask. Fixes: fe822eb8c565 ("bus/pci: use IOVA DMA mask check when setting IOVA mode") Signed-off-by: Alejandro Lucero <> Tested-by: Ferruh Yigit <>
2018-11-05mem: rename DMA mask check with proper prefixAlejandro Lucero
Current name rte_eal_check_dma_mask does not follow the naming used in the rest of the file. Signed-off-by: Alejandro Lucero <> Tested-by: Ferruh Yigit <>
2018-11-04bus/dpaa: fix build with gcc 9.0Ferruh Yigit
build error: In function ‘fman_if_init’, .../drivers/bus/dpaa/base/fman/fman.c:186:2: error: ‘strncpy’ output may be truncated copying 4095 bytes from a string of length 4095 [-Werror=stringop-truncation] strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1); strncpy may result a not null-terminated string, replaced it with strlcpy Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations") Cc: Signed-off-by: Ferruh Yigit <>
2018-11-01drivers: remove useless constructor headersThomas Monjalon
A constructor is usually declared with RTE_INIT* macros. As it is a static function, no need to declare before its definition. The macro is used directly in the function definition. Signed-off-by: Thomas Monjalon <>
2018-10-31bus/pci: fix resource mapping overrideQi Zhang
When scanning an already plugged device, the virtual address of mapped PCI resource in rte_pci_device will be overridden with 0, that may cause driver does not work correctly. The fix is not to update any rte_pci_device's field if the being scanned device's driver is already probed. Bugzilla ID: 85 Fixes: c752998b5e2e ("pci: introduce library and driver") Cc: Reported-by: Geoffrey Lv <> Signed-off-by: Qi Zhang <>
2018-10-29drivers: prefix global variables with module nameFerruh Yigit
Some global variables are defined with generic names, add component name as prefix to variables to prevent collusion with application variables. Signed-off-by: Ferruh Yigit <> Reviewed-by: Maxime Coquelin <> Acked-by: Shreyansh Jain <> Acked-by: Tianfei Zhang <>
2018-10-29add missing static keyword to globalsFerruh Yigit
Some global variables can indeed be static, add static keyword to them. Signed-off-by: Ferruh Yigit <> Acked-by: Jerin Jacob <> Acked-by: Shreyansh Jain <>
2018-10-29bus/pci: propagate probing error codesDarek Stojaczyk
In a couple of places we check its error code against -EEXIST, but this function returned either -1, 0, or 1. This gets critical when hotplugging a device in secondary process, while the same device is already plugged in the primary. Failing to "hotplug" it in the primary will cause the secondary to fail as well. Fixes: e9d159c3d534 ("eal: allow probing a device again") Signed-off-by: Darek Stojaczyk <> Acked-by: Thomas Monjalon <>
2018-10-29vfio: fix interrupt unregister for hotplug notifierDarek Stojaczyk
This function is documented to return the number of unregistered callbacks or negative numbers on error, but pci_vfio checks for ret != 0 to detect failures. Not anymore. Fixes: c115fd000c32 ("vfio: handle hotplug request notifier") Signed-off-by: Darek Stojaczyk <> Acked-by: Anatoly Burakov <>
2018-10-29bus/pci: compare kernel driver instead of interrupt handlerAlejandro Lucero
Invoking the right pci read/write functions is based on interrupt handler type. However, this is not configured for secondary processes precluding to use those functions. This patch fixes the issue using the driver name the device is bound to instead. Fixes: 632b2d1deeed ("eal: provide functions to access PCI config") Cc: Signed-off-by: Alejandro Lucero <> Acked-by: Anatoly Burakov <>
2018-10-29bus/pci: harmonize return value of config readLuca Boccassi
On Linux, rte_pci_read_config on success returns the number of read bytes, but on BSD it returns 0. Document the return values, and have BSD behave as Linux does. At least one case (bnx2x PMD) treats 0 as an error, so the change makes sense also for that. Signed-off-by: Luca Boccassi <> Acked-by: Bruce Richardson <>
2018-10-28bus/pci: use IOVA DMA mask check when setting IOVA modeAlejandro Lucero
Currently the code precludes IOVA mode if IOMMU hardware reports less addressing bits than necessary for full virtual memory range. Although VT-d emulation currently only supports 39 bits, it could be iovas for allocated memlory being within that supported range. This patch allows IOVA mode in such a case adding a call to rte_eal_check_dma_mask using the reported addressing bits by the IOMMU hardware. Indeed, memory initialization code has been modified for using lower virtual addresses than those used by the kernel for 64 bits processes by default, and therefore memsegs iovas can use 39 bits or less for most systems. And this is likely 100% true for VMs. Signed-off-by: Alejandro Lucero <> Acked-by: Anatoly Burakov <>
2018-10-28bus/pci: check IOMMU addressing limitation just onceAlejandro Lucero
Current code checks if IOMMU hardware reports enough addressing bits for using IOVA mode but it repeats the same check for any PCI device present. This is not necessary because the IOMMU hardware is the same for all of them. This patch only checks the IOMMU using first PCI device found. Signed-off-by: Alejandro Lucero <> Acked-by: Anatoly Burakov <>
2018-10-28bus/vdev: fix devargs after multi-process bus scanQi Zhang
It's not necessary to insert device argment to devargs_list during bus scan, but this happens when we try to attach a device on secondary process. The patch fix the issue. Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel") Cc: Signed-off-by: Qi Zhang <>
2018-10-26bus/vdev: add iteration filter on nameThomas Monjalon
A virtual device can be matched with following syntax: bus=vdev,name=X Signed-off-by: Thomas Monjalon <> Reviewed-by: Andrew Rybchenko <>
2018-10-25bus/vdev: fix multi-process IPC buffer leak on scanPaul Luse
This patch fixes an issue caught with ASAN where a vdev_scan() to a secondary bus was failing to free some memory. The doxygen comment in EAL is fixed at the same time. Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel") Fixes: 783b6e54971d ("eal: add synchronous multi-process communication") Cc: Signed-off-by: Paul Luse <> Acked-by: Anatoly Burakov <> Acked-by: Ferruh Yigit <>
2018-10-25bus/fslmc: ignore dpaax PA-VA table errorsShreyansh Jain
Presence of PA-VA Table is transparent to the drivers. Ignoring the return values from table update call. Signed-off-by: Shreyansh Jain <> Acked-by: Jerin Jacob <>
2018-10-22bus/vdev: fix uninitialized device busQi Zhang
Device bus should be initialized after bus scan. While it does not happened when scan vdev from secondary process, that cause segment fault at rte_dev_probe when call dev->bus->xxx. Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel") Cc: Signed-off-by: Qi Zhang <> Acked-by: Thomas Monjalon <>
2018-10-22vfio: improve musl compatibilityAnatoly Burakov
Musl already has PAGE_SIZE defined, and our define clashed with it. Rename our define to SYS_PAGE_SIZE. Bugzilla ID: 36 Signed-off-by: Anatoly Burakov <> Acked-by: Bruce Richardson <>
2018-10-22mk: build with _GNU_SOURCE defined by defaultAnatoly Burakov
We use _GNU_SOURCE all over the place, but often times we miss defining it, resulting in broken builds on musl. Rather than fixing every library's and driver's and application's makefile, fix it by simply defining _GNU_SOURCE by default for all builds. Remove all usages of _GNU_SOURCE in source files and makefiles, and also fixup a couple of instances of using __USE_GNU instead of _GNU_SOURCE. Signed-off-by: Anatoly Burakov <>
2018-10-19devargs: fix freeing during device removalThomas Monjalon
After calling unplug function of a bus, the device is expected to be freed. It is too late for getting devargs to remove. Anyway, the buses which implement unplug are already freeing the devargs, except the PCI bus. So the call to rte_devargs_remove() is removed from EAL and added in PCI. Fixes: 2effa126fbd8 ("devargs: simplify parameters of removal function") Signed-off-by: Thomas Monjalon <>
2018-10-18eal: allow probing a device againThomas Monjalon
In the devargs syntax for device representors, it is possible to add several devices at once: -w dbdf,representor=[0-3] It will become a more frequent case when introducing wildcards and ranges in the new devargs syntax. If a devargs string is provided for probing, and updated with a bigger range for a new probing, then we do not want it to fail because part of this range was already probed previously. There can be new ports to create from an existing rte_device. That's why the check for an already probed device is moved as bus responsibility. In the case of vdev, a global check is kept in insert_vdev(), assuming that a vdev will always have only one port. In the case of ifpga and vmbus, already probed devices are checked. In the case of NXP buses, the probing is done only once (no hotplug), though a check is added at bus level for consistency. In the case of PCI, a driver flag is added to allow PMD probing again. Only the PMD knows the ports attached to one rte_device. As another consequence of being able to probe in several steps, the field rte_device.devargs must not be considered as a full representation of the rte_device, but only the latest probing args. Anyway, the field rte_device.devargs is used only for probing. Signed-off-by: Thomas Monjalon <> Reviewed-by: Andrew Rybchenko <> Tested-by: Andrew Rybchenko <> Acked-by: Shreyansh Jain <>
2018-10-18eal: add function to query device statusThomas Monjalon
The function rte_dev_is_probed() is added in order to improve semantic and enforce proper check of the probing status of a device. It will answer this rte_device query: Is it already successfully probed or not? Signed-off-by: Thomas Monjalon <> Reviewed-by: Andrew Rybchenko <> Tested-by: Andrew Rybchenko <>
2018-10-17drivers/bus: move driver assignment to end of probingThomas Monjalon
The PCI mapping requires to know the PCI driver to use, even before the probing is done. That's why the PCI driver is referenced early inside the PCI device structure. See commit 1d20a073fa5e ("bus/pci: reference driver structure before mapping") However the rte_driver does not need to be referenced in rte_device before the device probing is done. By moving back this assignment at the end of the device probing, it becomes possible to make clear the status of a rte_device. Signed-off-by: Thomas Monjalon <> Reviewed-by: Andrew Rybchenko <> Tested-by: Andrew Rybchenko <> Reviewed-by: Rosen Xu <>
2018-10-17vfio: fix missing header inclusionJerin Jacob
The following change set introduces HAVE_VFIO_DEV_REQ_INTERFACE and used in the below files. drivers/bus/pci/linux/pci_vfio.c drivers/bus/pci/pci_common.c lib/librte_eal/linuxapp/eal/eal_interrupts.c However, Except the first file, the change missed to include <rte_vfio.h> where HAVE_VFIO_DEV_REQ_INTERFACE defined. This creates runtime following error on vfio-pci mode and kernel >= 4.0.0 combination. EAL: [rte_intr_enable] Unknown handle type of fd 95 EAL: [pci_vfio_enable_notifier]Fail to enable req notifier. EAL: Fail to unregister req notifier handler. EAL: Error setting up notifier! EAL: Requested device 0000:07:00.1 cannot be used Fixes: cda94419964f ("vfio: fix build with Linux < 4.0") Signed-off-by: Jerin Jacob <> Signed-off-by: Pavan Nikhilesh <>
2018-10-16net/dpaa2: optimize fd reset in Tx pathHemant Agrawal
various field of FD structure was getting reset in scattered fashion. This patch align them in single macro. Signed-off-by: Hemant Agrawal <>
2018-10-16bus/fslmc: support 32 enqueues/dequeues for LX2Nipun Gupta
LX2 can support upto 32 frames in one hw pull request. Signed-off-by: Nipun Gupta <>
2018-10-16bus/fslmc: support memory backed portals with QBMAN 5.0Nipun Gupta
This new mode is available in LX2160 platform. The code dynamically detect the underlying qbman version and choose the mode at runtime. Signed-off-by: Youri Querry <> Signed-off-by: Roy Pledge <> Signed-off-by: Nipun Gupta <>
2018-10-16bus/fslmc: upgrade mc FW APIs to 10.10.0Hemant Agrawal
This patch add the support for new Management Complex Firmware version to 10.1x.x. One of the main changes in the APIs ordered queue. The fslmc bus lib ABI will need to be bumped to reflect the MC FW API and structure changes. This will also result in bumping of ABI verion of all dependent libs as they internally use the MC FW APIs and structures. Signed-off-by: Hemant Agrawal <>
2018-10-16fslmc: enable dpaax libraryShreyansh Jain
With this patch, fslmc bus and ethernet devices on this bus would start using the physical-virtual library interfaces. This patch impacts mempool/dpaa2, event/dpaa2, net/dpaa2, raw/dpaa2_cmdif and raw/dpaa2_qdma as they are dependent on the bus/fslmc and thus impact linkage of libraries. Signed-off-by: Shreyansh Jain <>
2018-10-16dpaa: enable dpaax libraryShreyansh Jain
With this patch, dpaa bus and ethernet devices on this bus would start using the physical-virtual library interfaces. This patch impacts mempool/dpaa, event/dpaa and net/dpaa as they are dependent on the bus/dpaa and thus impact linkage of libraries. Signed-off-by: Shreyansh Jain <>
2018-10-16bus/fslmc: fix physical addressing checkShreyansh Jain
In case RTE_LIBRTE_DPAA2_USE_PHYS_IOVA is enabled, only supported class is RTE_IOVA_PA. Fixes: f7768afac101 ("bus/fslmc: support dynamic IOVA") Cc: Signed-off-by: Shreyansh Jain <>
2018-10-16vfio: fix build with Linux < 4.0Jeff Guo
Since the older kernel version do not implement the device request interface for vfio, so when build on the kernel < v4.0.0, which is the version begin to add the device request interface, it will throw the error to show “VFIO_PCI_REQ_IRQ_INDEX” is undeclared. This patch aim to fix this compile issue by add the macro “HAVE_VFIO_DEV_REQ_INTERFACE” after checking the kernel version. Fixes: 0eb8a1c4c786 ("vfio: add request notifier interrupt") Fixes: c115fd000c32 ("vfio: handle hotplug request notifier") Signed-off-by: Jeff Guo <> Reviewed-by: Ferruh Yigit <>
2018-10-15vfio: handle hotplug request notifierJeff Guo
When device is be hot-unplugged, the vfio kernel module will sent req notifier to request user space to release the allocated resources at first. After that, vfio kernel module will detect the device disappear, and then delete the device in kernel. This patch aim to add req notifier processing to enable hotplug for vfio. By enable the req notifier monitoring and register the notifier callback, when device be hot-unplugged, the hot-unplug handler will be called to process hotplug for vfio. Signed-off-by: Jeff Guo <> Acked-by: Anatoly Burakov <>
2018-10-15bus/pci: add VFIO request interrupt handle to deviceJeff Guo
There are some extended interrupt types in vfio pci device except from the existing interrupts, such as err and req notifier, they could be useful for device error monitoring. And these corresponding interrupt handler is different from the other interrupt handler that register in PMDs, so a new interrupt handler should be added. This patch will add specific req handler in generic pci device. Signed-off-by: Jeff Guo <> Acked-by: Anatoly Burakov <>
2018-10-15bus/pci: support sigbus handlerJeff Guo
This patch implements the ops for the PCI bus sigbus handler. It finds the PCI device that is being hot-unplugged and calls the relevant ops of the hot-unplug handler to handle the hot-unplug failure of the device. Signed-off-by: Jeff Guo <> Acked-by: Shaopeng He <> Acked-by: Konstantin Ananyev <>
2018-10-15bus/pci: support hot-unplug handlerJeff Guo
This patch implements the ops to handle hot-unplug on the PCI bus. For UIO PCI, it could avoids BARs read/write errors by creating a new dummy memory to remap the memory where the failure is. For VFIO or other kernel driver, it could specific implement function to handle hot-unplug case by case. Signed-off-by: Jeff Guo <> Acked-by: Shaopeng He <> Acked-by: Konstantin Ananyev <>
2018-10-11eal: add bus pointer in device structureThomas Monjalon
When a device is added with a devargs (hotplug or whitelist), the bus pointer can be retrieved via its devargs. But there is no such devargs.bus in case of standard scan. A pointer to the rte_bus handle is added to rte_device. When a device is allocated (during a scan), the pointer to its bus is assigned. It will make possible to remove a rte_device, using the function pointer from its bus. The function rte_bus_find_by_device() becomes useless, and may be removed later. Signed-off-by: Thomas Monjalon <> Acked-by: Gaetan Rivet <> Reviewed-by: Stephen Hemminger <>
2018-10-11devargs: simplify parameters of removal functionThomas Monjalon
The function rte_devargs_remove(), which is intended to be internal, can take a devargs structure as argument. The matching is still using string comparison of bus name and device name. It is simpler and may allow a different devargs matching in future. Signed-off-by: Thomas Monjalon <> Reviewed-by: Andrew Rybchenko <> Acked-by: Gaetan Rivet <> Reviewed-by: Stephen Hemminger <>
2018-10-11devargs: rename enum items with singular formThomas Monjalon
The enum names are *_params (plural form). And the items are also using the plural form: *_PARAMS_*. It looks more natural to use the singular form *_PARAM_* for items. Signed-off-by: Thomas Monjalon <> Reviewed-by: Andrew Rybchenko <>
2018-10-11bus/pci: rename devargs parameter id to addrThomas Monjalon
We could match devices by their PCI id (vendor id, device id, etc). But for now, only matching by PCI address is implemented. The devargs parameter "id" is renamed "addr" to reflect its real meaning. Signed-off-by: Thomas Monjalon <> Reviewed-by: Andrew Rybchenko <>
2018-10-11malloc: enable event callbacks for external memoryAnatoly Burakov
When adding or removing external memory from the memory map, there may be actions that need to be taken on account of this memory (e.g. DMA mapping). Add support for triggering callbacks when adding, removing, attaching or detaching external memory. Some memory event callback handlers will need additional logic to handle external memory regions. For example, virtio callback has to completely ignore externally allocated memory, because there is no way to find file descriptors backing the memory address in a generic fashion. All other callbacks have also been adjusted to handle RTE_BAD_IOVA as IOVA address, as this is one of the expected use cases for external memory support. Signed-off-by: Anatoly Burakov <>
2018-10-11mem: allow memseg lists to be marked as externalAnatoly Burakov
When we allocate and use DPDK memory, we need to be able to differentiate between DPDK hugepage segments and segments that were made part of DPDK but are externally allocated. Add such a property to memseg lists. This breaks the ABI, so document the change in release notes. This also breaks a few internal assumptions about memory contiguousness, so adjust malloc code in a few places. All current calls for memseg walk functions were adjusted to ignore external segments where it made sense. Mempools is a special case, because we may be asked to allocate a mempool on a specific socket, and we need to ignore all page sizes on other heaps or other sockets. Previously, this assumption of knowing all page sizes was not a problem, but it will be now, so we have to match socket ID with page size when calculating minimum page size for a mempool. Signed-off-by: Anatoly Burakov <> Acked-by: Andrew Rybchenko <> Acked-by: Yongseok Koh <>
2018-10-11mem: add length to memseg listAnatoly Burakov
Previously, to calculate length of memory area covered by a memseg list, we would've needed to multiply page size by length of fbarray backing that memseg list. This is not obvious and unnecessarily low level, so store length in the memseg list itself. This breaks ABI, so bump the EAL ABI version and document the change. Also, while we're breaking ABI, pack the members a little better. Signed-off-by: Anatoly Burakov <> Acked-by: Shreyansh Jain <>
2018-10-04vfio: allow mapping MSI-X BARs if kernel allows itAnatoly Burakov
Currently, DPDK will skip mapping some areas (or even an entire BAR) if MSI-X table happens to be in them but is smaller than page size. Kernels 4.16+ will allow mapping MSI-X BARs [1], and will report this as a capability flag. Capability flags themselves are also only supported since kernel 4.6 [2]. This commit will introduce support for checking VFIO capabilities, and will use it to check if we are allowed to map BARs with MSI-X tables in them, along with backwards compatibility for older kernels, including a workaround for a variable rename in VFIO region info structure [3]. [1] linux.git/commit/?id=a32295c612c57990d17fb0f41e7134394b2f35f6 [2] linux.git/commit/?id=c84982adb23bcf3b99b79ca33527cd2625fbe279 [3] linux.git/commit/?id=ff63eb638d63b95e489f976428f1df01391e15e4 Signed-off-by: Anatoly Burakov <>
2018-10-03bus/vdev: implement device iterationGaetan Rivet
Signed-off-by: Gaetan Rivet <>
2018-10-03bus/pci: add iteration filter on addressGaetan Rivet
The PCI bus can now parse a matching field "id" as follows: "bus=pci,id=0000:00:00.0" or "bus=pci,id=00:00.0" Signed-off-by: Gaetan Rivet <>
2018-10-03bus/pci: implement device iterationGaetan Rivet
Signed-off-by: Gaetan Rivet <>