Commit 3860fa7e authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

env: Search DPDK memsegs before /proc/self/pagemap for phys addrs



When running IOMMU enabled the user is actually
interacting with IO addresses - not physical
addresses. The value in the DPDK memseg array is
the correct one in this case, and should be used
at a higher priority than attempting to look up
the address in /proc/self/pagemap (i.e. what
rte_mem_virt2phy() does).

Further, rte_mem_virt2phy() will always fail when
running as an unprivileged user, but scanning
the memory segments will work.

Change-Id: I576e685111b7f9f848337134b7b89a3cf7c85402
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/375208


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent b52e8b25
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -450,11 +450,6 @@ vtophys_get_paddr(uint64_t vaddr)
	struct rte_memseg *seg;
	uint32_t seg_idx;

	paddr = vtophys_get_dpdk_paddr((void *)vaddr);
	if (paddr != RTE_BAD_PHYS_ADDR) {
		return paddr;
	}

	mcfg = rte_eal_get_configuration()->mem_config;

	for (seg_idx = 0; seg_idx < RTE_MAX_MEMSEG; seg_idx++) {
@@ -471,6 +466,15 @@ vtophys_get_paddr(uint64_t vaddr)
		}
	}

	/*
	 * The memory is not registered with DPDK. Try to look it up
	 * in /proc/self/pagemap.
	 */
	paddr = vtophys_get_dpdk_paddr((void *)vaddr);
	if (paddr != RTE_BAD_PHYS_ADDR) {
		return paddr;
	}

#ifdef DEBUG
	fprintf(stderr, "could not find vaddr 0x%" PRIx64 " in DPDK mem config\n", vaddr);
#endif