path: root/drivers/bus
AgeCommit message (Collapse)Author
2019-03-31bus/fslmc: fix build with musl libcNatanael Copa
This fixes the following compile error with musl libc: drivers/bus/fslmc/qbman/include/compat.h:41:10: error: 'stdout' undeclared (first use in this function) fflush(stdout); \ ^~~~~~ Fixes: 531b17a780dc ("bus/fslmc: add QBMAN driver to bus") Cc: Signed-off-by: Natanael Copa <>
2019-03-31bus/fslmc: remove unused include of error.hNatanael Copa
Fixes following build error with musl libc: In file included from drivers/bus/fslmc/qbman/qbman_debug.c:6: drivers/bus/fslmc/qbman/include/compat.h:21:10: fatal error: error.h: No such file or directory #include <error.h> ^~~~~~~~~ Apparently it is not used anywere in qbman so simply remove the include. Fixes: 531b17a780dc ("bus/fslmc: add QBMAN driver to bus") Cc: Signed-off-by: Natanael Copa <>
2019-03-30bus: introduce device level DMA memory mappingShahaf Shuler
The DPDK APIs expose 3 different modes to work with memory used for DMA: 1. Use the DPDK owned memory (backed by the DPDK provided hugepages). This memory is allocated by the DPDK libraries, included in the DPDK memory system (memseg lists) and automatically DMA mapped by the DPDK layers. 2. Use memory allocated by the user and register to the DPDK memory systems. Upon registration of memory, the DPDK layers will DMA map it to all needed devices. After registration, allocation of this memory will be done with rte_*malloc APIs. 3. Use memory allocated by the user and not registered to the DPDK memory system. This is for users who wants to have tight control on this memory (e.g. avoid the rte_malloc header). The user should create a memory, register it through rte_extmem_register API, and call DMA map function in order to register such memory to the different devices. The scope of the patch focus on #3 above. Currently the only way to map external memory is through VFIO (rte_vfio_dma_map). While VFIO is common, there are other vendors which use different ways to map memory (e.g. Mellanox and NXP). The work in this patch moves the DMA mapping to vendor agnostic APIs. Device level DMA map and unmap APIs were added. Implementation of those APIs was done currently only for PCI devices. For PCI bus devices, the pci driver can expose its own map and unmap functions to be used for the mapping. In case the driver doesn't provide any, the memory will be mapped, if possible, to IOMMU through VFIO APIs. Application usage with those APIs is quite simple: * allocate memory * call rte_extmem_register on the memory chunk. * take a device, and query its rte_device. * call the device specific mapping function for this device. Future work will deprecate the rte_vfio_dma_map and rte_vfio_dma_unmap APIs, leaving the rte device APIs as the preferred option for the user. Signed-off-by: Shahaf Shuler <> Acked-by: Anatoly Burakov <> Acked-by: Gaetan Rivet <>
2019-03-29bus/dpaa: delay fman device list to bus probeHemant Agrawal
The fman device list need to be accessed across processes. The hw device structures should be allocated with rte_calloc instead of calloc. The rte_calloc is not available at the time of bus scan, so better prepare the device list at probe. Signed-off-by: Hemant Agrawal <>
2019-03-29mempool/dpaa: allocate bp info for multiprocessAkhil Goyal
rte_dpaa_bpid_info shall be allocated with the hugepage memory which can be shared across processes. Signed-off-by: Akhil Goyal <>
2019-03-29bus/dpaa: save fq lookup table for secondary processAkhil Goyal
A reference to qman_fq_lookup_table need to be saved in each fq, so that it is retrieved while in running secondary process. Signed-off-by: Akhil Goyal <>
2019-03-29bus/dpaa: fix Rx discard register maskShreyansh Jain
Current value of 'fmbm_rfsdm' register (0x010CE3F0) doesn't include the bit to drop colored (red) packets. New value (0x010EE3F0) fixes this. Check with 'fmbm_rffc' register of fm_port_bmi_regs. Fixes: 6d6b4f49a155 ("bus/dpaa: add FMAN hardware operations") Cc: Signed-off-by: Shreyansh Jain <>
2019-03-29bus/fslmc: remove unneeded strdupStephen Hemminger
The fslmc bus code was duplicating the device name and doing extra initialization. The code can be simplified to just use the device name directly. Compile tested only; do not have this hardware. Signed-off-by: Stephen Hemminger <> Acked-by: Hemant Agrawal <>
2019-03-29bus/fslmc: decrease log level for unsupported devicesStephen Hemminger
When fslmc is built as part of a general distribution, the bus code will log errors when other devices are present. This could confuse users it is not an error. Fixes: 50245be05d1a ("bus/fslmc: support device blacklisting") Cc: Signed-off-by: Stephen Hemminger <> Acked-by: Hemant Agrawal <> Acked-by: Ilya Maximets <>
2019-03-29bus/vmbus: refactor secondary mappingStephen Hemminger
The secondary mapping function was duplicating the code used to search the uio_resource list. Skip the unwinding since map failure already makes device unusable. Signed-off-by: Stephen Hemminger <>
2019-03-29bus/vmbus: map ring in secondary processStephen Hemminger
Need to remember primary channel in secondary process. Then use it to iterate over subchannels in secondary process mapping setup. Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Cc: Signed-off-by: Stephen Hemminger <>
2019-03-29bus/vmbus: stop mapping if empty resource foundStephen Hemminger
If vmbus is run on older kernel (without all the uio mappings), then the bus driver should stop when it hits the missing mappings rather than recording the empty values. Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Cc: Signed-off-by: Stephen Hemminger <>
2019-03-29bus/vmbus: fix check for mmap failureStephen Hemminger
The code was testing the result of mmap incorrectly. I.e the test that a local pointer is not MAP_FAILED would always succeed and therefore hid any potential problems. Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Cc: Signed-off-by: Stephen Hemminger <>
2019-03-29bus/vmbus: fix secondary process setupStephen Hemminger
The secondary process doesn't correctly map the second and later resources because it doesn't change the offset. Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Cc: Signed-off-by: Stephen Hemminger <>
2019-03-29drivers: fix SPDX license id consistencyStephen Hemminger
All drivers should have SPDX on the first line of the source files in the format /* SPDX-License-Identifier: ... Several files used minor modifications which were inconsistent with the pattern. Fix it to make scanning tools easier. Signed-off-by: Stephen Hemminger <>
2019-03-12build/freebsd: rename macro BSDPAPP to FREEBSDBruce Richardson
Rename the macro and all instances in DPDK code, but keep a copy of the old macro defined for legacy code linking against DPDK Signed-off-by: Bruce Richardson <>
2019-03-12build/linux: rename macro from LINUXAPP to LINUXBruce Richardson
Rename the macro to make things shorter and more comprehensible. For both meson and make builds, keep the old macro around for backward compatibility. Signed-off-by: Bruce Richardson <>
2019-03-12eal/linux: rename linuxapp to linuxBruce Richardson
The term "linuxapp" is a legacy one, but just calling the subdirectory "linux" is just clearer for all concerned. Signed-off-by: Bruce Richardson <>
2019-03-05bus/vdev: fix hotplug twiceRaslan Darawsheh
In case vdev was already probed, it shouldn't be probed again, and it should return -EEXIST as error. There are some checks in vdev_probe() and insert_vdev(), but a check was missing in vdev_plug(). The check is moved in vdev_probe_all_drivers() which is called in all code paths. Fixes: e9d159c3d534 ("eal: allow probing a device again") Cc: Signed-off-by: Raslan Darawsheh <> Signed-off-by: Thomas Monjalon <> Reviewed-by: Andrew Rybchenko <>
2019-03-05bus/vdev: fix debug message on probingThomas Monjalon
The log was printing the device name two times, first one being supposed to be the driver name. As we don't know yet the driver name, the log is simplified. Fixes: 9bf4901d1a11 ("bus/vdev: remove probe with driver name option") Cc: Signed-off-by: Thomas Monjalon <> Reviewed-by: Rami Rosen <> Reviewed-by: Andrew Rybchenko <>
2019-03-01net/dpaa2: support low level loopback testerHemant Agrawal
Signed-off-by: Hemant Agrawal <>
2019-03-01bus/fslmc: add enqueue response read in qbmanNipun Gupta
Signed-off-by: Nipun Gupta <>
2019-01-23vfio: fix error messageAlejandro Lucero
The message refers to uio driver. Fixes: ff0b67d1c868 ("vfio: DMA mapping") Cc: Signed-off-by: Alejandro Lucero <> Acked-by: Anatoly Burakov <>
2019-01-19bus/ifpga: fix AFU probe failure handlerAndy Pei
In the original code, when an AFU device probe a driver, if the first driver in the driver list does not support this device or some error happens, bus probe returns an error. With this patch, a device will try to match driver in the driver list one by one until an appropriate driver is found. If some error happens, the error is returned. If the current driver does not support the device, just try the next driver in the list. If all the drivers in the list are tried and no driver matches, 0 is returned. Otherwise, the error code is returned. Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") Cc: Signed-off-by: Andy Pei <> Reviewed-by: Ferruh Yigit <> Acked-by: Rosen Xu <>
2019-01-19bus/ifpga: fix forcing optional devargsAndy Pei
Original driver requires users to input "afu_bts" args. But driver can also work without an explicit "afu_bts" args. Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") Cc: Signed-off-by: Andy Pei <> Acked-by: Rosen Xu <>
2019-01-19bus/ifpga: fix build for cpp applicationsAndy Pei
Brackets unmatch when __cplusplus defined. Fixes: 05fa3d4a6539 ("bus/ifpga: add Intel FPGA bus library") Cc: Signed-off-by: Andy Pei <> Reviewed-by: Ferruh Yigit <>
2019-01-14drivers: fix sprintf with snprintfPallantla Poornima
sprintf function is not secure as it doesn't check the length of string. More secure function snprintf is used Fixes: 828d51d8fc ("bus/fslmc: refactor scan and probe functions") Fixes: c22fab9a6c ("raw/dpaa2_qdma: support configuration APIs") Fixes: e5cbdfc537 ("crypto/dpaa2_sec: add basic operations") Fixes: b23d4e898a ("crypto/dpaa2_sec: add per dev mempool to store FLE") Fixes: 623326dded ("crypto/dpaa2_sec: introduce poll mode driver") Fixes: e7a45f3cc2 ("crypto/caam_jr: add UIO specific operations") Fixes: f44bccadd8 ("crypto/caam_jr: add device basic operations") Fixes: 7e3e2954e0 ("crypto/dpaa_sec: move mempool allocation to config") Fixes: c3e85bdcc6 ("crypto/dpaa_sec: add crypto driver for NXP DPAA platform") Cc: Signed-off-by: Pallantla Poornima <> Acked-by: Akhil Goyal <>
2019-01-14bus/fslmc: support secondary processShreyansh Jain
Previously FSLMC bus only supported blacklisting of DPNI (eth), DPSECI (crypto) devices. With this patch, devices like DPIO, DPMCP, and other DP* can also be blacklisted/whitelisted. This is a required condition for secondary processes where the secondary needs to be passed a mutually exclusive list of resources as compared the primary and all other secondaries. This patch also moves the DPIO memory from malloc to hugepage so that in future in case the DPIO list can be shared, it can be accessed in secondaries. Once this patch is done, multi-process cases can be executed by whitelisting/blacklisting devices in each instance. Signed-off-by: Shreyansh Jain <>
2019-01-14net/dpaa2: change reference to private deviceShreyansh Jain
The I/O threads for DPAA2 take their reference for bpool ID, the port ID and other info like qdid, from the rte_eth_dev. Further, to get this data during I/O operation, a reference of the RTE device is kept in the queue structure (dpaa2_queue). In case of secondary processes, rte_eth_dev is not same as the primary process. Thus, the reference goes invalid. This patch changes the implementation to use the dev_private rather than the rte_eth_dev as that is shared area across all the processes. Signed-off-by: Shreyansh Jain <>
2019-01-14mempool/dpaa2: support saving context of buffer poolShreyansh Jain
Initial design was to have the buffer pool per process where a global static array stores the bpids. But, in case of secondary processes, this would not allow the I/O threads to translate the bpid in Rx'd packets. This patch moves the array to a global area (rte_malloc) and in case of Rx thread not containing a valid reference to the array, reference is build using the handle avaialble in the dpaa2_queue. Signed-off-by: Shreyansh Jain <>
2019-01-14bus/fslmc: support scanning DPDMUX objectNipun Gupta
Add support in bus and vfio to scan dpdmux type of objects Signed-off-by: Nipun Gupta <> Acked-by: Shreyansh Jain <>
2019-01-14bus/fslmc: make portal function staticHemant Agrawal
Change QBMAN portal function to static as it is not exposed outside this file context. Signed-off-by: Hemant Agrawal <>
2019-01-14bus/fslmc: rename portal pi index to consumer indexHemant Agrawal
This is to align with the latest qbman hw library Signed-off-by: Youri Querry <> Signed-off-by: Hemant Agrawal <>
2019-01-14bus/fslmc: add dynamic config for memback portal modeHemant Agrawal
Add flag in portal init to adjust the qbman memory type, to decide between legacy portal mode or newly introduced memory backed portals. Signed-off-by: Roy Pledge <> Signed-off-by: Youri Querry <> Signed-off-by: Hemant Agrawal <>
2019-01-14bus/fslmc: upgrade to latest qbman libraryHemant Agrawal
This patch upgrades and sync the dpdk based qbman code with new version of qbman flib. Signed-off-by: Youri Querry <> Signed-off-by: Nipun Gupta <> Signed-off-by: Hemant Agrawal <>
2019-01-14bus/fslmc: fix parse method for bus devicesShreyansh Jain
Current code expects that bus->parse() would get a string containing the name of the bus. That is incorrect. bus->parse() is expected to have strings like: dpni.1,key=val dpio.2,key=val when user passed: -b fslmc:dpni.1,key=val This commit fixes this behavior. Fixes: 50245be05d1a ("bus/fslmc: support device blacklisting") Cc: Signed-off-by: Shreyansh Jain <>
2019-01-14bus/fslmc: fix to convert error msg to warningHemant Agrawal
This is just a information. No need to print it as a error. Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging") Cc: Signed-off-by: Hemant Agrawal <>
2019-01-14bus/fslmc: fix to use correct physical core for logical coreHemant Agrawal
Existing code is using the lcore id as the physical core id. Add code to get the right physical id. Also, dpaa2 can not support one lcore mapping to multiple cpus, print err on such cases. Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging") Cc: Signed-off-by: Hemant Agrawal <>
2019-01-14bus/fslmc: fix ring mode to use correct cache settingsYouri Querry
The code was incorrectly using the cache inhibited access. It shall use cached enabled access for better performance. Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0") Cc: Signed-off-by: Youri Querry <> Acked-by: Shreyansh Jain <>
2019-01-14bus/fslmc: fix to reset portal memory before useSachin Saxena
Uninitialized portal memory is causing unwanted issues. Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0") Cc: Signed-off-by: Sachin Saxena <> Acked-by: Shreyansh Jain <>
2019-01-14bus/dpaa: fix logical to physical core affine logicHemant Agrawal
The code was treating the lcore id as physical core id. The code is updated to use actual physical core value for any core affinity logic. Note that DPAA devices are single cluster systems. Fixes: 5d944582d028 ("bus/dpaa: check portal presence in the caller function") Cc: Signed-off-by: Hemant Agrawal <>
2018-12-20vfio: support 64KB kernel page sizeTone Zhang
With a larger PAGE_SIZE it is possible for the MSI table to very close to the end of the BAR s.t. when we align the start and end of the MSI table to the PAGE_SIZE, the end offset of the MSI table is out of the PCI BAR boundary. This patch addresses the issue by comparing both the start and the end offset of the MSI table with the BAR size, and skip the mapping if it is out of Bar scope. The patch fixes the debug log as below: EAL: Skipping BAR0 Signed-off-by: Tone Zhang <> Reviewed-by: Gavin Hu <> Reviewed-by: Honnappa Nagarahalli <> Reviewed-by: Steve Capper <> Acked-by: Anatoly Burakov <>
2018-12-19bus/dpaa: do nothing if bus not presentStephen Hemminger
The DPAA bus support code put out messages like: dpaax: read_memory_node(): Unable to glob device-tree memory node: (/proc/device-tree/memory[@0-9]*/reg)(3) dpaax: PA->VA translation not available; dpaax: Expect performance impact. These are unnecessary and likely to confuse the end user. Fix this by doing nothing if bus is empty. Fixes: 5a7dbb934d75 ("dpaa: enable dpaax library") Cc: Signed-off-by: Stephen Hemminger <> Acked-by: Shreyansh Jain <>
2018-12-19bus/vmbus: debug subchannel setupStephen Hemminger
Add more instrumentation to subchannel setup to help diagnose startup issues. Signed-off-by: Stephen Hemminger <>
2018-12-19bus/vmbus: fix race in subchannel creationStephen Hemminger
When using multiple queues, there was a race with the kernel in setting up the second channel. This regression is due to a kernel change which does not allow accessing sysfs files for Hyper-V channels that are not opened. The fix is simple, just move the logic to detect not ready sub channels earlier in the existing loop. Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Cc: Reported-by: Mohammed Gamal <> Signed-off-by: Stephen Hemminger <>
2018-11-25vfio: do not needlessly setup device in secondary processDarek Stojaczyk
Setting up a device that wasn't setup in the primary process will possibly break the primary process. That's because the IPC message to retrieve the group fd in the primary will also *open* that group if it wasn't opened before. Even though the secondary process closes that fd soon after as a part of its error handling path, the primary process leaks it. What's worse, opening that fd on the primary will increment the process-local counter of opened groups. If it was 0 before, then the group will never be added to the vfio container, nor dpdk memory will be ever mapped. This patch moves the proper error checks earlier in the code to fully prevent setting up devices in secondary processes that weren't setup in the primary process. Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") Signed-off-by: Darek Stojaczyk <> Acked-by: Anatoly Burakov <> Reviewed-by: Maxime Coquelin <>
2018-11-25bus/pci: fix allocation of device pathFerruh Yigit
The pci_resource_by_index called strlen() on uninitialized memory which would lead to the wrong size of memory allocated for the path portion of the resource map. This would either cause excessively large allocation, or worse memory corruption. Coverity issue: 300868 Fixes: ea9d56226e72 ("pci: introduce function to map uio resource by index") Cc: Signed-off-by: Stephen Hemminger <> Signed-off-by: Ferruh Yigit <> Reviewed-by: Andrew Rybchenko <> Reviewed-by: Maxime Coquelin <>
2018-11-18vfio: fix build with Linux < 4.0Thomas Monjalon
drivers/bus/pci/linux/pci_vfio.c:45:23: error: ‘failure_handle_lock’ defined but not used Fixes: 8ffe73865124 ("vfio: add lock for hot-unplug failure handler") Signed-off-by: Thomas Monjalon <>
2018-11-18vfio: add lock for hot-unplug failure handlerJeff Guo
When the sigbus handler be enabled for hot-unplug, whatever hot-unplug sigbus or origin sigbus occur, the sigbus handler will be invoked and it will access the bus and device. While in the control path, the vfio req handler also will process the bus and device, so a protection of the resources in vfio req handler should be need. This patch add a lock in vfio req handler when process bus and device resource, to avoid the synchronization issue when device be hot-unplugged. Fixes: c115fd000c32 ("vfio: handle hotplug request notifier") Signed-off-by: Jeff Guo <>
2018-11-14bus/vmbus: fix directory handle leak on errorStephen Hemminger
If sysfs directory was incorrectly formatted then the vmbus setup code would leak a directory handle in the error path. Coverity issue: 302848 Fixes: 831dba47bd36 ("bus/vmbus: add Hyper-V virtual bus support") Cc: Signed-off-by: Stephen Hemminger <>