numam-dpdk/lib
Dmitry Kozlyuk 0c8fc83a71 eal/windows: fix IOVA mode detection and handling
Windows EAL did not detect IOVA mode and worked incorrectly
if physical addresses could not be obtained
(if virt2phys driver was missing or inaccessible).
In this case, rte_mem_virt2iova() reported RTE_BAD_IOVA for any address.
Inability to obtain IOVA, be it PA or VA, should cause a failure
for the DPDK allocator, but it was hidden by the implementation,
so allocations did not fail when they should.
The mode when DPDK cannot obtain PA but can work is IOVA-as-VA mode.
However, rte_eal_iova_mode() always returned RTE_IOVA_DC
(while it should only ever return RTE_IOVA_PA or RTE_IOVA_VA),
because IOVA mode detection was not implemented.

Implement IOVA mode detection:
1. Always allow to force --iova-mode=va.
2. Allow to force --iova-mode=pa only if virt2phys is available.
3. If no mode is forced and virt2phys is available,
   select the mode according to bus requests, default to PA.
4. If no mode is forced but virt2phys is unavailable, default to VA.
Fix rte_mem_virt2iova() by returning VA when using IOVA-as-VA.
Fix rte_eal_iova_mode() by returning the selected mode.

Fixes: 2a5d547a4a ("eal/windows: implement basic memory management")
Cc: stable@dpdk.org

Reported-by: Tal Shnaiderman <talshn@nvidia.com>
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>
2021-10-25 20:59:40 +02:00
..
acl build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
bbdev build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
bitratestats bitrate: promote free function to stable 2021-10-01 15:31:47 +02:00
bpf build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
cfgfile version: 21.11-rc0 2021-08-17 08:37:52 +02:00
cmdline cmdline: free on exit 2021-10-22 23:32:00 +02:00
compressdev build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
cryptodev cryptodev: move device-specific structures 2021-10-20 15:33:16 +02:00
distributor build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
dmadev dmadev: remove symbol versioning for inline helpers 2021-10-22 22:40:59 +02:00
eal eal/windows: fix IOVA mode detection and handling 2021-10-25 20:59:40 +02:00
efd build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
ethdev mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
eventdev mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
fib build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
flow_classify build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
graph build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
gro net: rename Ethernet header fields 2021-10-08 14:58:11 +02:00
gso mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
hash hash: fix Doxygen comment of Toeplitz file 2021-10-25 19:06:07 +02:00
ip_frag build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
ipsec mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
jobstats build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
kni build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
kvargs kvargs: fix comments style 2021-09-30 17:38:13 +02:00
latencystats version: 21.11-rc0 2021-08-17 08:37:52 +02:00
lpm lpm6: fix buffer overflow 2021-10-25 19:08:16 +02:00
mbuf mbuf: avoid cast-align warning in data offset macro 2021-10-25 17:27:48 +02:00
member build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
mempool mempool: fix non-IO flag inference 2021-10-25 16:52:56 +02:00
meter version: 21.11-rc0 2021-08-17 08:37:52 +02:00
metrics ethdev: hide internal structures 2021-10-13 22:14:59 +02:00
net net: avoid cast-align warning in VLAN insert function 2021-10-25 17:27:17 +02:00
node build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
pcapng mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
pci eal: remove sys/queue.h from public headers 2021-10-01 13:09:43 +02:00
pdump build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
pipeline pipeline: support action annotations 2021-10-25 14:53:28 +02:00
port port: configure loop count for source port 2021-10-25 14:30:32 +02:00
power build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
rawdev build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
rcu lib: remove C++ include guard from private headers 2021-09-22 22:00:17 +02:00
regexdev build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
reorder build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
rib rib: fix IPv6 depth mask 2021-10-25 19:13:12 +02:00
ring ring: fix name size in ring structure 2021-10-21 09:32:04 +02:00
sched sched: promote a function as stable 2021-10-25 15:14:22 +02:00
security mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
stack stack: remove unneeded atomic header include 2021-10-19 17:15:10 +02:00
table build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00
telemetry telemetry: fix socket path conflicts for in-memory mode 2021-10-14 20:31:10 +02:00
timer version: 21.11-rc0 2021-08-17 08:37:52 +02:00
vhost mbuf: add namespace to offload flags 2021-10-24 13:37:43 +02:00
meson.build build/windows: remove separate list of libs 2021-10-22 22:40:59 +02:00