Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp506774ybv; Wed, 5 Feb 2020 09:19:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyk+K7+wK2+uVj4Fwijgi+xY0z/q2gk94t3xiCaaiwAMVwcJSfvtMd2uUWD0P5f3sURg8ct X-Received: by 2002:aca:f1d4:: with SMTP id p203mr3705796oih.116.1580923164595; Wed, 05 Feb 2020 09:19:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580923164; cv=none; d=google.com; s=arc-20160816; b=sWE667xvHERS/N84I6FgmymrLWDT7l2EvIck28Xl9iTYuLIe6ilrB2xC09/YPoVbok sVbSkJlg7IG+t77kzonCNwK+jUzyrmRJK0GFQH6ezNsRfuplLLbskNtH6Je3KpTF5xHR DeZp882N8TvyCYcj8XgTWxrqglPneBSyRid9AyNwN422ZAU3KSmi8w802G6rEkOQFVUa YbnAOl6ge9eakER8FYYSzRhC0R61jaxF0IOMp9cJ3G1iAu0KDwv5w+NhWTa2EvyLOzPt fryNJJIN/YI5D9sfAoBzAtzTq11hwRoQ3We6YM2ck9D4Co9mzmOm4Kk1KL+Ir0J4QHIW byyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=mUDsIDZABMZl51KhHVbThQf4Tq5Xiy3roaR+2Uewz3I=; b=Grm5Q0NkMv1mP2oS76e7Om7ML99CcyYDEH3hMrQRV3QLHkzPySl4pTPNAD+IJLov7d UVcBliavcC11XN0h4XrIfBzha6Yls+cLGQk7UkO+/3bmNwPchZl+qu6oPBXuDCUuvfc8 q2+mcasdDpUXIM4TJLfvUkM8MlfQvUk+DPjMf7xrWlUjUP2LpmRiQ4XsRAdaVg2JxPpO ou6zy0cgrSejyVFqA1PUF8Oz95eNvtZaKDXs8gALBWIoP3akoksRW4Z8XVUQFQYit8lQ jDXDsjJ1o4GEi+ZXYviVnwIJ7johzM/bb7fUFcnw6RwalW8C4+muxA1gha+UIy2pyAGB M+cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=T5Ri62NQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x84si429182oia.27.2020.02.05.09.19.12; Wed, 05 Feb 2020 09:19:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=T5Ri62NQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727446AbgBERRw (ORCPT + 99 others); Wed, 5 Feb 2020 12:17:52 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36976 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727516AbgBERRu (ORCPT ); Wed, 5 Feb 2020 12:17:50 -0500 Received: by mail-pl1-f194.google.com with SMTP id c23so1140456plz.4 for ; Wed, 05 Feb 2020 09:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=mUDsIDZABMZl51KhHVbThQf4Tq5Xiy3roaR+2Uewz3I=; b=T5Ri62NQ5TecG+H5Jkz3y/VrFKfdJk2hpW/44xQT4xfATYX7LgH825B+6EtpITWTBN oyasJgxuEGESnxck6nQSSFid9SW/150iHcHfGpFsB36AXkMbISfiS1bDQHBpPXv0JT9m xH944oVe2g7+4JGgSFu+AjCYq9KFiQWYzKZYTbQAoywFd8qHeAZ9CgMyloF8xIRELRLQ KFcz8JWHPlksC7SxfPTh+Wir8XqzEOx5dk5yQI+HgX/s4ifjGXGIkeis5/rZULtdZB2S C7Vuq7ixhvBCNTo+OkyqD5lQhWcR6TvE0uJaAjtjx9xSck5t5WjATT4mwSbqDwJmDUHs GKug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=mUDsIDZABMZl51KhHVbThQf4Tq5Xiy3roaR+2Uewz3I=; b=OTq+Yga7/GQpxkTG3vM/zOb/aBXeaQSEomPvzjyPQxT97ABPWVSI0mzHaMv83l/HiH dkqdfBCDaf3CsAQ0twlWqwj4db2895mi5p5LQwezFAtFvjQc6nJsLGA4GqFk9uCOfpYi cNrQY05ElygleTL5vz5mLyxE7MKbL/xF0PquwxEqJdXlk1EALMKl/+2MQ/rxw8RaI2+w ae/B7KCC9raNYbU98FXXT81T0glrBVJJrAgXDEAMAwoxO9ertk2cE6H1bTQrXh6/ll+J ZsOB0Eh6JGskJUno2t6K7rF4we5Ooy0yYLj561/t7kXhEn35mNu6/+7+ASYCISeFVr+R +7hA== X-Gm-Message-State: APjAAAVWC2tGgoVdUaEHR3OH5cKyHXyyhz7WlNlK/61nGQZv0avaOySC sFIuv+V30B8RdQhXL1vNPyo= X-Received: by 2002:a17:90a:d081:: with SMTP id k1mr6863551pju.57.1580923069539; Wed, 05 Feb 2020 09:17:49 -0800 (PST) Received: from emb-wallaby.amd.com ([165.204.156.251]) by smtp.gmail.com with ESMTPSA id l8sm357945pjy.24.2020.02.05.09.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 09:17:49 -0800 (PST) From: Arindam Nath To: Jon Mason , Dave Jiang , Allen Hubbe , Sanjay R Mehta Cc: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, Arindam Nath Subject: [PATCH 4/4] ntb_tool: pass correct struct device to dma_alloc_coherent Date: Wed, 5 Feb 2020 22:46:58 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sanjay R Mehta Currently, ntb->dev is passed to dma_alloc_coherent and dma_free_coherent calls. The returned dma_addr_t is the CPU physical address. This works fine as long as IOMMU is disabled. But when IOMMU is enabled, we need to make sure that IOVA is returned for dma_addr_t. So the correct way to achieve this is by changing the first parameter of dma_alloc_coherent() as ntb->pdev->dev instead. Fixes: 5648e56 ("NTB: ntb_perf: Add full multi-port NTB API support") Signed-off-by: Sanjay R Mehta Signed-off-by: Arindam Nath --- drivers/ntb/test/ntb_tool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c index d592c0ffbd19..025747c1568e 100644 --- a/drivers/ntb/test/ntb_tool.c +++ b/drivers/ntb/test/ntb_tool.c @@ -590,7 +590,7 @@ static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, inmw->size = min_t(resource_size_t, req_size, size); inmw->size = round_up(inmw->size, addr_align); inmw->size = round_up(inmw->size, size_align); - inmw->mm_base = dma_alloc_coherent(&tc->ntb->dev, inmw->size, + inmw->mm_base = dma_alloc_coherent(&tc->ntb->pdev->dev, inmw->size, &inmw->dma_base, GFP_KERNEL); if (!inmw->mm_base) return -ENOMEM; @@ -612,7 +612,7 @@ static int tool_setup_mw(struct tool_ctx *tc, int pidx, int widx, return 0; err_free_dma: - dma_free_coherent(&tc->ntb->dev, inmw->size, inmw->mm_base, + dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, inmw->mm_base, inmw->dma_base); inmw->mm_base = NULL; inmw->dma_base = 0; @@ -629,7 +629,7 @@ static void tool_free_mw(struct tool_ctx *tc, int pidx, int widx) if (inmw->mm_base != NULL) { ntb_mw_clear_trans(tc->ntb, pidx, widx); - dma_free_coherent(&tc->ntb->dev, inmw->size, + dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, inmw->mm_base, inmw->dma_base); } -- 2.17.1