From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41m8gY0RsKzDqkP for ; Thu, 9 Aug 2018 10:45:44 +1000 (AEST) Message-ID: <65b4dfcc38a7ace49f3bcac95cf9e2d3ef544650.camel@kernel.crashing.org> Subject: Re: [PATCH 13/20] powerpc/dma: remove get_dma_offset From: Benjamin Herrenschmidt To: Christoph Hellwig , Paul Mackerras , Michael Ellerman , Tony Luck , Fenghua Yu Cc: Konrad Rzeszutek Wilk , Robin Murphy , linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-ia64@vger.kernel.org Date: Thu, 09 Aug 2018 10:45:22 +1000 In-Reply-To: <20180730163824.10064-14-hch@lst.de> References: <20180730163824.10064-1-hch@lst.de> <20180730163824.10064-14-hch@lst.de> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Mon, 2018-07-30 at 18:38 +0200, Christoph Hellwig wrote: > Just fold the calculation into __phys_to_dma/__dma_to_phys as those are > the only places that should know about it. > > Signed-off-by: Christoph Hellwig Acked-by: Benjamin Herrenschmidt > --- > arch/powerpc/include/asm/dma-direct.h | 8 ++++++-- > arch/powerpc/include/asm/dma-mapping.h | 16 ---------------- > 2 files changed, 6 insertions(+), 18 deletions(-) > > diff --git a/arch/powerpc/include/asm/dma-direct.h b/arch/powerpc/include/asm/dma-direct.h > index 7702875aabb7..0fba19445ae8 100644 > --- a/arch/powerpc/include/asm/dma-direct.h > +++ b/arch/powerpc/include/asm/dma-direct.h > @@ -19,11 +19,15 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) > > static inline dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr) > { > - return paddr + get_dma_offset(dev); > + if (!dev) > + return paddr + PCI_DRAM_OFFSET; > + return paddr + dev->archdata.dma_offset; > } > > static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t daddr) > { > - return daddr - get_dma_offset(dev); > + if (!dev) > + return daddr - PCI_DRAM_OFFSET; > + return daddr - dev->archdata.dma_offset; > } > #endif /* ASM_POWERPC_DMA_DIRECT_H */ > diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h > index dacd0f93f2b2..f0bf7ac2686c 100644 > --- a/arch/powerpc/include/asm/dma-mapping.h > +++ b/arch/powerpc/include/asm/dma-mapping.h > @@ -80,22 +80,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) > return NULL; > } > > -/* > - * get_dma_offset() > - * > - * Get the dma offset on configurations where the dma address can be determined > - * from the physical address by looking at a simple offset. Direct dma and > - * swiotlb use this function, but it is typically not used by implementations > - * with an iommu. > - */ > -static inline dma_addr_t get_dma_offset(struct device *dev) > -{ > - if (dev) > - return dev->archdata.dma_offset; > - > - return PCI_DRAM_OFFSET; > -} > - > static inline void set_dma_offset(struct device *dev, dma_addr_t off) > { > if (dev)