Commit Graph

384 Commits

Author SHA1 Message Date
Natanael Copa
da1a31d92d bus/fslmc: fix build with musl libc
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: 531b17a780 ("bus/fslmc: add QBMAN driver to bus")
Cc: stable@dpdk.org

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2019-03-31 01:02:21 +01:00
Natanael Copa
0ebe8561a1 bus/fslmc: remove unused include of error.h
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: 531b17a780 ("bus/fslmc: add QBMAN driver to bus")
Cc: stable@dpdk.org

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2019-03-31 01:02:05 +01:00
Shahaf Shuler
c33a675b62 bus: introduce device level DMA memory mapping
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 <shahafs@mellanox.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2019-03-30 16:48:56 +01:00
Hemant Agrawal
4762b3d419 bus/dpaa: delay fman device list to bus probe
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 <hemant.agrawal@nxp.com>
2019-03-29 14:37:45 +01:00
Akhil Goyal
e1797f4b44 mempool/dpaa: allocate bp info for multiprocess
rte_dpaa_bpid_info shall be allocated with the hugepage memory
which can be shared across processes.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
2019-03-29 14:36:39 +01:00
Akhil Goyal
4bbc759f53 bus/dpaa: save fq lookup table for secondary process
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 <akhil.goyal@nxp.com>
2019-03-29 14:33:23 +01:00
Shreyansh Jain
6880caed6b bus/dpaa: fix Rx discard register mask
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: 6d6b4f49a1 ("bus/dpaa: add FMAN hardware operations")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2019-03-29 14:33:21 +01:00
Stephen Hemminger
4764beda0d bus/fslmc: remove unneeded strdup
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 <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-03-29 13:55:58 +01:00
Stephen Hemminger
a6ffe11b72 bus/fslmc: decrease log level for unsupported devices
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: 50245be05d ("bus/fslmc: support device blacklisting")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
2019-03-29 13:53:10 +01:00
Stephen Hemminger
2528d17199 bus/vmbus: refactor secondary mapping
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 <sthemmin@microsoft.com>
2019-03-29 13:44:36 +01:00
Stephen Hemminger
2a28a502c6 bus/vmbus: map ring in secondary process
Need to remember primary channel in secondary process.
Then use it to iterate over subchannels in secondary
process mapping setup.

Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2019-03-29 13:44:19 +01:00
Stephen Hemminger
41a7f8cbee bus/vmbus: stop mapping if empty resource found
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: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2019-03-29 13:44:10 +01:00
Stephen Hemminger
3f9277031a bus/vmbus: fix check for mmap failure
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: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2019-03-29 13:44:02 +01:00
Stephen Hemminger
fc20b5809d bus/vmbus: fix secondary process setup
The secondary process doesn't correctly map the second
and later resources because it doesn't change the offset.

Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2019-03-29 13:43:45 +01:00
Stephen Hemminger
c6b5715746 drivers: fix SPDX license id consistency
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 <stephen@networkplumber.org>
2019-03-29 00:15:53 +01:00
Bruce Richardson
5fbc1d498f build/freebsd: rename macro BSDPAPP to FREEBSD
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 <bruce.richardson@intel.com>
2019-03-12 23:01:14 +01:00
Bruce Richardson
742bde12f3 build/linux: rename macro from LINUXAPP to LINUX
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 <bruce.richardson@intel.com>
2019-03-12 17:31:22 +01:00
Bruce Richardson
91d7846ce6 eal/linux: rename linuxapp to linux
The term "linuxapp" is a legacy one, but just calling the subdirectory
"linux" is just clearer for all concerned.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-03-12 17:31:13 +01:00
Raslan Darawsheh
e892fa595e bus/vdev: fix hotplug twice
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: e9d159c3d5 ("eal: allow probing a device again")
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
2019-03-05 12:32:31 +00:00
Thomas Monjalon
4169ed6ed1 bus/vdev: fix debug message on probing
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: 9bf4901d1a ("bus/vdev: remove probe with driver name option")
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Rami Rosen <ramirose@gmail.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
2019-03-05 12:32:24 +00:00
Hemant Agrawal
a3a997f02d net/dpaa2: support low level loopback tester
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-03-01 18:17:35 +01:00
Nipun Gupta
16c4a3c46a bus/fslmc: add enqueue response read in qbman
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
2019-03-01 18:17:35 +01:00
Alejandro Lucero
43f2b3d250 vfio: fix error message
The message refers to uio driver.

Fixes: ff0b67d1c8 ("vfio: DMA mapping")
Cc: stable@dpdk.org

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2019-01-23 22:49:11 +01:00
Andy Pei
fb87e55aba bus/ifpga: fix AFU probe failure handler
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: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2019-01-19 00:07:52 +01:00
Andy Pei
6fa4aa2b36 bus/ifpga: fix forcing optional devargs
Original driver requires users to input "afu_bts" args.
But driver can also work without an explicit "afu_bts" args.

Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Andy Pei <andy.pei@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
2019-01-19 00:07:52 +01:00
Andy Pei
03eab74ecb bus/ifpga: fix build for cpp applications
Brackets unmatch when __cplusplus defined.

Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Andy Pei <andy.pei@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2019-01-19 00:07:52 +01:00
Pallantla Poornima
a1e8241a91 drivers: fix sprintf with snprintf
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: stable@dpdk.org

Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2019-01-14 23:27:27 +01:00
Shreyansh Jain
e55d0494ab bus/fslmc: support secondary process
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 <shreyansh.jain@nxp.com>
2019-01-14 17:44:29 +01:00
Shreyansh Jain
85ee5dda6b net/dpaa2: change reference to private device
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 <shreyansh.jain@nxp.com>
2019-01-14 17:44:29 +01:00
Shreyansh Jain
109df4601c mempool/dpaa2: support saving context of buffer pool
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 <shreyansh.jain@nxp.com>
2019-01-14 17:44:29 +01:00
Nipun Gupta
5c348710c2 bus/fslmc: support scanning DPDMUX object
Add support in bus and vfio to scan dpdmux type of objects

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2019-01-14 17:44:29 +01:00
Hemant Agrawal
1f332c7d95 bus/fslmc: make portal function static
Change QBMAN portal function to static as it is not exposed outside
this file context.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-01-14 17:44:29 +01:00
Hemant Agrawal
1b49352f41 bus/fslmc: rename portal pi index to consumer index
This is to align with the latest qbman hw library

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-01-14 17:44:29 +01:00
Hemant Agrawal
3f28677a81 bus/fslmc: add dynamic config for memback portal mode
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 <roy.pledge@nxp.com>
Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-01-14 17:44:29 +01:00
Hemant Agrawal
ff8e5f10c3 bus/fslmc: upgrade to latest qbman library
This patch upgrades and sync the dpdk based qbman code
with new version of qbman flib.

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-01-14 17:44:29 +01:00
Shreyansh Jain
68f5637bcb bus/fslmc: fix parse method for bus devices
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: 50245be05d ("bus/fslmc: support device blacklisting")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2019-01-14 17:44:29 +01:00
Hemant Agrawal
7bf5939604 bus/fslmc: fix to convert error msg to warning
This is just a information. No need to print
it as a error.

Fixes: ce9efbf5bb ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-01-14 17:44:29 +01:00
Hemant Agrawal
69a63c17fe bus/fslmc: fix to use correct physical core for logical core
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: ce9efbf5bb ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-01-14 17:44:29 +01:00
Youri Querry
2557cf8f9e bus/fslmc: fix ring mode to use correct cache settings
The code was incorrectly using the cache inhibited access.
It shall use cached enabled access for better performance.

Fixes: 293c0ca94c ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2019-01-14 17:44:29 +01:00
Sachin Saxena
34cb995cde bus/fslmc: fix to reset portal memory before use
Uninitialized portal memory is causing unwanted issues.

Fixes: 293c0ca94c ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2019-01-14 17:44:29 +01:00
Hemant Agrawal
afb2f8fd5a bus/dpaa: fix logical to physical core affine logic
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: 5d944582d0 ("bus/dpaa: check portal presence in the caller function")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2019-01-14 17:44:29 +01:00
Tone Zhang
9cea8774cf vfio: support 64KB kernel page size
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 <tone.zhang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-12-20 00:12:20 +01:00
Stephen Hemminger
f18e18e0cc bus/dpaa: do nothing if bus not present
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: 5a7dbb934d ("dpaa: enable dpaax library")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-12-19 03:13:29 +01:00
Stephen Hemminger
07938364f2 bus/vmbus: debug subchannel setup
Add more instrumentation to subchannel setup to help diagnose
startup issues.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-12-19 03:02:16 +01:00
Stephen Hemminger
4970103e89 bus/vmbus: fix race in subchannel creation
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: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org

Reported-by: Mohammed Gamal <mgamal@redhat.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
2018-12-19 03:01:55 +01:00
Darek Stojaczyk
047e3f9f2a vfio: do not needlessly setup device in secondary process
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: 2f4adfad0a ("vfio: add multiprocess support")

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2018-11-25 13:09:05 +01:00
Ferruh Yigit
d3110b124a bus/pci: fix allocation of device path
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: ea9d56226e ("pci: introduce function to map uio resource by index")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2018-11-25 11:51:11 +01:00
Thomas Monjalon
b91bc6f357 vfio: fix build with Linux < 4.0
drivers/bus/pci/linux/pci_vfio.c:45:23: error:
‘failure_handle_lock’ defined but not used

Fixes: 8ffe738651 ("vfio: add lock for hot-unplug failure handler")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-11-18 22:31:30 +01:00
Jeff Guo
8ffe738651 vfio: add lock for hot-unplug failure handler
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: c115fd000c ("vfio: handle hotplug request notifier")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
2018-11-18 17:16:42 +01:00
Stephen Hemminger
6521c9a2f7 bus/vmbus: fix directory handle leak on error
If sysfs directory was incorrectly formatted then the vmbus
setup code would leak a directory handle in the error path.

Coverity issue: 302848
Fixes: 831dba47bd ("bus/vmbus: add Hyper-V virtual bus support")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2018-11-14 02:13:56 +01:00