From: Russell King - ARM Linux <linux@arm.linux.org.uk> To: Marek Szyprowski <m.szyprowski@samsung.com> Cc: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-samsung-soc@vger.kernel.org, iommu@lists.linux-foundation.org, Kyungmin Park <kyungmin.park@samsung.com>, Arnd Bergmann <arnd@arndb.de>, Joerg Roedel <joro@8bytes.org>, Shariq Hasnain <shariq.hasnain@linaro.org>, Chunsang Jeong <chunsang.jeong@linaro.org>, Krishna Reddy <vdumpa@nvidia.com>, KyongHo Cho <pullip.cho@samsung.com>, Andrzej Pietrasiewicz <andrzej.p@samsung.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org> Subject: Re: [PATCH 8/8 RESEND] ARM: dma-mapping: add support for IOMMU mapper Date: Wed, 25 Jan 2012 12:59:16 +0000 [thread overview] Message-ID: <20120125125916.GE1068@n2100.arm.linux.org.uk> (raw) In-Reply-To: <1326124161-2220-1-git-send-email-m.szyprowski@samsung.com> On Mon, Jan 09, 2012 at 04:49:21PM +0100, Marek Szyprowski wrote: > This patch add a complete implementation of DMA-mapping API for > devices that have IOMMU support. All DMA-mapping calls are supported. > > This patch contains some of the code kindly provided by Krishna Reddy > <vdumpa@nvidia.com> and Andrzej Pietrasiewicz <andrzej.p@samsung.com> > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> > > --- > > Hello, > > This is the corrected version of the previous patch from the "[PATCH 0/8 > v4] ARM: DMA-mapping framework redesign" thread which can be found here: > http://www.spinics.net/lists/linux-mm/msg27382.html > > Previous version had very nasty bug which causes memory trashing if > DMA-mapping managed to allocate pages larger than 4KiB. The problem was > in __iommu_alloc_buffer() function which did not check how many pages > has been left to allocate. This patch seems to be incomplete. If the standard DMA API is used (the one which exists in current kernels) and NEED_SG_DMA_LENGTH is enabled, then where do we set the DMA length in the scatterlist? > diff --git a/arch/arm/include/asm/dma-iommu.h b/arch/arm/include/asm/dma-iommu.h > new file mode 100644 > index 0000000..6668b41 > --- /dev/null > +++ b/arch/arm/include/asm/dma-iommu.h > @@ -0,0 +1,36 @@ > +#ifndef ASMARM_DMA_IOMMU_H > +#define ASMARM_DMA_IOMMU_H > + > +#ifdef __KERNEL__ > + > +#include <linux/mm_types.h> > +#include <linux/scatterlist.h> > +#include <linux/dma-debug.h> > +#include <linux/kmemcheck.h> > + > +#include <asm/memory.h> I can't see anything in here which needs asm/memory.h - if files which include this need it, please include it in there so we can see why it's needed. > + > +struct dma_iommu_mapping { > + /* iommu specific data */ > + struct iommu_domain *domain; > + > + void *bitmap; > + size_t bits; > + unsigned int order; > + dma_addr_t base; > + > + spinlock_t lock; > + struct kref kref; > +}; > + > +struct dma_iommu_mapping * > +arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size, > + int order); > + > +void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); > + > +int arm_iommu_attach_device(struct device *dev, > + struct dma_iommu_mapping *mapping); > + > +#endif /* __KERNEL__ */ > +#endif > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c > index 4845c09..2287b01 100644 > --- a/arch/arm/mm/dma-mapping.c > +++ b/arch/arm/mm/dma-mapping.c > @@ -27,6 +27,9 @@ > #include <asm/sizes.h> > #include <asm/mach/arch.h> > > +#include <linux/iommu.h> linux/ includes should be grouped together. > diff --git a/arch/arm/mm/vmregion.h b/arch/arm/mm/vmregion.h > index 15e9f04..6bbc402 100644 > --- a/arch/arm/mm/vmregion.h > +++ b/arch/arm/mm/vmregion.h > @@ -17,7 +17,7 @@ struct arm_vmregion { > struct list_head vm_list; > unsigned long vm_start; > unsigned long vm_end; > - struct page *vm_pages; > + void *priv; I want to think about that - I may wish to export the vm_pages via the new dma-mappings file to provide additional information. -- 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux <linux@arm.linux.org.uk> To: Marek Szyprowski <m.szyprowski@samsung.com> Cc: linux-arm-kernel@lists.infradead.org, linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-samsung-soc@vger.kernel.org, iommu@lists.linux-foundation.org, Kyungmin Park <kyungmin.park@samsung.com>, Arnd Bergmann <arnd@arndb.de>, Joerg Roedel <joro@8bytes.org>, Shariq Hasnain <shariq.hasnain@linaro.org>, Chunsang Jeong <chunsang.jeong@linaro.org>, Krishna Reddy <vdumpa@nvidia.com>, KyongHo Cho <pullip.cho@samsung.com>, Andrzej Pietrasiewicz <andrzej.p@samsung.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org> Subject: Re: [PATCH 8/8 RESEND] ARM: dma-mapping: add support for IOMMU mapper Date: Wed, 25 Jan 2012 12:59:16 +0000 [thread overview] Message-ID: <20120125125916.GE1068@n2100.arm.linux.org.uk> (raw) Message-ID: <20120125125916.Ujsx_zB0kV_3EPpKZqLmumE2N2D-teYr40re1LvxcCw@z> (raw) In-Reply-To: <1326124161-2220-1-git-send-email-m.szyprowski@samsung.com> On Mon, Jan 09, 2012 at 04:49:21PM +0100, Marek Szyprowski wrote: > This patch add a complete implementation of DMA-mapping API for > devices that have IOMMU support. All DMA-mapping calls are supported. > > This patch contains some of the code kindly provided by Krishna Reddy > <vdumpa@nvidia.com> and Andrzej Pietrasiewicz <andrzej.p@samsung.com> > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> > > --- > > Hello, > > This is the corrected version of the previous patch from the "[PATCH 0/8 > v4] ARM: DMA-mapping framework redesign" thread which can be found here: > http://www.spinics.net/lists/linux-mm/msg27382.html > > Previous version had very nasty bug which causes memory trashing if > DMA-mapping managed to allocate pages larger than 4KiB. The problem was > in __iommu_alloc_buffer() function which did not check how many pages > has been left to allocate. This patch seems to be incomplete. If the standard DMA API is used (the one which exists in current kernels) and NEED_SG_DMA_LENGTH is enabled, then where do we set the DMA length in the scatterlist? > diff --git a/arch/arm/include/asm/dma-iommu.h b/arch/arm/include/asm/dma-iommu.h > new file mode 100644 > index 0000000..6668b41 > --- /dev/null > +++ b/arch/arm/include/asm/dma-iommu.h > @@ -0,0 +1,36 @@ > +#ifndef ASMARM_DMA_IOMMU_H > +#define ASMARM_DMA_IOMMU_H > + > +#ifdef __KERNEL__ > + > +#include <linux/mm_types.h> > +#include <linux/scatterlist.h> > +#include <linux/dma-debug.h> > +#include <linux/kmemcheck.h> > + > +#include <asm/memory.h> I can't see anything in here which needs asm/memory.h - if files which include this need it, please include it in there so we can see why it's needed. > + > +struct dma_iommu_mapping { > + /* iommu specific data */ > + struct iommu_domain *domain; > + > + void *bitmap; > + size_t bits; > + unsigned int order; > + dma_addr_t base; > + > + spinlock_t lock; > + struct kref kref; > +}; > + > +struct dma_iommu_mapping * > +arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size, > + int order); > + > +void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); > + > +int arm_iommu_attach_device(struct device *dev, > + struct dma_iommu_mapping *mapping); > + > +#endif /* __KERNEL__ */ > +#endif > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c > index 4845c09..2287b01 100644 > --- a/arch/arm/mm/dma-mapping.c > +++ b/arch/arm/mm/dma-mapping.c > @@ -27,6 +27,9 @@ > #include <asm/sizes.h> > #include <asm/mach/arch.h> > > +#include <linux/iommu.h> linux/ includes should be grouped together. > diff --git a/arch/arm/mm/vmregion.h b/arch/arm/mm/vmregion.h > index 15e9f04..6bbc402 100644 > --- a/arch/arm/mm/vmregion.h > +++ b/arch/arm/mm/vmregion.h > @@ -17,7 +17,7 @@ struct arm_vmregion { > struct list_head vm_list; > unsigned long vm_start; > unsigned long vm_end; > - struct page *vm_pages; > + void *priv; I want to think about that - I may wish to export the vm_pages via the new dma-mappings file to provide additional information.
next prev parent reply other threads:[~2012-01-25 12:59 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-09 16:39 [PATCH 0/8 v4] ARM: DMA-mapping framework redesign Marek Szyprowski 2011-12-09 16:39 ` Marek Szyprowski 2011-12-09 16:39 ` [PATCH 1/8] ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops Marek Szyprowski 2011-12-09 16:39 ` Marek Szyprowski 2011-12-09 16:39 ` [PATCH 2/8] ARM: dma-mapping: use asm-generic/dma-mapping-common.h Marek Szyprowski 2011-12-09 16:39 ` Marek Szyprowski 2011-12-09 16:39 ` [PATCH 3/8] ARM: dma-mapping: implement dma sg methods on top of any generic dma ops Marek Szyprowski 2011-12-09 16:39 ` Marek Szyprowski 2011-12-09 16:39 ` [PATCH 4/8] ARM: dma-mapping: move all dma bounce code to separate dma ops structure Marek Szyprowski 2011-12-09 16:39 ` Marek Szyprowski 2011-12-09 16:39 ` [PATCH 5/8] ARM: dma-mapping: remove redundant code and cleanup Marek Szyprowski 2011-12-09 16:39 ` Marek Szyprowski 2011-12-09 16:39 ` [PATCH 6/8] common: dma-mapping: change alloc/free_coherent method to more generic alloc/free_attrs Marek Szyprowski 2011-12-09 16:39 ` Marek Szyprowski 2011-12-11 22:45 ` Stephen Rothwell 2011-12-11 22:45 ` Stephen Rothwell 2011-12-14 12:37 ` Marek Szyprowski 2011-12-09 16:39 ` [PATCH 7/8] ARM: dma-mapping: use alloc, mmap, free from dma_ops Marek Szyprowski 2011-12-09 16:39 ` [PATCH 8/8] ARM: dma-mapping: add support for IOMMU mapper Marek Szyprowski 2011-12-09 16:39 ` Marek Szyprowski 2012-01-09 15:49 ` [PATCH 8/8 RESEND] " Marek Szyprowski 2012-01-09 15:49 ` Marek Szyprowski 2012-01-25 12:59 ` Russell King - ARM Linux [this message] 2012-01-25 12:59 ` Russell King - ARM Linux 2012-01-26 8:09 ` Marek Szyprowski 2012-01-25 12:47 ` [PATCH 8/8] " Hiroshi Doyu 2012-01-25 12:47 ` Hiroshi Doyu 2012-01-26 7:46 ` Marek Szyprowski 2012-01-26 7:46 ` Marek Szyprowski 2012-01-10 8:42 ` [PATCH 0/8 v4] ARM: DMA-mapping framework redesign Marek Szyprowski
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20120125125916.GE1068@n2100.arm.linux.org.uk \ --to=linux@arm.linux.org.uk \ --cc=andrzej.p@samsung.com \ --cc=arnd@arndb.de \ --cc=benh@kernel.crashing.org \ --cc=chunsang.jeong@linaro.org \ --cc=iommu@lists.linux-foundation.org \ --cc=joro@8bytes.org \ --cc=kyungmin.park@samsung.com \ --cc=linaro-mm-sig@lists.linaro.org \ --cc=linux-arch@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-mm@kvack.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=m.szyprowski@samsung.com \ --cc=pullip.cho@samsung.com \ --cc=shariq.hasnain@linaro.org \ --cc=vdumpa@nvidia.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).