From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 8139F30D for ; Tue, 17 Jun 2014 11:12:26 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 17 Jun 2014 02:12:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,493,1400050800"; d="scan'208";a="556683436" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 17 Jun 2014 02:12:05 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s5H9C4aP001741; Tue, 17 Jun 2014 10:12:04 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id s5H9C4xK030549; Tue, 17 Jun 2014 10:12:04 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with id s5H9C4Bc030545; Tue, 17 Jun 2014 10:12:04 +0100 From: Anatoly Burakov To: dev@dpdk.org Date: Tue, 17 Jun 2014 10:12:04 +0100 Message-Id: <4bf447650cc99e316e6427e3a1c134dd417af4ec.1402996488.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] vfio: open VFIO container at startup rather than during init 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: , X-List-Received-Date: Tue, 17 Jun 2014 09:12:27 -0000 Signed-off-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index 4de6061..9eb5dcd 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -523,17 +523,6 @@ pci_vfio_map_resource(struct rte_pci_device *dev) rte_snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT, loc->domain, loc->bus, loc->devid, loc->function); - /* get container fd (needs to be done only once per initialization) */ - if (vfio_cfg.vfio_container_fd == -1) { - int vfio_container_fd = pci_vfio_get_container_fd(); - if (vfio_container_fd < 0) { - RTE_LOG(ERR, EAL, " %s cannot open VFIO container!\n", pci_addr); - return -1; - } - - vfio_cfg.vfio_container_fd = vfio_container_fd; - } - /* get group number */ iommu_group_no = pci_vfio_get_group_no(pci_addr); @@ -770,10 +759,10 @@ pci_vfio_enable(void) vfio_cfg.vfio_groups[i].fd = -1; vfio_cfg.vfio_groups[i].group_no = -1; } - vfio_cfg.vfio_container_fd = -1; + vfio_cfg.vfio_container_fd = pci_vfio_get_container_fd(); /* check if we have VFIO driver enabled */ - if (access(VFIO_DIR, F_OK) == 0) + if (vfio_cfg.vfio_container_fd != -1) vfio_cfg.vfio_enabled = 1; else RTE_LOG(INFO, EAL, "VFIO driver not loaded or wrong permissions\n"); -- 1.8.1.4