Re: [RFC] mm: iommu: An API to unify IOMMU, CPU and device memorymanagement

From: FUJITA Tomonori
Date: Sun Jun 27 2010 - 00:47:20 EST

On Thu, 24 Jun 2010 23:48:50 -0700
Zach Pfeffer <zpfeffer@xxxxxxxxxxxxxx> wrote:

> Andi Kleen wrote:
> > Zach Pfeffer <zpfeffer@xxxxxxxxxxxxxx> writes:
> >
> >> This patch contains the documentation for and the main header file of
> >> the API, termed the Virtual Contiguous Memory Manager. Its use would
> >> allow all of the IOMMU to VM, VM to device and device to IOMMU
> >> interoperation code to be refactored into platform independent code.
> >
> > I read all the description and it's still unclear what advantage
> > this all has over the current architecture?
> >
> > At least all the benefits mentioned seem to be rather nebulous.
> >
> > Can you describe a concrete use case that is improved by this code
> > directly?
> Sure. On a SoC with many IOMMUs (10-100), where each IOMMU may have
> its own set of page-tables or share page-tables, and where devices
> with and without IOMMUs and CPUs with or without MMUS want to
> communicate, an abstraction like the VCM helps manage all conceivable
> mapping topologies. In the same way that the Linux MM manages pages
> apart from page-frames, the VCMM allows the Linux MM to manage ideal
> memory regions, VCMs, apart from the actual memory region.
> One real scenario would be video playback from a file on a memory
> card. To read and display the video, a DMA engine would read blocks of
> data from the memory card controller into memory. These would
> typically be managed using a scatter-gather list. This list would be
> mapped into a contiguous buffer of the video decoder's IOMMU. The
> video decoder would write into a buffer mapped by the display engine's
> IOMMU as well as the CPU (if the kernel needed to intercept the
> buffers). In this instance, the video decoder's IOMMU and the display
> engine's IOMMU use different page-table formats.
> Using the VCM API, this topology can be created without worrying about
> the device's IOMMUs or how to map the buffers into the kernel, or how
> to interoperate with the scatter-gather list. The call flow would would go:

Can you explain how you can't do the above with the existing API?

> The general point of the VCMM is to allow users a higher level API
> than the current IOMMU abstraction provides that solves the general
> mapping problem. This means that all of the common mapping code would
> be written once. In addition, the API allows all the low level details
> of IOMMU programing and VM interoperation to be handled at the right
> level.
> Eventually the following functions could all be reworked and their
> users could call VCM functions.

There are more IOMMUs (e.g. x86 has calgary, gart too). And what is
the point of converting old IOMMUs (the majority of the below)? are
there any potential users of your API for such old IOMMUs?
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at