From patchwork Tue May 22 12:04:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 918293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KQR4B/gU"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40qwZj4DH2z9s7X for ; Tue, 22 May 2018 22:54:21 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=cIXO3GDLYnrBjwhQbtG2M26Gfy2Gx21ckQfOHz3QBXk=; b=KQR4B/gUtuy3t7Mpo6cCXKP1Nr p/UVctjGAng4wkd63Bmgkf+0FIPBmeNjpwuN6eWa6oL/YkJlyyq6CdDjs8EiojlvVu+5Xsc48H7M6 nkV4/0QpdMsxGql4fOsMTj1yEC2c4s59HBI0cNT5r4UPM4e+AFPg1ANew1Rg/wMTrLyT0TKDy8e6D ot3/dQp6SM3+eV+gO/tHhfy3SGbRwjfraOdeA6GzfqL4RIQK8+t2MQXrzOyiE5Tc6xzP/nL2p/9FR pN6yDqEapjYDWRIoqK4JAYGXU9geZeCoDEBDaSq+nyRU9jhSeEmswD5BMxOLp0FmSf8FEqUUW/aun 8dtAfp3g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fL6nz-0002fq-Dn; Tue, 22 May 2018 12:54:19 +0000 Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fL62K-0008Dk-9X; Tue, 22 May 2018 12:05:05 +0000 From: Christoph Hellwig To: iommu@lists.linux-foundation.org Subject: [PATCH 09/25] nds32: implement the unmap_sg DMA operation Date: Tue, 22 May 2018 14:04:14 +0200 Message-Id: <20180522120430.28709-10-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522120430.28709-1-hch@lst.de> References: <20180522120430.28709-1-hch@lst.de> X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-xtensa@linux-xtensa.org, Michal Simek , Vincent Chen , linux-c6x-dev@linux-c6x.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Greentime Hu , linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, nios2-dev@lists.rocketboards.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org This matches the implementation of the more commonly used unmap_single routines and the sync_sg_for_cpu method which should provide equivalent cache maintainance. Signed-off-by: Christoph Hellwig --- arch/nds32/kernel/dma.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c index 4e6fb4ffd3f7..43d7fd432bb6 100644 --- a/arch/nds32/kernel/dma.c +++ b/arch/nds32/kernel/dma.c @@ -426,6 +426,12 @@ static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, enum dma_data_direction dir, unsigned long attrs) { + int i; + + for (i = 0; i < nhwentries; i++, sg++) { + nds32_dma_sync_single_for_cpu(dev, sg_dma_address(sg), + sg->length, dir); + } } struct dma_map_ops nds32_dma_ops = {