From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0043.outbound.protection.outlook.com [104.47.41.43]) by dpdk.org (Postfix) with ESMTP id 3863A7D7E for ; Mon, 14 Aug 2017 18:13:09 +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=RWhBL1OPCW3nlepuVmdYjjVpezN08cvBSrKaJPu0XY4=; b=hn+i99h3PKLKGKiEQib18V4PQwJTr8us2d6q8FRQ3qWn0Z5GX9Nmg9xHRQIEAC2iPM1cyEoGCL8WsU4kOKtzTT5x5MmeK/6kw9tofu4hWpnDH26QdSlx8CnrDGZ2Xkn+CBPo0A/G335FlabS8GeJDPdURpUR1SjAdN+MNSonDBs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by CY4PR07MB3093.namprd07.prod.outlook.com (10.172.115.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.21; Mon, 14 Aug 2017 16:13:03 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: olivier.matz@6wind.com, thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, maxime.coquelin@redhat.com, sergio.gonzalez.monroy@intel.com, bruce.richardson@intel.com, shreyansh.jain@nxp.com, gaetan.rivet@6wind.com, anatoly.burakov@intel.com, stephen@networkplumber.org, Santosh Shukla Date: Mon, 14 Aug 2017 21:40:57 +0530 Message-Id: <20170814161059.6684-11-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170814161059.6684-1-santosh.shukla@caviumnetworks.com> References: <20170724084004.25542-1-santosh.shukla@caviumnetworks.com> <20170814161059.6684-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: PN1PR01CA0087.INDPRD01.PROD.OUTLOOK.COM (10.174.144.155) To CY4PR07MB3093.namprd07.prod.outlook.com (10.172.115.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d3b3293-8ba5-405e-4f82-08d4e32f5a1e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:CY4PR07MB3093; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3093; 3:tqThE1NmKfO9W5xg5fY6rN0/VMqxwc8gpXqzXMY5sw+ZI1xphHvTy126o+aNnph8hoOI+dMoAqMFo7nH6X+s5N9XrCd62e0oIbdCI7g+aBBwj5S59jbX0wSyUCczYY8onf839uFZDWPol0BzGAixzvUDHEMe+fb4k6u9Ajvx2UzzvhtQAEOA7P1VSZjVL8JanKYwsSPLb/Z/Jbu49BDG3xzgd35xya/ODywl2KSvHwNe4+wLCIxDunBUWolHhWEp; 25:UEuZgvra5oYDCGXNbAYYnTojcDUAKGTcxpaKt0UYeD8c9SRcgv34XO+7HEGDARQBcZ7MYLebM1HW1aRWku8M76qRWx8jwRZgv/YSHFw7zwqAyBQB8QFEVeiIjbW035+A8kr29akHp/n0gptg8wFzYlCWk6W4QPxurN76aH8PiW4NVNVU6gdjyNl4u8XYc7tCRS/3NpO/knCyjIzTZ0ZP3Fd2hVJr9Mjvfgr3WX9EBevf/qQ2+6RH8oe0FRSnVhNhtNbNeUct+bjQ6q+NpUsWqM0SZLuRjAd9Fz2f9sYkkD1J+ipexnfLYprSJMyoC6cPkeW/UNlyGudW0fi/CDvmWA==; 31:nINkPU7Hbr+6uvZPSZrSbi2xRn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tmD15BO2+cXSAvbrzHnKB4quQH9gfWvJDk0cXMZmUhff+xyNUEU2SlVrefxjmQkhSu8gOfgo5x6N/F/fKT X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123562025)(20161123560025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR07MB3093; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR07MB3093; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6069001)(6009001)(189002)(199003)(76176999)(101416001)(1076002)(50986999)(8656003)(6116002)(66066001)(72206003)(7350300001)(5009440100003)(3846002)(107886003)(47776003)(110136004)(2361001)(8676002)(42186005)(6486002)(50466002)(48376002)(105586002)(106356001)(189998001)(4326008)(6506006)(5660300001)(2351001)(25786009)(6512007)(81156014)(478600001)(36756003)(33646002)(7416002)(5003940100001)(7736002)(305945005)(68736007)(97736004)(6666003)(50226002)(6916009)(42882006)(2906002)(2950100002)(81166006)(53936002)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3093; 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; CY4PR07MB3093; 23:Wevv4HRV8glsgKjguWBdHwUjYu/tFb75TMoKGQyCJ?= =?us-ascii?Q?I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Zx19fJlLDieS5rtZzm7/wjefcZKJs+RztXhcVLuepi0HaN4dxMBc=; 7:sxlnfbsijCV7E+DNK2gYtlw5CNCVNZwbbUhA4mIhZomhtjB29I+HPDpQRKaDcF5A+Ri5lo4+rUEPTnlGA4UdsqKGeM6ION/4w3ERJxszMRQORLatbiDja15pxXUzpBgOK8UrsYHC6Gs9jXUnxr2T81/5DT64mMBbQUUwKLIJNpl1yMqTp1LZYDHJ0g52jiroNX4leqNCtw/i1cZvDqpvf6CND+cnixILupNjBOCUlUE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 16:13:03.2395 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3093 Subject: [dpdk-dev] [PATCH v6 10/12] 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: Mon, 14 Aug 2017 16:13:09 -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 --- 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.11.0