From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0076.outbound.protection.outlook.com [104.47.38.76]) by dpdk.org (Postfix) with ESMTP id 98E603790 for ; Thu, 8 Jun 2017 13:06:27 +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=IUDC5IhkllqChcudGaxuLUGe+r9tn0ExiavxWZtkM58=; b=AwmUZYBcVmpSSOuxKEE6g+PecDHOQwND3x/toB34YiYN4Wo+3Ki/uCxhAIf9CtEg69B/Fw30r6qcoFmzl6+DYArbROndbmNlnNFQyf4VlqikmXD4HpiN7vlPR/+f1y0O4BcTlFv0V5Ym5wfNLna7zJ8HVldS54PVxL/uTVE8vgE= Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain (14.140.2.178) by DM5PR07MB3099.namprd07.prod.outlook.com (10.172.85.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1143.10; Thu, 8 Jun 2017 11:06:24 +0000 From: Santosh Shukla To: thomas@monjalon.net, bruce.richardson@intel.com, dev@dpdk.org Cc: jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com, gaetan.rivet@6wind.com, Santosh Shukla Date: Thu, 8 Jun 2017 16:35:10 +0530 Message-Id: <20170608110513.22548-8-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170608110513.22548-1-santosh.shukla@caviumnetworks.com> References: <20170608110513.22548-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BMXPR01CA0025.INDPRD01.PROD.OUTLOOK.COM (10.174.214.11) To DM5PR07MB3099.namprd07.prod.outlook.com (10.172.85.9) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR07MB3099: X-MS-Office365-Filtering-Correlation-Id: 385883d9-968f-48e1-db97-08d4ae5e685f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:DM5PR07MB3099; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3099; 3:ufmJ/HlKQWpbCuErDMuI9dg+RA3QO/1Zw1mpT2DlHHebZcxgfw/li7lhC80Qi/ssBgwXTyO3kMMreiNQIlm3OJ+44LX57uQjLksAQS5YEn/D9W5F2bAyP/V/T7r2ZiMcvo5Y+Waxpp8b0oaRh3FyJSB3ruGY121ML8BW5xUftUd7tkNDccNzgJN7VVZNxH5BGKWMfM/1b/C8CnZnmcZlnXIj0BSrHhU9xRzVFrgcHhndI/fOzk/Je8bsYa3HV8sRK1sey35zQFe2etfJXtVaYlltReaK0znpCm2/dH0efGj380UnmRcGYbzRvN5mpFMPCYyYeASUkMbFe52h7iWQIg==; 25:5ImVpEXgpn2ejq50e8HfgPYeJbrFj5PJad5+B5yE4nIvqPvj1bdg07tLp6KrxPCzJFAxt+RrBL1X+0Uc1nXAkkT3thoEkyhBelEgLsbQHtK9YHIfeJ7tZbVWVqUo1rZoZr5iDwDr4LeWfTsegU4v1EVNKvJPaUR6aSU13B8kVDUOt8cO4/imvwj+nNiP12Ca3QjLu/X0p7yzWM3K3I0ToaDy4w7P69UA/3ZIM4hfI5DPPGO80wemyzUSTRDKz2flL90x9tgofzoECkcCUV7yadMqRBL9Ub5IUhvUFV92CPTC97SREAKr+Ch9FccQlwwdk0cHgG1Icyn2k6CmtW+3YC7p9pLMj1v792mazs7YjpPIdCXgoxVGP/7RuEpPPFQzXYeMWNstsA66b42RXE82jQjDMupux15mBLN0HMy/Vf3FHO6LFS9SVaicH13td1gxgtKSApkJfJROT2NsGqeffOkLLBIE8LyTEMaaqz2Nags= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3099; 31:Sti1c0/sGuqfwzjvV+9WfIub7w6iLm3K3TtjCjhNUXVJcgeNTwLmBvkukDckVPDOa0UUuwuyJbBTEK5V7UNX2YetiZ82gECIcXGLQ+XnalajWwwkzLMxVXCvEJzBB2o5Y1zaznuSLwm5jgR3TsElUXNSp0IuiEPxxOB2Up1y1xF/ZQmP11FLZW2HaZwpEk8lj2eZ7uIt4F1A7jF85OnO2tuDOgpB6myghNJ6sGxMRRE=; 20:uQ55KnzVodmLLrCktBg6zSukIpyPYxkO5kRVpTwrJE+p6LiT7bqlmQprrI45gHmjRjhoJnHDcb+7rptg4fwCeIBOdfqpt9B6s/f7436PY4FeBgWEMIzxPKhuRnF9wYxmWulJrzCELTAdT/QGmI28kONd4P4egQc7Zty3pBaVNWUBLYLkrZBThnO64JqVzatvKASFv1LngMjY4l8meCHaDUxqb+mUrQAD/KI4WwlAJkDdWIvwbZWqch5SgsWa0gkw/qKUme+wTbDJdka9UOPMBU21nI5FOHFPVsudKjAM7+GGD6e/njs+DfV0RsR+ZWLA7OTqg+IGQsErRlLloihtOSAlPqrxHC2Q+7vrAoU/C8CbN5i803YZp/h/tsita38h4FNhvJVcRltwyw1KWToPsv9RqHZu4yI0TTvfXKU+L4P1SDd3a+HEqrP5QqhLzazoGjkHCETm+H2I5+pPgOSIPWREzc+pWBKT74XRRq3nbnaLnyj9DXy5PLlDGItGKlbQNzNm/lmTKtVo9Mrx1AILvutIr9wU20W/aABEzdsRn2fYMQ2NwCQA/38QGpUC33MiX1hG5hhbBw9RE5RS54uVvZQ5qmv07F9SLr+k6wVtpNM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(3002001)(100000703101)(100105400095)(10201501046)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123558100)(20161123564025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3099; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3099; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3099; 4:t4d1keMYkPU3X3nC6vJ0cn3PsgBPw5H+ZkZnfDJb5/?= =?us-ascii?Q?XAY0vjL8DW9uoGl4hZ4bsCJn3O6j5Vj8Egs8kbRyXzXLXeiTdVX3kprZJ9a+?= =?us-ascii?Q?kDAAoQqW2MQRUd1dxBfLwKk3RFSUyP/3wU7iwgTGUcQiHU3MNmRFQ0OQ3Mal?= =?us-ascii?Q?fKP+jZ9PhJuXwIFRpu6MwOGsC3IbZiV8Ur5qkDC+5wTviWFLrZg5sm23iMCT?= =?us-ascii?Q?svsOkKy8mr6iF9sU9LeWiuFerHUOPwHpzsO6kpiGV9Ewseut64RJiHnMwHBX?= =?us-ascii?Q?dsod2gcpUy2T5O0J2hhg0DNxPBSumAV/5p5A1C38LSbHC3g9uTM84TFvK0/K?= =?us-ascii?Q?sCBMHsa1SPUkVmVgArWx/4H+G/ylZLEGfb//iJ9jU2YY/HNr298UH8Nz5lHh?= =?us-ascii?Q?9jBTekyA7K2pygvbKfKgf2eWq5j1lEhkVy7g173+k34YBs/OnN3EUVCTLrwp?= =?us-ascii?Q?aOu/9TmqKub4OtSx8mMrwwGCLKo8T80c3JREc2CHLBy5LScRsg/Iwi9jfMey?= =?us-ascii?Q?BhYDwJdOJwwacPU9LCs4+f+FG/YJ0nOxNFCO09i+aciFPievQrV9NIwqGobh?= =?us-ascii?Q?wFHerNcdgmkDzc0EMBhwRKsjqtF0sfHkfxobONGnZzozzePYGxEaCPlDQksz?= =?us-ascii?Q?w18xsBkvVVlzHxgCPrjAYw8B+cZRxLqAs0WFOCwiQt4K54h6P2u0HDKa241v?= =?us-ascii?Q?az9CMHKHQJ1lQTosN1yW6s5uvj/L4i130muz9rif17fAaOf+SBhKSoF1vXv+?= =?us-ascii?Q?V4z/LBTToHKmkXylSHTVa+NLJmPGWkl9CivKElnSb1HrEKupqYGVJUxqN06D?= =?us-ascii?Q?6lTC1gJIczK/VOiWBDD+/hsfTSLOAQwue8f2OmobFTVfzsDnkO/VsrGn35EG?= =?us-ascii?Q?Vv5oPUE7KkkfCUMSwMdoQo4hoVZ2YCYAbczR4HbDxtxa7cE4XfYa/KzKxh6R?= =?us-ascii?Q?+nhLqHgR17EaPm7vP9+8y4IVYg4b1BAeWyvAATPW/eRLWBY2aiJnDg4lqPny?= =?us-ascii?Q?YuCYHYH9qF3ghNSF9sZrBNmSf7Dn/f2TzAJlY8hJ8cNGh/p+sveDqtrX28L8?= =?us-ascii?Q?7nju/PZV1IwjnfiiVqq1RJg49+L+BJ5YgfIF/ABKK7AfSIDDy1g++Ely6PUn?= =?us-ascii?Q?gMVZzivEA=3D?= X-Forefront-PRVS: 0332AACBC3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(39450400003)(39850400002)(39410400002)(39400400002)(39840400002)(81166006)(8676002)(2950100002)(72206003)(6512007)(6666003)(42882006)(8656002)(5660300001)(110136004)(1076002)(38730400002)(53936002)(3846002)(7736002)(5009440100003)(25786009)(5003940100001)(305945005)(48376002)(50226002)(6506006)(478600001)(42186005)(36756003)(50986999)(6486002)(66066001)(76176999)(189998001)(33646002)(107886003)(47776003)(4326008)(2906002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3099; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3099; 23:WCQZLOin48fM/5GsT9S8MLRHDegWcyUPaINt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97/YboL8IvXuvmMgwKputYn1AbZ9p3KI8OJNyk9B4pKToDDASqYhfmzunCV6iHaal+KpeD0mMtp07AxVQrUKvmGsGxU18F6XG5gX+hUZv33TL9pb2wghn039nntyEtj+7RKXrBuoRPg7jEvO7KJPS9zba+3epy6j/ppFPt0RcHFHTwd+T4znwsoCWPOHBwvrRY5+thsUoEbuz7/DyGtS7duFPcCf9q0hnwfWaOfDL1GJ44xwGuc6yfAon/52AxXAjczSh7K42jH2nbJZJ7DMruWygV3EjYMytgPRKwwlm9VYNwV6dCXXpvLYE5u5x+H+2QBD4Mz69Q; 24:knMvYDR+CNPgYt9e3unq887NoNvNU8cS2PVSaWPQfEYd8nkfdfeQB/JGbUlOX2dLp6UGk6/8o6vDGn66CXaCi3qHPBE52WvUFltLbSduM/c= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3099; 7:dQ2YZw6wp8IXlA+QbufumjhDruemGTeXs8fHXtpiQB/ZN8Gme1VGrHO4D92TyPY1WPfs7FjpM3DAdc3UUtN6fIj10EvPu5ZTnHit8FkOnx4a+4LMR0Gb+yJl7JyM1a1s8MA1/9pYySW9yrua5VIK7akHzclAtrNyEcyyx5i8DoKQG+KEkueRJJLoz38SwxQx85BgVdgMEzRzCMpaaDFy9K+oNPvFuGYygsE/MKTD4QTw+mo0ZULcA2h77GJj0ZzXlIY8U1xwtZRilb2MpxjJI2A4Uik35cvzjLYo1kgC6OUOpIm3+9NuUqLVCptWqJHmNPYDcEdqnxsILdJM+8vneg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jun 2017 11:06:24.0010 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3099 Subject: [dpdk-dev] [PATCH 07/10] 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: Thu, 08 Jun 2017 11:06:28 -0000 Check iova mode and accordingly map iova to pa or va. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- 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 04914406f..348b7a7f4 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.11.0