numam-dpdk/lib/eal/windows
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
..
include eal/windows: do not install virt2phys header 2021-10-11 21:17:12 +02:00
eal_alarm.c eal: remove sys/queue.h from public headers 2021-10-01 13:09:43 +02:00
eal_debug.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
eal_dev.c eal/windows: add device event stubs 2021-07-02 19:03:03 +02:00
eal_file.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
eal_hugepages.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
eal_interrupts.c eal/windows: cleanup interrupt resources 2021-06-23 09:05:36 +02:00
eal_lcore.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
eal_log.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
eal_memalloc.c eal/windows: fix IOVA mode detection and handling 2021-10-25 20:59:40 +02:00
eal_memory.c eal/windows: fix IOVA mode detection and handling 2021-10-25 20:59:40 +02:00
eal_mp.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
eal_thread.c eal: fix memory ordering around lcore task accesses 2021-10-25 18:20:59 +02:00
eal_timer.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
eal_windows.h eal/windows: cleanup virt2phys handle 2021-07-30 18:56:01 +02:00
eal.c eal/windows: fix IOVA mode detection and handling 2021-10-25 20:59:40 +02:00
fnmatch.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
getopt.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00
meson.build build: propagate Windows system dependencies to pkg-config 2021-09-14 15:58:34 +02:00
rte_thread.c lib: remove librte_ prefix from directory names 2021-04-21 14:04:09 +02:00