From patchwork Fri Mar 6 00:45:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 3896 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 219645A73; Fri, 6 Mar 2015 01:45:37 +0100 (CET) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by dpdk.org (Postfix) with ESMTP id 586E25A72 for ; Fri, 6 Mar 2015 01:45:35 +0100 (CET) Received: by pdbft15 with SMTP id ft15so10210279pdb.6 for ; Thu, 05 Mar 2015 16:45:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qIVuXbOgCj4wLZbozP1Fhl/vbBnBGgWg8uJFhVdvQSA=; b=SYh5cjnatPnYMql7duhplroLAqKAmBNsp3F4VGZe8l5x9nc28X03BpoZyECpn0Hbze sB146j0vcaf+Kv0y36h9tEpXRUx7cidbJQ5zoOeEO4kDxEnugiV58q9uVLWMXKvzaf38 xKyZzDMrlOBR899wyBxdfdvTL1+M9cr0KWTiBhZZ67lu15wmQb22rbTYit74Gv67MUj/ oBKACRRvKxTqjaIqlatTrQ/wUS/rKOrN5rctFbJRPFvfOqteSZZIYT1nesvsupfp8JTa A3U+azHJMhzjMFo64qcU7ei224GnvHynl+aUBMTxMlGOgnoQ1wTkohVIJVH5zP1kk3NC 4V2A== X-Gm-Message-State: ALoCoQnDL0pf8tkAE2KG3Igs/iPUrGMsIhspisYMQ6JioJK8VYQn1x45EBaKdpXBIfHFvllouMPb X-Received: by 10.70.0.66 with SMTP id 2mr20804883pdc.4.1425602734532; Thu, 05 Mar 2015 16:45:34 -0800 (PST) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id a4sm8005030pdf.57.2015.03.05.16.45.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Mar 2015 16:45:33 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Date: Thu, 5 Mar 2015 16:45:25 -0800 Message-Id: <1425602726-26538-2-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1425602726-26538-1-git-send-email-stephen@networkplumber.org> References: <1425602726-26538-1-git-send-email-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 1/2] virtio: initialize iopl when device is initialized X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.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; }