From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0063.outbound.protection.outlook.com [104.47.38.63]) by dpdk.org (Postfix) with ESMTP id A10061B2D0 for ; Fri, 6 Oct 2017 13:04:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=fWq3Qkpa6vc4IZ/2mgPxRwsBik8OHMWCm8wdK+H+6Ig=; b=jSxRBxYCL64CbhVn5oBzjGgYUDEtImLtSpViHerLy9a3qxEw7ZsZBO8Pje5rZotcyXtYtd0WaEVdmxIxV6hUnk5PpfJdotfYrMye8jH3qB1NGHd8RpED0gbHen4xH81Fhm0/WW5hnCpuCGlGM+oxhNFrb9nS3j6MJHAmPDsAQfU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by CY4PR07MB3094.namprd07.prod.outlook.com (10.172.115.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 6 Oct 2017 11:04:48 +0000 From: Santosh Shukla To: olivier.matz@6wind.com, dev@dpdk.org Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, aconole@redhat.com, stephen@networkplumber.org, anatoly.burakov@intel.com, gaetan.rivet@6wind.com, shreyansh.jain@nxp.com, bruce.richardson@intel.com, sergio.gonzalez.monroy@intel.com, maxime.coquelin@redhat.com, Santosh Shukla Date: Fri, 6 Oct 2017 16:33:44 +0530 Message-Id: <20171006110346.13247-8-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171006110346.13247-1-santosh.shukla@caviumnetworks.com> References: <20170920112356.17629-1-santosh.shukla@caviumnetworks.com> <20171006110346.13247-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: CY4PR1201CA0022.namprd12.prod.outlook.com (10.172.75.32) To CY4PR07MB3094.namprd07.prod.outlook.com (10.172.115.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c21cd7e5-8979-4183-1862-08d50caa1260 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:CY4PR07MB3094; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3094; 3:C64R/l9kWORhEKYnNTBqunyVrBueojxc6c180NYbYFAnM3AcizA7GHc6W96zTx+0zYff5bgggtAntvi+7zG9JbCagSA7GuhyVdbcvqGvFYTJs+/KXUMSVd05884w+SflNxgHw+cNVMB/uC0H3n+od/9dHEdHYX0vyMe1B2i36fMPdggiN3rzYSSXVd2+NOH65AJAbs4vBoCytJY6Pl37EtpaLmOQsv49jtkW1NpXRvU6cBNUlSm1egAIvQ3gSxhx; 25:qGwjlAOtWNFSRmx0uwYI1N+74RvqANuk01xXncshkoP/8KRJG0LGCntKLgpmFsZpMyPy+l0c4CFMyINQd+wW4i4fmFe/sf/LGcKcxNnnoJJZyglhxBKTRPOQ4Tu6bWt79ss7sj5YkZtsLwvbS54GlgNIHlslj40j5FlPlhdaZcpK19Tu9/ma6TCpqRXqK83ux5qJRoT/BJy7Vf9uiwEbsu+mXG5q9k5fEBEHtQ+/qahaaVtuBUDJAx7Y93wMeK439qFpLK/Hzb+9Zd9YpHLGXO5CPSy62PZyP7QAUFlZXzCmb5/4sZ4TAvame7qBAhgejX9FSPDjOgPGfOd+fGT0mA==; 31:LHHpEnxdOm68PLq484aTABAEkhnBtox9c/ucZQdJGDMSCZPP7ocWDTGBg0k38Als+st89lbff+Ncydviv4Yh/t3si3/zc6Yna6NN/MUmJnQsRsqtuQfkUQZHz0wg1UfYEFHXTYaq3K8ComEbgnSXrGLK3rZbJ3PbmnqBf9w70+K5/ajK03A0KhQg3op3vJlSudDfSDkkV4gdxFsrPcUNyuNezO5KDm7nA+BLH94IM6Y= X-MS-TrafficTypeDiagnostic: CY4PR07MB3094: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3094; 20:VLkNgo1/Lhvl3d7LBlYliSmaOcECLc/+L8pwaatzUkTZ1kDNo5xiFaj5gPxmEfzWIxzQc7pvLf0D3wOMI0TF96FFUOpANAINyE4DC2y3WXlfb3EChUApQUzoNpTY1lXTRHWSMSNY++VLxsIJ5tkTC+PEzNTrgr5lOdrQTI3byd2N+IWCmRbD4YVs0gad3uOpNCg3P5OCvk0csj/d55cECoUQcPQA5/EDAI3nKJaCM9gq/oBDuaCKZLSL5EqKMICYDLC3hSi4X6Uh9vDpI+9jMn0dgsT+oja1urW0PXoLjwYJKnKEjzZzVji5cF5AzkkdxcARu+BUf3P6XX61QoPimgo1pFEGCVnsV0xAutBX8CtyabAQJSkXHe5A64U2PRCVzfI+yTGFhnFnM16x9DwnXO/05f1T5Ya5HHD7JW4Z4j7PlzzN5cnVSS6QsdwysJEl5o6O+9YLICSP4JRWTLz1srSwXW0Y+r3+g1n9BbjHX3CXkHU3G3GbYJKsXz16VLgczQXZhjh/7oD4pzFLdAicoUq+PBkhxOXuV8Ex0PQdbBVcsZ/jsQVPUObUMN5ep2GRFlwKgeSVQWbqjI/6+qlQnM1XyMWKkTdXHvDA+GuQWOg= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(6041248)(20161123555025)(20161123564025)(20161123560025)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR07MB3094; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR07MB3094; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3094; 4:IwNNfFpSn+KIe6VgjnMV5RksBnuY/Q9k66C1FZdpVCo0lvcsfZ044WQ6WxN6yQ7NgZf8Iov/SG3Jrol1hDx7GosPpSo0POhntxNIyhzI/2PRbl+SOQVfVI1MuXyiXI/yuNZVw3ZXGESrgCzlqiUEKFraYLT5x8sIP8jahgg2ty2nDwhnHgapl0lC0VdaV9wLX51uP9DAsesGc49QVGcdYPbLS1lIrfVtV4++ybyaVXG8paJFHSIUMDmW6UNFWEF2J119ktnoLqva9bx8wnAYejQeuxDwwtU62hFNXlMRrqNga3aPPIJ46rIWqd55+ki/DVucLc2hZGh2G8afFMTOJA== X-Forefront-PRVS: 0452022BE1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(346002)(376002)(189002)(199003)(97736004)(2950100002)(5660300001)(7416002)(105586002)(6512007)(53936002)(106356001)(478600001)(6666003)(50226002)(189998001)(8936002)(25786009)(81166006)(81156014)(8676002)(107886003)(2906002)(5003940100001)(6486002)(76176999)(305945005)(8656003)(50466002)(36756003)(4326008)(1076002)(68736007)(48376002)(7736002)(72206003)(3846002)(6506006)(316002)(33646002)(16526018)(5009440100003)(101416001)(66066001)(6116002)(47776003)(16586007)(50986999)(42882006); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3094; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3094; 23:Fy+YoDJP1wbEzDhSrTigLqZh+icM9d5S/F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PK+bHAFYioq9FB9/0QYtK82/WpFtD2RGM9Vh2uS+7cQvYBo7hbQwcQCfGitlSaa1JIPYrVlJbPnLe+GOGA2iVlfcBMXgrKE81OO5y9nrVQMCyjsFZbqlLtoV7KFsJL2pT/zrAOMiPYbAdzrMbkK16tfhIGWBfFyanT5XxkMJo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2017 11:04:48.7710 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3094 Subject: [dpdk-dev] [PATCH v10 7/9] linuxapp/eal_vfio: honor iova mode before mapping 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, 06 Oct 2017 11:04:56 -0000 Check iova mode and accordingly map iova to pa or va. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob Reviewed-by: Maxime Coquelin Acked-by: Anatoly Burakov Tested-by: Hemant Agrawal --- lib/librte_eal/linuxapp/eal/eal_vfio.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index c8a97b7e7..b32cd09a2 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -706,7 +706,10 @@ vfio_type1_dma_map(int vfio_container_fd) dma_map.argsz = sizeof(struct vfio_iommu_type1_dma_map); dma_map.vaddr = ms[i].addr_64; dma_map.size = ms[i].len; - dma_map.iova = ms[i].phys_addr; + if (rte_eal_iova_mode() == RTE_IOVA_VA) + dma_map.iova = dma_map.vaddr; + else + dma_map.iova = ms[i].phys_addr; dma_map.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE; ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map); @@ -792,7 +795,10 @@ vfio_spapr_dma_map(int vfio_container_fd) dma_map.argsz = sizeof(struct vfio_iommu_type1_dma_map); dma_map.vaddr = ms[i].addr_64; dma_map.size = ms[i].len; - dma_map.iova = ms[i].phys_addr; + if (rte_eal_iova_mode() == RTE_IOVA_VA) + dma_map.iova = dma_map.vaddr; + else + dma_map.iova = ms[i].phys_addr; dma_map.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE; -- 2.14.1