From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0054.outbound.protection.outlook.com [104.47.36.54]) by dpdk.org (Postfix) with ESMTP id 5DB2547CD for ; Thu, 31 Aug 2017 05:27:28 +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=jUJ+Vl+DmZbHvR6lTq3POmHs6Mmz/RATceMrV//Ygag=; b=gHX9Z8ZUGSiHw273VOea8Oog4xN0IcMQiOuibT181TsHohvir6qD8XhxTNPtCd4fkxBnGQaMILMGzMzofHDLk+agZl33jVfhOs+APTlxMz7HZ8jSmsh1yCbVzh2qczdOV4QEwEf2GHhERUvLqnjPjuB0Aua+SRcmFFBxJlsr9tM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Thu, 31 Aug 2017 03:27:23 +0000 From: Santosh Shukla To: dev@dpdk.org Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, olivier.matz@6wind.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, aconole@redhat.com, Santosh Shukla Date: Thu, 31 Aug 2017 03:26:16 +0000 Message-Id: <20170831032618.7120-8-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170831032618.7120-1-santosh.shukla@caviumnetworks.com> References: <20170814161059.6684-1-santosh.shukla@caviumnetworks.com> <20170831032618.7120-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0118.INDPRD01.PROD.OUTLOOK.COM (10.174.144.34) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 743b5447-adc6-4933-8aa2-08d4f0203426 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:7B+IRbJGk1XTeteXY3jYWnxrlsZNgiGXdSM/Kx6uptk1mtGlijxwhnRRKcYfQLX97xx2pjVMkHQnGL/K6TaAoqeKayTfoegxtbeWMQOJcSHPNrjq0WCy4Kz+FL7/shdkit6DUw66cwWQuH+XQfijaRaFuNMfVz+oMi+r76AU6rZ6XeQ2iv+05izAHlweCjXtzQR6ZHxrsOdhJxncIr1LH6NCcRMkeH6ZzGHLkzosCFUW8vo6Ok/exQXDpn5N2BTa; 25:7OLdtJffu6Rk3ulDTjYVLn9yiD4huwLcYNaxeVs8JGdnXb2+gEsxJWfF91/elvYbrh/XK8sso6wVHS5nmp7QQSziRxlYb/julCBYCfLndl05mvvCWDOI4JD7OJ42xD5ENRDWTUYfRVoLAJJ84W8i3Dqt10HY6Rc9F2QyO0NmbgOZtuC6ifTqMRsl74wGyUrRBqsQ8VRub7U7gH3MpsqulCNRHQhp/ani9XyK+pGfMYyxk3w/Fv/Xi0JUXx7apl85U2IMdnyIfkFB/5GdWBcCv6pK8w1OH6rIlYYbEGzdORy04HksEKiZ9/2iRyHITQRVvYPEosK7LQGqoj7mPJCsiA==; 31:C0f6LFvTdMtEbM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AQ4g/6y3SApbbxjFe/lQHk231S6tjDfflfzA/Rit/LFqag1A3XaNdIRa5+KozeTUGPkXr4bPfMOqqMQbkijZ5kkhwDZPRHvtXoNHsoJ44Fww 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)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(199003)(189002)(81156014)(8936002)(81166006)(8676002)(7736002)(6666003)(5003940100001)(305945005)(2950100002)(7416002)(2906002)(6916009)(42882006)(76176999)(50986999)(101416001)(50226002)(5660300001)(6486002)(6506006)(48376002)(50466002)(72206003)(36756003)(97736004)(478600001)(189998001)(42186005)(2361001)(2351001)(33646002)(106356001)(105586002)(110136004)(107886003)(5009440100003)(8656003)(6512007)(53936002)(4326008)(68736007)(1076002)(6116002)(3846002)(66066001)(47776003)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN6PR07MB3089; 23:B9N8aNGk5o01miLfUpPSZCSIwNsZUK2ZSOzfCrJMi?= =?us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TWuFI+8k0jH6AQuoCdONxKvQ4DxqrFlJ687kelPn0V/OlHrMahX6pXZz8cGwkEFvNMkLhsijBmxNYbspUcPVbS/pQuGSPSkhZMoUwFadCg7PJYJDInNSejL5HYl8sr0BnyRT1eyeJebDFw+vS4NEHiEUljBLxncOnJ4HSSp0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 03:27:23.3902 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v7 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: Thu, 31 Aug 2017 03:27:28 -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.13.0