From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <anatoly.burakov@intel.com>
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 4CF9C1E34
 for <dev@dpdk.org>; Fri, 28 Apr 2017 13:19:28 +0200 (CEST)
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
 by fmsmga105.fm.intel.com with ESMTP; 28 Apr 2017 04:19:28 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.37,387,1488873600"; d="scan'208";a="254591305"
Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75])
 by fmsmga004.fm.intel.com with ESMTP; 28 Apr 2017 04:19:27 -0700
Received: from irsmsx111.ger.corp.intel.com (10.108.20.4) by
 IRSMSX153.ger.corp.intel.com (163.33.192.75) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Fri, 28 Apr 2017 12:19:26 +0100
Received: from irsmsx109.ger.corp.intel.com ([169.254.13.12]) by
 irsmsx111.ger.corp.intel.com ([169.254.2.58]) with mapi id 14.03.0319.002;
 Fri, 28 Apr 2017 12:19:26 +0100
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA
 window was	created at unexpected offset
Thread-Index: AQHSvmRw8A8/RIKfoEK1r2VMYOy9VqHapRAA
Date: Fri, 28 Apr 2017 11:19:25 +0000
Message-ID: <C6ECDF3AB251BE4894318F4E4512369782211472@IRSMSX109.ger.corp.intel.com>
References: <20170426080908.24026-1-aik@ozlabs.ru>
In-Reply-To: <20170426080908.24026-1-aik@ozlabs.ru>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-ctpclassification: CTP_PUBLIC
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZGJiOWI0YmItOTNmMy00NjNiLTgxZmMtMWJjNDM5NTVlN2NkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNi41LjkuMyIsIlRydXN0ZWRMYWJlbEhhc2giOiI3YVppRExoMm1oMjZLSmU1eHdraFwvd2hlSzlXQ0dMWkpFSUFwTVBkZFk5ND0ifQ==
dlp-product: dlpe-windows
dlp-version: 10.0.102.7
dlp-reaction: no-action
x-originating-ip: [163.33.239.180]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA window
 was	created at unexpected offset
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 28 Apr 2017 11:19:29 -0000

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Alexey
> Kardashevskiy
> Sent: Wednesday, April 26, 2017 9:09 AM
> To: dev@dpdk.org
> Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> Subject: [dpdk-dev] [PATCH dpdk v2] vfio/ppc64/spapr: Warn if DMA
> window was created at unexpected offset
>=20
> VFIO_IOMMU_SPAPR_TCE_CREATE ioctl() returns the actual bus address for
> just created DMA window. It happens to start from zero because the defaul=
t
> window is removed (leaving no windows) and new window starts from zero.
> However this is not guaranteed and a new window may start from another
> address, this adds a check and an error message.
>=20
>=20
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> Changes:
> v2:
> * this just prints warning and fails instead of incorrectly changing IOVA
> addresses
> ---
>  lib/librte_eal/linuxapp/eal/eal_vfio.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>=20
> diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c
> b/lib/librte_eal/linuxapp/eal/eal_vfio.c
> index 46f951f4d..530815790 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
> @@ -702,6 +702,13 @@ vfio_spapr_dma_map(int vfio_container_fd)
>  		return -1;
>  	}
>=20
> +	if (create.start_addr) {
> +		RTE_LOG(ERR, EAL,
> +			"  DMA offsets other than zero is not supported, "
> +			"new window is created at %lx\n",
> create.start_addr);
> +		return -1;
> +	}
> +
>  	/* map all DPDK segments for DMA. use 1:1 PA to IOVA mapping */
>  	for (i =3D 0; i < RTE_MAX_MEMSEG; i++) {
>  		struct vfio_iommu_type1_dma_map dma_map; @@ -734,7
> +741,6 @@ vfio_spapr_dma_map(int vfio_container_fd)
>  				"error %i (%s)\n", errno, strerror(errno));
>  			return -1;
>  		}
> -
>  	}
>=20
>  	return 0;
> --
> 2.11.0

Hi Alexey,

There are some compile failures with this patch. You'll probably want to re=
place %lx with PRIx64 or similar :)

I would argue that just saying "DMA offsets other than zero are not support=
ed" will be sufficient and will make error message less confusing. Up to yo=
u though.

Thanks,
Anatoly