From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: [PATCH 1/2] virtio: initialize iopl when device is initialized Date: Thu, 5 Mar 2015 16:45:25 -0800 Message-ID: <1425602726-26538-2-git-send-email-stephen@networkplumber.org> References: <1425602726-26538-1-git-send-email-stephen@networkplumber.org> To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1425602726-26538-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" The virtio driver needs to use in/out instructions therefore it must initialize using iopl(2) system call. The problem is that virtio initialization happens very early, and any application that uses daemon() or calls eal_init later in another context will fail. The fix is to move the iopl into rte_eal_init. Signed-off-by: Stephen Hemminger --- lib/librte_eal/linuxapp/eal/eal.c | 5 +++++ lib/librte_pmd_virtio/virtio_ethdev.c | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 16f9e7c..76481f7 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -764,6 +764,11 @@ rte_eal_init(int argc, char **argv) rte_panic("Cannot init IVSHMEM\n"); #endif +#ifdef RTE_LIBRTE_VIRTIO_PMD + if (rte_eal_iopl_init() != 0) + rte_panic("IOPL call failed - cannot use virtio PMD"); +#endif + if (rte_eal_memory_init() < 0) rte_panic("Cannot init memory\n"); diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index d239083..e2600de 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -1247,11 +1247,6 @@ static int rte_virtio_pmd_init(const char *name __rte_unused, const char *param __rte_unused) { - if (rte_eal_iopl_init() != 0) { - PMD_INIT_LOG(ERR, "IOPL call failed - cannot use virtio PMD"); - return -1; - } - rte_eth_driver_register(&rte_virtio_pmd); return 0; } -- 2.1.4