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 952DA1B21F for ; Tue, 10 Oct 2017 10:03:00 +0200 (CEST) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9A7xUik082457 for ; Tue, 10 Oct 2017 04:02:59 -0400 Received: from smtp.notes.na.collabserv.com (smtp.notes.na.collabserv.com [192.155.248.72]) by mx0b-001b2d01.pphosted.com with ESMTP id 2dgsy413d6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 10 Oct 2017 04:02:59 -0400 Received: from localhost by smtp.notes.na.collabserv.com with smtp.notes.na.collabserv.com ESMTP for from ; Tue, 10 Oct 2017 08:02:58 -0000 Received: from us1a3-smtp06.a3.dal06.isc4sb.com (10.146.103.243) by smtp.notes.na.collabserv.com (10.106.227.158) with smtp.notes.na.collabserv.com ESMTP; Tue, 10 Oct 2017 08:02:54 -0000 Received: from us1a3-mail173.a3.dal06.isc4sb.com ([10.146.71.126]) by us1a3-smtp06.a3.dal06.isc4sb.com with ESMTP id 2017101008025422-197661 ; Tue, 10 Oct 2017 08:02:54 +0000 MIME-Version: 1.0 In-Reply-To: To: thomas@monjalon.net Cc: anatoly.burakov@intel.com, dev@dpdk.org, Alexey Kardashevskiy From: "Jonas Pfefferle1" Date: Tue, 10 Oct 2017 10:02:52 +0200 References: <1502191002-13988-1-git-send-email-jpf@zurich.ibm.com> X-KeepSent: E5AF1DFA:CCBA769B-C12581B5:002C1BC2; type=4; name=$KeepSent X-Mailer: IBM Notes Release 9.0.1 October 14, 2013 X-LLNOutbound: False X-Disclaimed: 64691 X-TNEFEvaluated: 1 x-cbid: 17101008-6059-0000-0000-000005B33F65 X-IBM-SpamModules-Scores: FL=0; FP=0; FZ=0; HX=0; KW=0; PH=0; SC=0.433748; ST=0; TS=0; UL=0; ISC=; MB=0.000013 X-IBM-SpamModules-Versions: BY=3.00007872; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000235; SDB=6.00929011; UDB=6.00467571; IPR=6.00709282; BA=6.00005632; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017472; XFM=3.00000015; UTC=2017-10-10 08:02:57 X-IBM-AV-DETECTION: SAVI=unsuspicious REMOTE=unsuspicious XFE=unused X-IBM-AV-VERSION: SAVI=2017-10-10 03:31:37 - 6.00007440 x-cbparentid: 17101008-6060-0000-0000-00008647B8D8 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-10_01:, , signatures=0 X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v4] vfio: fix sPAPR IOMMU DMA window size 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 Oct 2017 08:03:00 -0000 Hi Thomas, Can you please apply this patch? Thanks, Jonas Alexey Kardashevskiy wrote on 08/10/2017 08:03:17 AM: > From: Alexey Kardashevskiy > To: Jonas Pfefferle , anatoly.burakov@intel.com > Cc: dev@dpdk.org > Date: 08/10/2017 08:03 AM > Subject: Re: [PATCH v4] vfio: fix sPAPR IOMMU DMA window size > > On 08/08/17 21:16, Jonas Pfefferle wrote: > > DMA window size needs to be big enough to span all memory segment's > > physical addresses. We do not need multiple levels of IOMMU tables > > as we already span ~70TB of physical memory with 16MB hugepages. > > > > Signed-off-by: Jonas Pfefferle > > > Reviewed-by: Alexey Kardashevskiy > > > > > --- > > v2: > > * roundup to next power 2 function without loop. > > > > v3: > > * Replace roundup=5Fnext=5Fpow2 with rte=5Falign64pow2 > > > > v4: > > * do not assume ordering of physical addresses of memsegs > > > > lib/librte=5Feal/linuxapp/eal/eal=5Fvfio.c | 20 +++++++++++++++++--- > > 1 file changed, 17 insertions(+), 3 deletions(-) > > > > diff --git a/lib/librte=5Feal/linuxapp/eal/eal=5Fvfio.c b/lib/ > librte=5Feal/linuxapp/eal/eal=5Fvfio.c > > index 946df7e..7d5d61d 100644 > > --- a/lib/librte=5Feal/linuxapp/eal/eal=5Fvfio.c > > +++ b/lib/librte=5Feal/linuxapp/eal/eal=5Fvfio.c > > @@ -759,10 +759,19 @@ vfio=5Fspapr=5Fdma=5Fmap(int vfio=5Fcontainer=5Ff= d) > > return -1; > > } > > > > - /* calculate window size based on number of hugepages configured */ > > - create.window=5Fsize =3D rte=5Feal=5Fget=5Fphysmem=5Fsize(); > > + /* create DMA window from 0 to max(phys=5Faddr + len) */ > > + for (i =3D 0; i < RTE=5FMAX=5FMEMSEG; i++) { > > + if (ms[i].addr =3D=3D NULL) > > + break; > > + > > + create.window=5Fsize =3D RTE=5FMAX(create.window=5Fsize, > > + ms[i].phys=5Faddr + ms[i].len); > > + } > > + > > + /* sPAPR requires window size to be a power of 2 */ > > + create.window=5Fsize =3D rte=5Falign64pow2(create.window=5Fsize); > > create.page=5Fshift =3D =5F=5Fbuiltin=5Fctzll(ms->hugepage=5Fsz); > > - create.levels =3D 2; > > + create.levels =3D 1; > > > > ret =3D ioctl(vfio=5Fcontainer=5Ffd, VFIO=5FIOMMU=5FSPAPR=5FTCE=5FC= REATE, &create); > > if (ret) { > > @@ -771,6 +780,11 @@ vfio=5Fspapr=5Fdma=5Fmap(int vfio=5Fcontainer=5Ffd) > > return -1; > > } > > > > + if (create.start=5Faddr !=3D 0) { > > + RTE=5FLOG(ERR, EAL, " DMA window start address !=3D 0\n"); > > + return -1; > > + } > > + > > /* map all DPDK segments for DMA. use 1:1 PA to IOVA mapping */ > > for (i =3D 0; i < RTE=5FMAX=5FMEMSEG; i++) { > > struct vfio=5Fiommu=5Ftype1=5Fdma=5Fmap dma=5Fmap; > > > > > -- > Alexey >