summaryrefslogtreecommitdiffstats
path: root/src/vlib/linux
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/linux')
-rw-r--r--src/vlib/linux/physmem.c16
-rw-r--r--src/vlib/linux/vfio.c34
-rw-r--r--src/vlib/linux/vfio.h1
3 files changed, 3 insertions, 48 deletions
diff --git a/src/vlib/linux/physmem.c b/src/vlib/linux/physmem.c
index cf2961b4cf9..1a449921857 100644
--- a/src/vlib/linux/physmem.c
+++ b/src/vlib/linux/physmem.c
@@ -174,16 +174,8 @@ unix_physmem_region_alloc (vlib_main_t * vm, char *name, u32 size,
}
}
-#if 0
- if ((vpm->flags & VLIB_PHYSMEM_MAIN_F_HAVE_IOMMU) ||
- (vpm->flags & VLIB_PHYSMEM_MAIN_F_HAVE_PAGEMAP) == 0)
- for (i = 0; i < pr->n_pages; i++)
- vec_add1 (pr->page_table, pointer_to_uword (pr->mem) +
- i * (1 << pr->log2_page_size));
- else
-#endif
- pr->page_table = clib_mem_vm_get_paddr (pr->mem, pr->log2_page_size,
- pr->n_pages);
+ pr->page_table = clib_mem_vm_get_paddr (pr->mem, pr->log2_page_size,
+ pr->n_pages);
linux_vfio_dma_map_regions (vm);
@@ -224,7 +216,6 @@ clib_error_t *
unix_physmem_init (vlib_main_t * vm)
{
vlib_physmem_main_t *vpm = &physmem_main;
- linux_vfio_main_t *lvm = &vfio_main;
clib_error_t *error = 0;
u64 *pt = 0;
@@ -241,9 +232,6 @@ unix_physmem_init (vlib_main_t * vm)
if ((error = linux_vfio_init (vm)))
return error;
- if (lvm->flags & LINUX_VFIO_F_HAVE_IOMMU)
- vpm->flags |= VLIB_PHYSMEM_MAIN_F_HAVE_IOMMU;
-
vm->os_physmem_alloc_aligned = unix_physmem_alloc_aligned;
vm->os_physmem_free = unix_physmem_free;
vm->os_physmem_region_alloc = unix_physmem_region_alloc;
diff --git a/src/vlib/linux/vfio.c b/src/vlib/linux/vfio.c
index e39bf01fdc0..621dfb2ce01 100644
--- a/src/vlib/linux/vfio.c
+++ b/src/vlib/linux/vfio.c
@@ -73,7 +73,7 @@ map_regions (vlib_main_t * vm, int fd)
int rv;
dm.vaddr = pointer_to_uword (pr->mem) + (i << pr->log2_page_size);
dm.size = 1 << pr->log2_page_size;
- dm.iova = pr->page_table[i];
+ dm.iova = dm.vaddr;
if ((rv = ioctl (fd, VFIO_IOMMU_MAP_DMA, &dm)))
return rv;
}
@@ -82,30 +82,6 @@ map_regions (vlib_main_t * vm, int fd)
return 0;
}
-static clib_error_t *
-scan_vfio_fd (void *arg, u8 * path_name, u8 * file_name)
-{
- linux_vfio_main_t *lvm = &vfio_main;
- const char fn[] = "/dev/vfio/vfio";
- char buff[sizeof (fn)] = { 0 };
- int fd;
- u8 *path = format (0, "%v%c", path_name, 0);
-
- if (readlink ((char *) path, buff, sizeof (fn)) + 1 != sizeof (fn))
- goto done;
-
- if (strncmp (fn, buff, sizeof (fn)))
- goto done;
-
- fd = atoi ((char *) file_name);
- if (fd != lvm->container_fd)
- lvm->ext_container_fd = atoi ((char *) file_name);
-
-done:
- vec_free (path);
- return 0;
-}
-
void
linux_vfio_dma_map_regions (vlib_main_t * vm)
{
@@ -113,12 +89,6 @@ linux_vfio_dma_map_regions (vlib_main_t * vm)
if (lvm->container_fd != -1)
map_regions (vm, lvm->container_fd);
-
- if (lvm->ext_container_fd == -1)
- foreach_directory_file ("/proc/self/fd", scan_vfio_fd, 0, 0);
-
- if (lvm->ext_container_fd != -1)
- map_regions (vm, lvm->ext_container_fd);
}
static linux_pci_vfio_iommu_group_t *
@@ -252,8 +222,6 @@ linux_vfio_init (vlib_main_t * vm)
linux_vfio_main_t *lvm = &vfio_main;
int fd;
- lvm->ext_container_fd = -1;
-
fd = open ("/dev/vfio/vfio", O_RDWR);
/* check if iommu is available */
diff --git a/src/vlib/linux/vfio.h b/src/vlib/linux/vfio.h
index 8e0758cf2e4..e23cee19931 100644
--- a/src/vlib/linux/vfio.h
+++ b/src/vlib/linux/vfio.h
@@ -28,7 +28,6 @@ typedef struct
u32 flags;
#define LINUX_VFIO_F_HAVE_IOMMU (1 << 0)
int container_fd;
- int ext_container_fd; /* container fd used by external library, i.e DPDK */
/* VFIO */
int iommu_mode;