From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id C3D2C271 for ; Mon, 27 Nov 2017 10:31:17 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2017 01:31:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,464,1505804400"; d="scan'208";a="178174979" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 27 Nov 2017 01:31:15 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Nov 2017 01:31:02 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 27 Nov 2017 01:31:01 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.213]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Mon, 27 Nov 2017 17:30:38 +0800 From: "Zhang, Qi Z" To: Chas Williams <3chas3@gmail.com>, "dev@dpdk.org" CC: "skhare@vmware.com" , Chas Williams Thread-Topic: [dpdk-dev] [PATCH] vfio: try physical address if virtual address fails Thread-Index: AQHTZYADKltiVwng4ka4ghEDfuuCI6Mn9ceA Date: Mon, 27 Nov 2017 09:30:38 +0000 Message-ID: <039ED4275CED7440929022BC67E706115311683A@SHSMSX103.ccr.corp.intel.com> References: <20171124235718.6064-1-3chas3@gmail.com> In-Reply-To: <20171124235718.6064-1-3chas3@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] vfio: try physical address if virtual address fails 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: Mon, 27 Nov 2017 09:31:18 -0000 Hi William: > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Chas Williams > Sent: Saturday, November 25, 2017 7:57 AM > To: dev@dpdk.org > Cc: skhare@vmware.com; Chas Williams <3chas3@gmail.com>; Chas > Williams > Subject: [dpdk-dev] [PATCH] vfio: try physical address if virtual address= fails >=20 > Some machines appear to have buggy DMAR mappings. A typical mapping > error looks like: >=20 > DMAR: intel_iommu_map: iommu width (39) is not sufficient for the > mapped address (7fc4fa800000) > DMAR: intel_iommu_map: iommu width (39) is not sufficient for the > mapped address (7fc4fa800000) > DMAR: intel_iommu_map: iommu width (39) is not sufficient for the > mapped address (7fc4fa800000) > DMAR: intel_iommu_map: iommu width (39) is not sufficient for the > mapped address (7fc4fa800000) >=20 I met the same issue on some intel atom platform, the root cause is IOMMU o= nly support 39 bit virtual address. Not sure retry with physical address will be the right fix. I saw rte_eal_i= ova_mode is called at other place, it still take the virtual address as the= mapped result, does that break something?=20 So far the workaround may works by using --virtbase-addr to assign a addres= s in range explicitly (for example 0x70,0000,0000) Regards Qi > To work around this, attempt to do a physical address mapping if the virt= ual > address mapping fails. >=20 > Fixes: e85a919286d2 ("vfio: honor IOVA mode before mapping") >=20 > Signed-off-by: Chas Williams > --- > lib/librte_eal/linuxapp/eal/eal_vfio.c | 8 ++++++++ > 1 file changed, 8 insertions(+) >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c > b/lib/librte_eal/linuxapp/eal/eal_vfio.c > index 58f0123..6250676 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include >=20 > #include > #include > @@ -702,6 +703,7 @@ vfio_type1_dma_map(int vfio_container_fd) > /* 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; > + int retried =3D false; >=20 > if (ms[i].addr =3D=3D NULL) > break; > @@ -716,9 +718,15 @@ vfio_type1_dma_map(int vfio_container_fd) > dma_map.iova =3D ms[i].iova; > dma_map.flags =3D VFIO_DMA_MAP_FLAG_READ | > VFIO_DMA_MAP_FLAG_WRITE; >=20 > +retry: > ret =3D ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, > &dma_map); >=20 > if (ret) { > + if (!retried && rte_eal_iova_mode() =3D=3D RTE_IOVA_VA) { > + dma_map.iova =3D ms[i].iova; > + retried =3D true; > + goto retry; > + } > RTE_LOG(ERR, EAL, " cannot set up DMA remapping, " > "error %i (%s)\n", errno, > strerror(errno)); > -- > 2.9.5 Regards Qi