Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp775678imm; Fri, 15 Jun 2018 06:09:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIzhcJcAkKPo6E73r2kdqVU2DTGPMuXNcb0Qs22JGv5hD4aMZ8ifHuc+cj8PFDTpV0QqoEh X-Received: by 2002:a63:924f:: with SMTP id s15-v6mr1536626pgn.368.1529068174095; Fri, 15 Jun 2018 06:09:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529068174; cv=none; d=google.com; s=arc-20160816; b=kjNqF8qmmZO+CJLg8I3jn9Vii9uu/cZQfcFDK/HdyqlfKDoBgGWN5YWrFvKEE2kGAg RKSt4tbWCYormJCvUAuCpc9D7aOD577bladv79+fitQhLQp4in8g8kjDY9yCfGQEcMDn TW0XFV+h5ttDQwD8e67BkkLhSHVga4BRmRTOKIU5TqMCy3ITwKtdM5dog4aEqlVRY+46 0b1jBY7LSv2sAblFs+6S9PIcnqtxrFoIn5ZIGtY81Lm0bvAF20QjJBZEvl1qd7Qj2gqS UjI02UgGEUKj8i+x57ZIxpjx4ZC8Lu7SdKAAk5EaXV+a8Hzdi2XKIxinlK4VDQRVj9UA QF0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=/ypzzm0uv6pXyPFrk5D2apH0doB2YYVotIpa/cTzMPo=; b=MVmICBkv/Bywpr1DnFUtoWK4CsB46RRdB+qkNyad1C3j9C/PN6twci+odISj3+CG2B PMIWgQtOgYDfCYtAZv8vF3pxPlIIqYKd8JX5QB7zcfjYnUw+vw/hRgFnvJ2KLRTp26zl Ea+nwL+sqWECR3BHIKk+Tu2RsKt0nQRdkG4AitYaywuN7ZlvtaD74XozpR48rweO+P5V qtNEi0O2XtilMFwKzMA35QzGOHNEvPaq9aNiwxvSv2UDUONkpNEcvVYC/vqKpAItKWG1 AOWI/NTA5U9leMtJHguV3H5NU+236l6zrEGnRKbTzlBw3ApW4+c5X7cmGrkXuAwupbjP Oyfg== ARC-Authentication-Results: i=1; mx.google.com; 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 b18-v6si6037543pgs.417.2018.06.15.06.09.19; Fri, 15 Jun 2018 06:09:34 -0700 (PDT) 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; 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 S936212AbeFONIn (ORCPT + 99 others); Fri, 15 Jun 2018 09:08:43 -0400 Received: from verein.lst.de ([213.95.11.211]:51131 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933771AbeFONIm (ORCPT ); Fri, 15 Jun 2018 09:08:42 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id DBF9A68E44; Fri, 15 Jun 2018 15:17:10 +0200 (CEST) Date: Fri, 15 Jun 2018 15:17:10 +0200 From: Christoph Hellwig To: Eugeniy Paltsev Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Vineet Gupta , Alexey Brodkin , hch@lst.de Subject: Re: [RFC] ARC: allow to use IOC and non-IOC DMA devices simultaneously Message-ID: <20180615131710.GA30776@lst.de> References: <20180615125819.527-1-Eugeniy.Paltsev@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180615125819.527-1-Eugeniy.Paltsev@synopsys.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +#ifndef ASM_ARC_DMA_MAPPING_H > +#define ASM_ARC_DMA_MAPPING_H > + > +#define arch_setup_dma_ops arch_setup_dma_ops > + > +#include > + > +void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, > + const struct iommu_ops *iommu, bool coherent); Can you keep the #define for arch_setup_dma_ops right next to the prototype? > index 000000000000..9d0d310bbf5a > --- /dev/null > +++ b/arch/arc/mm/dma-mapping.c > @@ -0,0 +1,20 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// (C) 2018 Synopsys, Inc. (www.synopsys.com) > + > +#include > + > +void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, > + const struct iommu_ops *iommu, bool coherent) > +{ > + const struct dma_map_ops *dma_ops = &dma_noncoherent_ops; > + > + /* > + * IOC hardware snoops all DMA traffic keeping the caches consistent > + * with memory - eliding need for any explicit cache maintenance of > + * DMA buffers - so we can use dma_direct cache ops. > + */ > + if (is_isa_arcv2() && ioc_enable && coherent) > + dma_ops = &dma_direct_ops; > + > + set_dma_ops(dev, dma_ops); > +} Why not just write the routines as: void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, const struct iommu_ops *iommu, bool coherent) { if (is_isa_arcv2() && ioc_enable && coherent) set_dma_ops(dev, &dma_direct_ops); else set_dma_ops(dev, &dma_noncoherent_ops); } Also a new file just for this routine seems a little wasteful. Can't you just squeeze it into setup.c or some other file?