vfio: fix duplicated user mem map
vfio: fix duplicated user mem map

Currently, new user mem maps are checked if they are adjacent to
an existing mem map and if so, the mem map entries are merged.

It didn't check for duplicate mem maps, so if the API is called
with the same mem map multiple times, they will occupy multiple
mem map entries. This will reduce the amount of entries available
for unique mem maps.

So check for duplicate mem maps and merge them into one mem map
entry if any found.

Fixes: 0cbce3a167f1 ("vfio: skip DMA map failure if already mapped")
Cc: stable@dpdk.org

Suggested-by: Kevin Traynor <1f46c93815774a2e602547cf1e37c682d62b566d@redhat.com>
Signed-off-by: Yunjian Wang <9985a735d5d5f80ef648228b285228d6eb6eaf45@huawei.com>
Acked-by: Anatoly Burakov <814e00d8f6e4e81b7ccc7e3e5a0bfec0078f0203@intel.com>

john-mcnamara-intel/dpdk,john-mcnamara-intel/dpdk,john-mcnamara-intel/dpdk,john-mcnamara-intel/dpdk