Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp507997ybv; Wed, 5 Feb 2020 09:20:40 -0800 (PST) X-Google-Smtp-Source: APXvYqxRgedIolZz+rJlS1Bu6xqMAFKTaxJO42i7KfdIZnBI9rns8PtWyxGFTQHFU67nwu5bj5im X-Received: by 2002:aca:3805:: with SMTP id f5mr3793972oia.6.1580923240411; Wed, 05 Feb 2020 09:20:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580923240; cv=none; d=google.com; s=arc-20160816; b=Vh2OAk6IPhdqtZ4pOof9I2kP77h9lCGZv1Yp9ebU7OUOL/3N0sYxT/s7NvYIm8nxiJ /gZyT9HUmXn0ckRQUZRPJ3UiW8X+PxDB74wsyIiHEj3NGf7SoEcsTyymZAyhPgBWSu62 fjwbnuQe2LUCBaxm8/Qm2KIWmOBBA+qduqpkhiPVDopa6WPSjZ/Bb5xlOJNe5fJ334UQ sYRDihg4BKk2iw6kbgzbNVt6HVtbzySVHukK0Pc+J6ik23xSk7UVvwV7RMNskIMjVjg/ ietAZn+EL3eLJxZvpfTuGpvRQYQr6U0hdRVP2RMRkac3GDTuwtUaCWCzOj2Pb2JPHdqG XV9g== 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=5Epmkols/Jcpk4BOtB6xrYTMWDhv57jhe/5P27cPTsM=; b=RAcbJNRqxUx/6aY2+CeQxiGWjCQPDxu+6RUbvsgenzJ6FFebaXgXAIxtlh7Z5XwdRG 7d9YB40D4LqNDB8KD1jXbKr7pQyycXMahhowzIykNJvjO7gCFdwmx8pdJYRCRnImQ/fI cNchy+RP01rB5HNcugtgP5nm73UR4P6lhPx+fjyOHH7xgs0Zmhmg0630mHyGT54SM4Ul zLh4gCU1JRxn9wPURf+wxnk2lSMcZvSgjQOQsFEBISAspIzUVtAs70hsyDADyX1VoTvw eewdHq59sRABhJ4bWU8JsyawsNNr3sToGllAAxwtWrCg/avN0MIERDbLQUBXeBigLyMl b9Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=JoRJst93; 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 s11si440888oic.57.2020.02.05.09.20.27; Wed, 05 Feb 2020 09:20:40 -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=JoRJst93; 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 S1727521AbgBERRu (ORCPT + 99 others); Wed, 5 Feb 2020 12:17:50 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40196 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726748AbgBERRs (ORCPT ); Wed, 5 Feb 2020 12:17:48 -0500 Received: by mail-pg1-f195.google.com with SMTP id z7so1268699pgk.7 for ; Wed, 05 Feb 2020 09:17:47 -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=5Epmkols/Jcpk4BOtB6xrYTMWDhv57jhe/5P27cPTsM=; b=JoRJst93U9bCZZNxTFkotrbqwe9DANT/aWnQ3KQKK48a4/aTEAOk2JtA2PmYsMkjB+ iRMfR/50HPQjQA5q/jBlq9+xFgLDJtWXWxbfTNo6cTK/arVA+rhTwMVC7y4n2Ga44rfz R3pbxUZNXouDw3CeOZGQTL8UjVLUWMtmm4i4F+a2thsaACE+RVjbT9VSFv6PajGgfIi0 Z6zIZ4mqYmk50XZr3vNUYUPRQXXZ7areM3Lr32YudlJx0mOwiLIX1AjSu6fZRQrNPQq0 lxaE0lNku48jmfLyck2tI2N9LC/phWqf/D2XxPndkVWcnCfPp9PfkfRybvKQGeY/UxWK k23A== 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=5Epmkols/Jcpk4BOtB6xrYTMWDhv57jhe/5P27cPTsM=; b=Yjp/HIlzJU876GE4gatOysnup3BN7pH/4N53JdRKAfmFEdrssoSrTEEiWWN6sh95NQ WH/kxvBLfLkIBP5Z8RWHQnHlCiQYeCc/F7GMRtT0gsh23pfcUZyP2zYjnTSurEuUwcxc wnql7kDkVd0AoIRpA5gj72E5UVQfH7AaF2aM3D5hZUTZAorxswY97fJqKP0YQgzp6rfE WWX6+54i1JGabvjrxmY9dCPZVBbEGBe9PBIq3pJoCD5RNxHhtQegpwvcMSv5QsrpMuNM f/SRTYQBIoC2St7qzlYYD8D9ZKJ9YI0evqSaoBOYEUm0y5lpeOG9sNUXObYzxl4SWEwq gRlA== X-Gm-Message-State: APjAAAWUh18I9cU7b5d4ddCOIuOEp/3FWf2Jw3hm2os37gB5ZrNhkofI Eu6OND9hxFWPu1So6XbPRSw= X-Received: by 2002:a63:60a:: with SMTP id 10mr1707960pgg.302.1580923066845; Wed, 05 Feb 2020 09:17:46 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 09:17:46 -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 3/4] ntb_perf: pass correct struct device to dma_alloc_coherent Date: Wed, 5 Feb 2020 22:46:57 +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_perf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/ntb/test/ntb_perf.c b/drivers/ntb/test/ntb_perf.c index 5116655f0211..65501f24b742 100644 --- a/drivers/ntb/test/ntb_perf.c +++ b/drivers/ntb/test/ntb_perf.c @@ -558,7 +558,7 @@ static void perf_free_inbuf(struct perf_peer *peer) return; (void)ntb_mw_clear_trans(peer->perf->ntb, peer->pidx, peer->gidx); - dma_free_coherent(&peer->perf->ntb->dev, peer->inbuf_size, + dma_free_coherent(&peer->perf->ntb->pdev->dev, peer->inbuf_size, peer->inbuf, peer->inbuf_xlat); peer->inbuf = NULL; } @@ -587,8 +587,9 @@ static int perf_setup_inbuf(struct perf_peer *peer) perf_free_inbuf(peer); - peer->inbuf = dma_alloc_coherent(&perf->ntb->dev, peer->inbuf_size, - &peer->inbuf_xlat, GFP_KERNEL); + peer->inbuf = dma_alloc_coherent(&perf->ntb->pdev->dev, + peer->inbuf_size, &peer->inbuf_xlat, + GFP_KERNEL); if (!peer->inbuf) { dev_err(&perf->ntb->dev, "Failed to alloc inbuf of %pa\n", &peer->inbuf_size); -- 2.17.1