Received: by 10.223.176.46 with SMTP id f43csp3888148wra; Tue, 23 Jan 2018 00:24:50 -0800 (PST) X-Google-Smtp-Source: AH8x227XRJrSG0rdXUW3FCy/JbZiyo3yq1EeqOQAH/moi/1RHBqDWtZJg1E3NHhkNNFbm3vWyMQ7 X-Received: by 10.101.71.202 with SMTP id f10mr8575033pgs.208.1516695890707; Tue, 23 Jan 2018 00:24:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516695890; cv=none; d=google.com; s=arc-20160816; b=G921FGMcEyp6HWGFp0danpv6GQthFiea0ADGQhkpUFjdYhvUQBrWlcNiyUZDBDt7fj xTJUWfu0+NQK3v4+QcmGdUSmsXXo6U0HHBW41cXf7G/a9g/Moh0CdlR7TtYu3L5StAvC 1xCCQOjjN/qUgZAKjH0gbWwMxEH9z1p8nq1jj37+STOmR+6g5HghN3YfjBhvJ3Cv4DBL KBdxrbY+jUBYxaLeuE4IweWeTafVpcBZZd2HQ/uxaBSG7le65e3NmEMezlbE6cn5rpMR yfvwr1YwWRJ/Ij4a8D6zbPCB18M40mPR1QdpIo0Q4qj246ViNdmUs9aCo1pcmc1PM7hm zDYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=26xJWdQj128g5xkM6ssPsmFHtFF60Pyn4aqq5VpOi8s=; b=dFCPzdOvzsWUqqZsahSKzwDT9y0VN/zVBkYFtxWWop83u5M1T8Fg5qHMRlfnZ5iauw C205Y7nrVIpaBmkL7jsTz3Eu78qjzayKPDG3+UD4yaeGXVnt7EpWtJdYuSy5Eiqmu6Xq dxx0bZpnm6P8Nzd2h9At2fbtvot1WM79TkiA/tgWPNvTh32zJUVpHSWFl1P5VsuXRzSP oDVT3SdxVqCWjCrkuJcbEQEdwwE22h6Wwn/MFvAvmtSPxMqXWjFrmFcc8gGez+PLmUqf 6TD1z6kkxEwG7nKEQiw9vpJnIgFm/2Zt7fgkU5J8URLFXf6sw2edK+NWCSVwP5HrEwsJ EGMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q1yKzNUk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8-v6si4357783plt.399.2018.01.23.00.24.36; Tue, 23 Jan 2018 00:24:50 -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=pass header.i=@gmail.com header.s=20161025 header.b=Q1yKzNUk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751178AbeAWIYM (ORCPT + 99 others); Tue, 23 Jan 2018 03:24:12 -0500 Received: from mail-vk0-f68.google.com ([209.85.213.68]:35271 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750907AbeAWIYJ (ORCPT ); Tue, 23 Jan 2018 03:24:09 -0500 Received: by mail-vk0-f68.google.com with SMTP id n132so6612512vke.2; Tue, 23 Jan 2018 00:24:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=26xJWdQj128g5xkM6ssPsmFHtFF60Pyn4aqq5VpOi8s=; b=Q1yKzNUkOHMQT3PapoAcVfXf27VXJgoZJkpvnPNqIvFe9bb2a/pos4cGPA31ikuKY1 FtrvAtSybjXqfgtJxhzoXc7w/gzzA+/kB6EgxEpPrkwl4LCKnD8sCcUtahl4NIc969Dy WDrNSLIK3nZzsGS7oSBKelB71vk29DXc76BmBn7kT1IdWbuHoESm8vsXjeTKuEoXBO40 bhnoRVDdPkdJlWTrG2no8P9ZN4E0E4euIETVmNQWZkVWxuthvBV4iBLCHGAvJhW8fNxz rkcPRQDUmleZfskU2U5yEfTsft6WqpwM5Z57KCTx6JVi549JJ9twAMYufKTdINuwFezj xPIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=26xJWdQj128g5xkM6ssPsmFHtFF60Pyn4aqq5VpOi8s=; b=Nsup8wLT4b0wd49ryglUYO2Bl/V7dbOOj1vanufPjOAgwc+aR7SSDsW51K4we3DRzy iS5F9wkhI1CtXj6SQxZFKuGtqnAic6yN2Vnj04PRYn1eFXlpBIhF0c0P0vEVYtip14j8 g0r8hMITAZ323H/Q4Sdf1zgG59dhqNnEw2eA0/bOIaQZ5FhKiyZ2bCnEA+A0+Aszy5vA UXdXJNjtkAXAKS2M4bfLgCsDiOv/7uCyEHEcVGhq2yULKh5WBt+oaIgQiX30cnjx3X74 OSTT+b6+QdZwRKf5URfnrguBryfd43/AQQNtXgY/H3ndIWjK5hla2r0O41HXM/oiPaES dQcw== X-Gm-Message-State: AKwxytcK8vM/b3DBgthgAMOuk/tbUYZAw5H2CCCOh3+D9NgoXOM9ijLD lp8dh4UYfLt06sN46l8dgGLBPnL6hyK6zTlwkw8= X-Received: by 10.31.148.81 with SMTP id w78mr1215464vkd.130.1516695848231; Tue, 23 Jan 2018 00:24:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.42.194 with HTTP; Tue, 23 Jan 2018 00:23:27 -0800 (PST) In-Reply-To: References: From: Greentime Hu Date: Tue, 23 Jan 2018 16:23:27 +0800 Message-ID: Subject: Re: [PATCH v6 16/36] nds32: DMA mapping API To: Arnd Bergmann Cc: Greentime , Linux Kernel Mailing List , linux-arch , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Networking , Vincent Chen , DTML , Al Viro , David Howells , Will Deacon , Daniel Lezcano , linux-serial@vger.kernel.org, Geert Uytterhoeven , Linus Walleij , Mark Rutland , Greg KH , Guo Ren , Randy Dunlap , David Miller , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Vincent Chen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Arnd: 2018-01-18 18:26 GMT+08:00 Arnd Bergmann : > On Mon, Jan 15, 2018 at 6:53 AM, Greentime Hu wrote: >> From: Greentime Hu >> >> This patch adds support for the DMA mapping API. It uses dma_map_ops for >> flexibility. >> >> Signed-off-by: Vincent Chen >> Signed-off-by: Greentime Hu > > I'm still unhappy about the way the cache flushes are done here as discussed > before. It's not a show-stopped, but no Ack from me. How about this implementation? static void nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { switch (direction) { case DMA_TO_DEVICE: /* writeback only */ break; case DMA_FROM_DEVICE: /* invalidate only */ case DMA_BIDIRECTIONAL: /* writeback and invalidate */ cpu_dma_inval_range(start, end); break; default: BUG(); } } static void nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { switch (direction) { case DMA_FROM_DEVICE: /* invalidate only */ break; case DMA_TO_DEVICE: /* writeback only */ case DMA_BIDIRECTIONAL: /* writeback and invalidate */ cpu_dma_wb_range(start, end); break; default: BUG(); } }