From mboxrd@z Thu Jan 1 00:00:00 1970 From: zpfeffer@codeaurora.org (Zach Pfeffer) Date: Mon, 12 Jul 2010 22:57:06 -0700 Subject: [RFC 1/3 v3] mm: iommu: An API to unify IOMMU, CPU and device memory management In-Reply-To: <20100712102435B.fujita.tomonori@lab.ntt.co.jp> References: <4C35034B.6040906@codeaurora.org> <20100707230710.GA31792@n2100.arm.linux.org.uk> <4C366678.60605@codeaurora.org> <20100712102435B.fujita.tomonori@lab.ntt.co.jp> Message-ID: <4C3C0032.5020702@codeaurora.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org FUJITA Tomonori wrote: > On Thu, 08 Jul 2010 16:59:52 -0700 > Zach Pfeffer wrote: > >> The problem I'm trying to solve boils down to this: map a set of >> contiguous physical buffers to an aligned IOMMU address. I need to >> allocate the set of physical buffers in a particular way: use 1 MB >> contiguous physical memory, then 64 KB, then 4 KB, etc. and I need to >> align the IOMMU address in a particular way. > > Sounds like the DMA API already supports what you want. > > You can set segment_boundary_mask in struct device_dma_parameters if > you want to align the IOMMU address. See IOMMU implementations that > support dma_get_seg_boundary() properly. That function takes the wrong argument in a VCM world: unsigned long dma_get_seg_boundary(struct device *dev); The boundary should be an attribute of the device side mapping, independent of the device. This would allow better code reuse. -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.