env_dpdk/memory: implement contiguity check for vtophys map

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

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466073 (master)

(cherry picked from commit 43f4e3932a)
Change-Id: I738ff451d534075c944972918d08e5e0cadea4f5
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467142
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-08-22 21:44:02 +02:00 committed by Ben Walker
parent 3157ce5c4a
commit d6870e44b2

View File

@ -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