diff options
author | Damjan Marion <damarion@cisco.com> | 2018-03-26 15:35:33 +0200 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2018-03-26 20:00:05 +0000 |
commit | 20ba16461ce232f5bb785b6b6189cf834ccfee1e (patch) | |
tree | 091fac7d4f928710387dad634fab526087f46f1a /src/vlib/linux/pci.c | |
parent | 43fc6884b5cb0e6042450b23bd457592ce2cad4d (diff) |
vlib: add support for vfio no-iommu mode
Change-Id: Ic83971d8d9d8d0bb90a35932e60761cd728457f3
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/linux/pci.c')
-rw-r--r-- | src/vlib/linux/pci.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c index 910f8c2f9cc..127d2ef167a 100644 --- a/src/vlib/linux/pci.c +++ b/src/vlib/linux/pci.c @@ -263,6 +263,17 @@ vlib_pci_get_device_info (vlib_pci_addr_t * addr, clib_error_t ** error) di->iommu_group = atoi ((char *) tmpstr); vec_free (tmpstr); } + vec_reset_length (f); + f = format (f, "%v/iommu_group/name%c", dev_dir_name, 0); + err = clib_sysfs_read ((char *) f, "%s", &tmpstr); + if (err == 0) + { + if (strncmp ((char *) tmpstr, "vfio-noiommu", 12) == 0) + di->flags |= VLIB_PCI_DEVICE_INFO_F_NOIOMMU; + vec_free (tmpstr); + } + else + clib_error_free (err); } close (fd); @@ -695,7 +706,7 @@ add_device_uio (linux_pci_device_t * p, vlib_pci_device_info_t * di, err = r->init_function (lpm->vlib_main, p->handle); error: - free (s); + vec_free (s); if (err) { if (p->config_fd != -1) |