From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by dpdk.org (Postfix) with ESMTP id 974EC2C08 for ; Fri, 21 Apr 2017 11:13:36 +0200 (CEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v3L98k3Z002155 for ; Fri, 21 Apr 2017 05:13:35 -0400 Received: from e23smtp09.au.ibm.com (e23smtp09.au.ibm.com [202.81.31.142]) by mx0a-001b2d01.pphosted.com with ESMTP id 29xwqhk29w-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 21 Apr 2017 05:13:35 -0400 Received: from localhost by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 21 Apr 2017 19:13:31 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp09.au.ibm.com (202.81.31.206) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 21 Apr 2017 19:13:25 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v3L9DE9O49217760 for ; Fri, 21 Apr 2017 19:13:22 +1000 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v3L9CjsU017931 for ; Fri, 21 Apr 2017 19:12:45 +1000 Received: from [9.193.77.196] ([9.193.77.196]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v3L9ChwN017554; Fri, 21 Apr 2017 19:12:43 +1000 To: dev@dpdk.org, Anatoly Burakov References: <1491321976-27290-1-git-send-email-arybchenko@solarflare.com> Cc: Andrew Rybchenko , Alejandro Lucero , Alexey Kardashevskiy , Thomas Monjalon From: gowrishankar muthukrishnan Date: Fri, 21 Apr 2017 14:42:26 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <1491321976-27290-1-git-send-email-arybchenko@solarflare.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable x-cbid: 17042109-0052-0000-0000-0000023124FF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042109-0053-0000-0000-0000080B7D50 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-21_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704210171 Subject: Re: [dpdk-dev] [PATCH] vfio: set IOMMU type for the container once 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: Fri, 21 Apr 2017 09:13:37 -0000 Could this patch be reviewed and merged for 17.05 rc3 ?. It solved regression with i40e pmd bring up in one of our ppc64le server models through vfio-pci pci module. Thanks Alexey pointing out this in one of your patches. Regards, Gowrishankar On Tuesday 04 April 2017 09:36 PM, Andrew Rybchenko wrote: > If more than one used PCI device belongs to one IOMMU group, > it is still one IOMMU group and the container IOMMU type > should be set only once. > > Fixes: 94c0776b1bad ("vfio: support hotplug") > > Signed-off-by: Andrew Rybchenko > --- > My testing of the patch is limitted to my configuration with 2 PCI > functions which belong to one IOMMU group. > > lib/librte_eal/linuxapp/eal/eal_vfio.c | 54 ++++++++++++++++++---------------- > 1 file changed, 29 insertions(+), 25 deletions(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c > index 6e2e84c..dd59c1c 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c > @@ -298,33 +298,37 @@ vfio_setup_device(const char *sysfs_base, const char *dev_addr, > clear_group(vfio_group_fd); > return -1; > } > - } > > - /* > - * pick an IOMMU type and set up DMA mappings for container > - * > - * needs to be done only once, only when first group is assigned to > - * a container and only in primary process. Note this can happen several > - * times with the hotplug functionality. > - */ > - if (internal_config.process_type == RTE_PROC_PRIMARY && > - vfio_cfg.vfio_active_groups == 1) { > - /* select an IOMMU type which we will be using */ > - const struct vfio_iommu_type *t = > + /* > + * pick an IOMMU type and set up DMA mappings for container > + * > + * needs to be done only once, only when first group is > + * assigned to a container and only in primary process. > + * Note this can happen several times with the hotplug > + * functionality. > + */ > + if (internal_config.process_type == RTE_PROC_PRIMARY && > + vfio_cfg.vfio_active_groups == 1) { > + /* select an IOMMU type which we will be using */ > + const struct vfio_iommu_type *t = > vfio_set_iommu_type(vfio_cfg.vfio_container_fd); > - if (!t) { > - RTE_LOG(ERR, EAL, " %s failed to select IOMMU type\n", dev_addr); > - close(vfio_group_fd); > - clear_group(vfio_group_fd); > - return -1; > - } > - ret = t->dma_map_func(vfio_cfg.vfio_container_fd); > - if (ret) { > - RTE_LOG(ERR, EAL, " %s DMA remapping failed, " > - "error %i (%s)\n", dev_addr, errno, strerror(errno)); > - close(vfio_group_fd); > - clear_group(vfio_group_fd); > - return -1; > + if (!t) { > + RTE_LOG(ERR, EAL, > + " %s failed to select IOMMU type\n", > + dev_addr); > + close(vfio_group_fd); > + clear_group(vfio_group_fd); > + return -1; > + } > + ret = t->dma_map_func(vfio_cfg.vfio_container_fd); > + if (ret) { > + RTE_LOG(ERR, EAL, > + " %s DMA remapping failed, error %i (%s)\n", > + dev_addr, errno, strerror(errno)); > + close(vfio_group_fd); > + clear_group(vfio_group_fd); > + return -1; > + } > } > } >