[dpdk-dev] [PATCH 2/2] net/virtio: do not require IO permissions

David Marchand david.marchand at redhat.com
Thu Oct 17 13:56:28 CEST 2019


On x86, iopl permissions are only needed when the virtio devices are
bound to a uio kernel module.

When running a dpdk application as non root, the virtio driver was
refusing to register because of this check while it could work when
binding the device to vfio (requires to have a vIOMMU configured).

We still need to call rte_eal_iopl_init() in the constructor so that
the interrupt thread would inherit this permission in the case it could
be used with UIO later.
Log a warning message for the user to understand what is wrong.

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 drivers/net/virtio/virtio_ethdev.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 7261109..3506ca0 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1995,11 +1995,6 @@ exit:
 static int eth_virtio_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	struct rte_pci_device *pci_dev)
 {
-	if (rte_eal_iopl_init() != 0) {
-		PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD");
-		return 1;
-	}
-
 	/* virtio pmd skips probe if device needs to work in vdpa mode */
 	if (vdpa_mode_selected(pci_dev->device.devargs))
 		return 1;
@@ -2031,7 +2026,8 @@ static struct rte_pci_driver rte_virtio_pmd = {
 
 RTE_INIT(rte_virtio_pmd_init)
 {
-	rte_eal_iopl_init();
+	if (rte_eal_iopl_init() != 0)
+		PMD_INIT_LOG(WARNING, "IOPL call failed - virtio devices won't be functional if bound to UIO drivers");
 	rte_pci_register(&rte_virtio_pmd);
 }
 
-- 
1.8.3.1



More information about the dev mailing list