dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH 1/2] virtio: initialize iopl when device is initialized
Date: Thu,  5 Mar 2015 16:45:25 -0800	[thread overview]
Message-ID: <1425602726-26538-2-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1425602726-26538-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>

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 <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
---
 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

  parent reply	other threads:[~2015-03-06  0:45 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  0:45 [PATCH 0/2] virtio: bugfixes Stephen Hemminger
     [not found] ` <1425602726-26538-1-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-03-06  0:45   ` Stephen Hemminger [this message]
     [not found]     ` <1425602726-26538-2-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-03-06  3:41       ` [PATCH 1/2] virtio: initialize iopl when device is initialized Ouyang, Changchun
     [not found]         ` <F52918179C57134FAEC9EA62FA2F962511A0C1AF-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-06 16:20           ` Stephen Hemminger
2015-03-06 16:33             ` David Marchand
     [not found]               ` <CALwxeUuVtO3Dp4Y3UWQU9HtaVtAffOTzV9jnuETMvZ+NSgamfA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-06 16:55                 ` Stephen Hemminger
2015-03-06 22:04                   ` David Marchand
     [not found]                     ` <CALwxeUuGMh5q2O6zxOEkUaNUyehxmb_0ruvf+hsq_Y7nfNF2-Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-06 23:43                       ` Stephen Hemminger
2015-03-07  6:53                         ` David Marchand
2015-03-09 11:05             ` David Marchand
     [not found]               ` <CALwxeUuQtv685KnbmpZKCPkrAqmjLs558xeCW7c=-TPTsB423w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-09 14:56                 ` [PATCH 0/2] fix virtio interrupt handling David Marchand
     [not found]                   ` <1425912999-13118-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-03-09 14:56                     ` [PATCH 1/2] eal/linux: move plugin load to very start of eal init David Marchand
     [not found]                       ` <1425912999-13118-2-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-03-09 15:21                         ` Neil Horman
     [not found]                           ` <20150309152106.GA24326-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2015-03-10  9:08                             ` David Marchand
     [not found]                               ` <CALwxeUs4hPbYDPBUfz9u2AoiCoj_wwTsAyj=_1xxzuT6LLW6nw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-10 10:55                                 ` Neil Horman
2015-10-14  0:05                                   ` Stephen Hemminger
2015-10-14  9:55                                     ` David Marchand
2015-03-09 14:56                     ` [PATCH 2/2] virtio: change io privilege level as early as possible David Marchand
     [not found]                       ` <1425912999-13118-3-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-03-10 13:14                         ` Neil Horman
2015-09-29 19:25                           ` Stephen Hemminger
2015-09-30  8:28                             ` David Marchand
2015-09-30 14:52                               ` Neil Horman
2015-09-30 15:37                                 ` Thomas Monjalon
2015-09-30 17:26                                   ` Stephen Hemminger
2015-10-01 11:25                                   ` Neil Horman
2015-10-12 20:08                                     ` Stephen Hemminger
2015-10-14  0:07                                     ` Stephen Hemminger
2015-10-14  8:00                                       ` David Marchand
2015-10-14  9:49                                         ` David Marchand
2015-10-14  9:50                                           ` [PATCH] eal: move interrupt init after device init David Marchand
2015-10-14 11:32                                             ` David Marchand
2015-10-20 21:22                                               ` Thomas Monjalon
2015-07-29 17:26             ` [PATCH 1/2] virtio: initialize iopl when device is initialized Thomas Monjalon
2015-03-06  0:45   ` [PATCH 2/2] virtio: allow running w/o vlan filtering Stephen Hemminger
     [not found]     ` <1425602726-26538-3-git-send-email-stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
2015-03-06  3:39       ` Ouyang, Changchun
     [not found]         ` <F52918179C57134FAEC9EA62FA2F962511A0C194-E2R4CRU6q/6iAffOGbnezLfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-06 16:24           ` Stephen Hemminger
2015-07-29 12:56             ` Thomas Monjalon
2015-07-30  1:23               ` Ouyang, Changchun
2015-08-04 12:51               ` Vincent JARDIN
2015-08-05  1:01                 ` Ouyang, Changchun
2015-08-05  1:22                   ` Stephen Hemminger
2015-08-05 10:49                   ` Vincent JARDIN
2015-10-21 13:58                     ` Thomas Monjalon
2017-02-15  8:38                       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425602726-26538-2-git-send-email-stephen@networkplumber.org \
    --to=stephen-otpzqlsittunbdjkjebofr2eb7je58tq@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).