Commit 43f4e393 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

env_dpdk/memory: implement contiguity check for vtophys map



We'll be now able to check contiguity for more than 2MB
regions.

Change-Id: I738ff451d534075c944972918d08e5e0cadea4f5
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466073


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent cf078e71
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1086,6 +1086,17 @@ spdk_vtophys_notify(void *cb_ctx, struct spdk_mem_map *map,
	return rc;
}

static int
vtophys_check_contiguous_entries(uint64_t paddr1, uint64_t paddr2)
{
	/* This function is always called with paddrs for two subsequent
	 * 2MB chunks in virtual address space, so those chunks will be only
	 * physically contiguous if the physical addresses are 2MB apart
	 * from each other as well.
	 */
	return (paddr2 - paddr1 == VALUE_2MB);
}

#if SPDK_VFIO_ENABLED

static bool
@@ -1274,7 +1285,7 @@ spdk_vtophys_init(void)
{
	const struct spdk_mem_map_ops vtophys_map_ops = {
		.notify_cb = spdk_vtophys_notify,
		.are_contiguous = NULL
		.are_contiguous = vtophys_check_contiguous_entries,
	};

#if SPDK_VFIO_ENABLED