From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id EF9C9A317C for ; Thu, 17 Oct 2019 13:56:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A5D191E98E; Thu, 17 Oct 2019 13:56:50 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 609F81E989 for ; Thu, 17 Oct 2019 13:56:48 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DAEF3022E31; Thu, 17 Oct 2019 11:56:47 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-29.brq.redhat.com [10.40.204.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5E1619C69; Thu, 17 Oct 2019 11:56:40 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Maxime Coquelin , Tiwei Bie , Zhihong Wang Date: Thu, 17 Oct 2019 13:56:28 +0200 Message-Id: <1571313388-32142-3-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571313388-32142-1-git-send-email-david.marchand@redhat.com> References: <1571313388-32142-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 17 Oct 2019 11:56:47 +0000 (UTC) Subject: [dpdk-dev] [PATCH 2/2] net/virtio: do not require IO permissions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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