From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 3/8] ARM: dma-mapping: use asm-generic/dma-mapping-common.h Date: Fri, 24 Jun 2011 17:36:43 +0200 Message-ID: <201106241736.43576.arnd@arndb.de> References: <1308556213-24970-1-git-send-email-m.szyprowski@samsung.com> <1308556213-24970-4-git-send-email-m.szyprowski@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1308556213-24970-4-git-send-email-m.szyprowski@samsung.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Marek Szyprowski Cc: linux-arch@vger.kernel.org, Russell King - ARM Linux , Joerg Roedel , linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, Kyungmin Park , linux-arm-kernel@lists.infradead.org List-Id: linux-arch.vger.kernel.org On Monday 20 June 2011, Marek Szyprowski wrote: > This patch modifies dma-mapping implementation on ARM architecture to > use common dma_map_ops structure and asm-generic/dma-mapping-common.h > helpers. > > Signed-off-by: Marek Szyprowski > Signed-off-by: Kyungmin Park This is a good idea in general, but I have a few concerns about details: First of all, should we only allow using dma_map_ops on ARM, or do we also want to support a case where these are all inlined as before? I suppose for the majority of the cases, the overhead of the indirect function call is near-zero, compared to the overhead of the cache management operation, so it would only make a difference for coherent systems without an IOMMU. Do we care about micro-optimizing those? > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h > index 799669d..f4e4968 100644 > --- a/arch/arm/include/asm/dma-mapping.h > +++ b/arch/arm/include/asm/dma-mapping.h > @@ -10,6 +10,27 @@ > #include > #include > > +extern struct dma_map_ops dma_ops; > + > +static inline struct dma_map_ops *get_dma_ops(struct device *dev) > +{ > + if (dev->archdata.dma_ops) > + return dev->archdata.dma_ops; > + return &dma_ops; > +} I would not name the global structure just 'dma_ops', the identifier could too easily conflict with a local variable in some driver. How about arm_dma_ops or linear_dma_ops instead? > /* > * The scatter list versions of the above methods. > */ > -extern int dma_map_sg(struct device *, struct scatterlist *, int, > - enum dma_data_direction); > -extern void dma_unmap_sg(struct device *, struct scatterlist *, int, > +extern int arm_dma_map_sg(struct device *, struct scatterlist *, int, > + enum dma_data_direction, struct dma_attrs *attrs); > +extern void arm_dma_unmap_sg(struct device *, struct scatterlist *, int, > + enum dma_data_direction, struct dma_attrs *attrs); > +extern void arm_dma_sync_sg_for_cpu(struct device *, struct scatterlist *, int, > enum dma_data_direction); > -extern void dma_sync_sg_for_cpu(struct device *, struct scatterlist *, int, > +extern void arm_dma_sync_sg_for_device(struct device *, struct scatterlist *, int, > enum dma_data_direction); > -extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int, > - enum dma_data_direction); > - You should not need to make these symbols visible in the header file any more unless they are used outside of the main file later. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from moutng.kundenserver.de ([212.227.17.9]:58301 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759756Ab1FXPhL (ORCPT ); Fri, 24 Jun 2011 11:37:11 -0400 From: Arnd Bergmann Subject: Re: [PATCH 3/8] ARM: dma-mapping: use asm-generic/dma-mapping-common.h Date: Fri, 24 Jun 2011 17:36:43 +0200 References: <1308556213-24970-1-git-send-email-m.szyprowski@samsung.com> <1308556213-24970-4-git-send-email-m.szyprowski@samsung.com> In-Reply-To: <1308556213-24970-4-git-send-email-m.szyprowski@samsung.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-ID: <201106241736.43576.arnd@arndb.de> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Marek Szyprowski Cc: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Kyungmin Park , Joerg Roedel , Russell King - ARM Linux Message-ID: <20110624153643.UjCMRrawWHna8fYRBL_I6qCZoswY2QW1jLgkhJ3pQAA@z> On Monday 20 June 2011, Marek Szyprowski wrote: > This patch modifies dma-mapping implementation on ARM architecture to > use common dma_map_ops structure and asm-generic/dma-mapping-common.h > helpers. > > Signed-off-by: Marek Szyprowski > Signed-off-by: Kyungmin Park This is a good idea in general, but I have a few concerns about details: First of all, should we only allow using dma_map_ops on ARM, or do we also want to support a case where these are all inlined as before? I suppose for the majority of the cases, the overhead of the indirect function call is near-zero, compared to the overhead of the cache management operation, so it would only make a difference for coherent systems without an IOMMU. Do we care about micro-optimizing those? > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h > index 799669d..f4e4968 100644 > --- a/arch/arm/include/asm/dma-mapping.h > +++ b/arch/arm/include/asm/dma-mapping.h > @@ -10,6 +10,27 @@ > #include > #include > > +extern struct dma_map_ops dma_ops; > + > +static inline struct dma_map_ops *get_dma_ops(struct device *dev) > +{ > + if (dev->archdata.dma_ops) > + return dev->archdata.dma_ops; > + return &dma_ops; > +} I would not name the global structure just 'dma_ops', the identifier could too easily conflict with a local variable in some driver. How about arm_dma_ops or linear_dma_ops instead? > /* > * The scatter list versions of the above methods. > */ > -extern int dma_map_sg(struct device *, struct scatterlist *, int, > - enum dma_data_direction); > -extern void dma_unmap_sg(struct device *, struct scatterlist *, int, > +extern int arm_dma_map_sg(struct device *, struct scatterlist *, int, > + enum dma_data_direction, struct dma_attrs *attrs); > +extern void arm_dma_unmap_sg(struct device *, struct scatterlist *, int, > + enum dma_data_direction, struct dma_attrs *attrs); > +extern void arm_dma_sync_sg_for_cpu(struct device *, struct scatterlist *, int, > enum dma_data_direction); > -extern void dma_sync_sg_for_cpu(struct device *, struct scatterlist *, int, > +extern void arm_dma_sync_sg_for_device(struct device *, struct scatterlist *, int, > enum dma_data_direction); > -extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int, > - enum dma_data_direction); > - You should not need to make these symbols visible in the header file any more unless they are used outside of the main file later. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by kanga.kvack.org (Postfix) with ESMTP id C859890023D for ; Fri, 24 Jun 2011 11:37:09 -0400 (EDT) From: Arnd Bergmann Subject: Re: [PATCH 3/8] ARM: dma-mapping: use asm-generic/dma-mapping-common.h Date: Fri, 24 Jun 2011 17:36:43 +0200 References: <1308556213-24970-1-git-send-email-m.szyprowski@samsung.com> <1308556213-24970-4-git-send-email-m.szyprowski@samsung.com> In-Reply-To: <1308556213-24970-4-git-send-email-m.szyprowski@samsung.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201106241736.43576.arnd@arndb.de> Sender: owner-linux-mm@kvack.org List-ID: To: Marek Szyprowski Cc: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Kyungmin Park , Joerg Roedel , Russell King - ARM Linux On Monday 20 June 2011, Marek Szyprowski wrote: > This patch modifies dma-mapping implementation on ARM architecture to > use common dma_map_ops structure and asm-generic/dma-mapping-common.h > helpers. > > Signed-off-by: Marek Szyprowski > Signed-off-by: Kyungmin Park This is a good idea in general, but I have a few concerns about details: First of all, should we only allow using dma_map_ops on ARM, or do we also want to support a case where these are all inlined as before? I suppose for the majority of the cases, the overhead of the indirect function call is near-zero, compared to the overhead of the cache management operation, so it would only make a difference for coherent systems without an IOMMU. Do we care about micro-optimizing those? > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h > index 799669d..f4e4968 100644 > --- a/arch/arm/include/asm/dma-mapping.h > +++ b/arch/arm/include/asm/dma-mapping.h > @@ -10,6 +10,27 @@ > #include > #include > > +extern struct dma_map_ops dma_ops; > + > +static inline struct dma_map_ops *get_dma_ops(struct device *dev) > +{ > + if (dev->archdata.dma_ops) > + return dev->archdata.dma_ops; > + return &dma_ops; > +} I would not name the global structure just 'dma_ops', the identifier could too easily conflict with a local variable in some driver. How about arm_dma_ops or linear_dma_ops instead? > /* > * The scatter list versions of the above methods. > */ > -extern int dma_map_sg(struct device *, struct scatterlist *, int, > - enum dma_data_direction); > -extern void dma_unmap_sg(struct device *, struct scatterlist *, int, > +extern int arm_dma_map_sg(struct device *, struct scatterlist *, int, > + enum dma_data_direction, struct dma_attrs *attrs); > +extern void arm_dma_unmap_sg(struct device *, struct scatterlist *, int, > + enum dma_data_direction, struct dma_attrs *attrs); > +extern void arm_dma_sync_sg_for_cpu(struct device *, struct scatterlist *, int, > enum dma_data_direction); > -extern void dma_sync_sg_for_cpu(struct device *, struct scatterlist *, int, > +extern void arm_dma_sync_sg_for_device(struct device *, struct scatterlist *, int, > enum dma_data_direction); > -extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int, > - enum dma_data_direction); > - You should not need to make these symbols visible in the header file any more unless they are used outside of the main file later. Arnd -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Fri, 24 Jun 2011 17:36:43 +0200 Subject: [PATCH 3/8] ARM: dma-mapping: use asm-generic/dma-mapping-common.h In-Reply-To: <1308556213-24970-4-git-send-email-m.szyprowski@samsung.com> References: <1308556213-24970-1-git-send-email-m.szyprowski@samsung.com> <1308556213-24970-4-git-send-email-m.szyprowski@samsung.com> Message-ID: <201106241736.43576.arnd@arndb.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Monday 20 June 2011, Marek Szyprowski wrote: > This patch modifies dma-mapping implementation on ARM architecture to > use common dma_map_ops structure and asm-generic/dma-mapping-common.h > helpers. > > Signed-off-by: Marek Szyprowski > Signed-off-by: Kyungmin Park This is a good idea in general, but I have a few concerns about details: First of all, should we only allow using dma_map_ops on ARM, or do we also want to support a case where these are all inlined as before? I suppose for the majority of the cases, the overhead of the indirect function call is near-zero, compared to the overhead of the cache management operation, so it would only make a difference for coherent systems without an IOMMU. Do we care about micro-optimizing those? > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h > index 799669d..f4e4968 100644 > --- a/arch/arm/include/asm/dma-mapping.h > +++ b/arch/arm/include/asm/dma-mapping.h > @@ -10,6 +10,27 @@ > #include > #include > > +extern struct dma_map_ops dma_ops; > + > +static inline struct dma_map_ops *get_dma_ops(struct device *dev) > +{ > + if (dev->archdata.dma_ops) > + return dev->archdata.dma_ops; > + return &dma_ops; > +} I would not name the global structure just 'dma_ops', the identifier could too easily conflict with a local variable in some driver. How about arm_dma_ops or linear_dma_ops instead? > /* > * The scatter list versions of the above methods. > */ > -extern int dma_map_sg(struct device *, struct scatterlist *, int, > - enum dma_data_direction); > -extern void dma_unmap_sg(struct device *, struct scatterlist *, int, > +extern int arm_dma_map_sg(struct device *, struct scatterlist *, int, > + enum dma_data_direction, struct dma_attrs *attrs); > +extern void arm_dma_unmap_sg(struct device *, struct scatterlist *, int, > + enum dma_data_direction, struct dma_attrs *attrs); > +extern void arm_dma_sync_sg_for_cpu(struct device *, struct scatterlist *, int, > enum dma_data_direction); > -extern void dma_sync_sg_for_cpu(struct device *, struct scatterlist *, int, > +extern void arm_dma_sync_sg_for_device(struct device *, struct scatterlist *, int, > enum dma_data_direction); > -extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int, > - enum dma_data_direction); > - You should not need to make these symbols visible in the header file any more unless they are used outside of the main file later. Arnd