From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 551BB1B973; Tue, 10 Apr 2018 12:23:35 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2018 03:23:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,431,1517904000"; d="scan'208";a="45676387" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 10 Apr 2018 03:23:31 -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 w3AANU6B014492; Tue, 10 Apr 2018 11:23:30 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w3AANUj7031904; Tue, 10 Apr 2018 11:23:30 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w3AANUjO031900; Tue, 10 Apr 2018 11:23:30 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: gowrishankar.m@linux.vnet.ibm.com, alejandro.lucero@netronome.com, stable@dpdk.org Date: Tue, 10 Apr 2018 11:23:30 +0100 Message-Id: X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] vfio: fix device hotplug when several devices per group X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Apr 2018 10:23:36 -0000 We only need to perform DMA mapping for first device in first group. At the time of mapping, we haven't yet added the device into the group, so the count is expected to be zero. Fixes: 810bfa64c673 ("vfio: fix index for tracking devices in a group") Fixes: a9c349e3a100 ("vfio: fix device unplug when several devices per group") Fixes: 94c0776b1bad ("vfio: support hotplug") Cc: alejandro.lucero@netronome.com Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_vfio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index e44ae4d..15250ee 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -332,7 +332,8 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr, * functionality. */ if (internal_config.process_type == RTE_PROC_PRIMARY && - vfio_cfg.vfio_active_groups == 1) { + vfio_cfg.vfio_active_groups == 1 && + vfio_group_device_count(vfio_group_fd) == 0) { /* select an IOMMU type which we will be using */ const struct vfio_iommu_type *t = vfio_set_iommu_type(vfio_cfg.vfio_container_fd); -- 2.7.4