All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH] vfio: open VFIO container at startup rather than during init
Date: Tue, 17 Jun 2014 10:12:04 +0100	[thread overview]
Message-ID: <4bf447650cc99e316e6427e3a1c134dd417af4ec.1402996488.git.anatoly.burakov@intel.com> (raw)


Signed-off-by: Anatoly Burakov <anatoly.burakov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 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

             reply	other threads:[~2014-06-17  9:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17  9:12 Anatoly Burakov [this message]
     [not found] ` <4bf447650cc99e316e6427e3a1c134dd417af4ec.1402996488.git.anatoly.burakov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-06-17 16:50   ` [PATCH] vfio: open VFIO container at startup rather than during init Richardson, Bruce
2014-06-17 16:55   ` Thomas Monjalon
2014-06-18  8:57     ` Burakov, Anatoly
     [not found]       ` <C6ECDF3AB251BE4894318F4E451236976CC9CB58-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-06-18 10:08         ` Dumitrescu, Cristian
     [not found]           ` <3EB4FA525960D640B5BDFFD6A3D891261B1C6009-kPTMFJFq+rFP9JyJpTNKArfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-06-18 10:26             ` Burakov, Anatoly
     [not found]               ` <C6ECDF3AB251BE4894318F4E451236976CC9CCAC-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-06-18 11:00                 ` Neil Horman
     [not found]                   ` <20140618110018.GA7587-B26myB8xz7F8NnZeBjwnZQMhkBWG/bsMQH7oEaQurus@public.gmane.org>
2014-06-18 11:02                     ` Burakov, Anatoly
     [not found]                       ` <C6ECDF3AB251BE4894318F4E451236976CC9CCF3-kPTMFJFq+rF9qrmMLTLiibfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-06-18 11:07                         ` Neil Horman
2014-06-18 13:07   ` [PATCH v2 0/2] Fix issues with VFIO Anatoly Burakov
     [not found]     ` <cover.1403104031.git.anatoly.burakov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-06-18 17:55       ` [PATCH v3 " Richardson, Bruce
     [not found]         ` <59AF69C657FD0841A61C55336867B5B01AA37B5B-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-06-18 23:09           ` Thomas Monjalon
2014-06-18 18:51       ` Neil Horman
2014-06-18 13:07   ` [PATCH v2 1/2] vfio: open VFIO container at startup rather than during init Anatoly Burakov
2014-06-18 13:07   ` [PATCH v2 2/2] vfio: more verbose error messages Anatoly Burakov
     [not found] ` <cover.1403096022.git.anatoly.burakov-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-06-18 13:44   ` [PATCH v2 0/2] Fix issues with VFIO Neil Horman
2014-06-18 15:07   ` [PATCH v3 " Anatoly Burakov
2014-06-18 15:07   ` [PATCH v3 1/2] vfio: open VFIO container at startup rather than during init Anatoly Burakov
2014-06-18 15:07   ` [PATCH v3 2/2] vfio: more verbose error messages Anatoly Burakov

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=4bf447650cc99e316e6427e3a1c134dd417af4ec.1402996488.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov-ral2jqcrhueavxtiumwx3w@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.