public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Alex Williamson <alex.williamson@hp.com>
Cc: dwmw2@infradead.org, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/5] dma: create dma_generic_alloc/free_coherent()
Date: Tue, 27 Oct 2009 09:57:49 +0900	[thread overview]
Message-ID: <20091027005748.GB17085@linux-sh.org> (raw)
In-Reply-To: <20091026232458.9646.36818.stgit@nehalem.aw>

On Mon, Oct 26, 2009 at 05:24:58PM -0600, Alex Williamson wrote:
> Move dma_generic_alloc_coherent() out of x86 code and create
> corresponding dma_generic_free_coherent() for symmetry.  These
> can then be used by IOMMU drivers attempting to implement
> passthrough mode.
> 
Except that dma_generic_alloc_coherent() is only "generic" for platforms
with consistent DMA. Everyone else will need a cacheflush and potentially
a remap. It's not even obvious from looking at the consistent DMA
platforms that they'll be able to use it out of the box due to expecting
something other than page_address(), which all suggests that this is
better off remaining an x86-only routine.

This is also making changes to the DMA-API without any documentation
updates and without consulting with any other architecture people. If you
wish to make a proposal for a DMA-API addition, then this should be made
to linux-arch rather than hidden in an iommu patchset.

Beyond that, we presently have:

	- dma_alloc_coherent()
	- dma_alloc_noncoherent()
	- dma_alloc_from_coherent()

defined in the API. Making an addition to this for your fallback case
seems workable, but it's something that will have to be handled
differently for each architecture. You might be able to get away with
something generic enough to stash in drivers/base/dma-coherent.c, but
from a first look, I wouldn't count on it.

It was bad enough when the x86-specific flush_write_buffers() snuck in to
the "generic" dma mapping code, but this particular case is much more
problematic.

  reply	other threads:[~2009-10-27  0:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 23:24 [PATCH 0/5] intel-iommu fixes Alex Williamson
2009-10-26 23:24 ` [PATCH 1/5] dma: create dma_generic_alloc/free_coherent() Alex Williamson
2009-10-27  0:57   ` Paul Mundt [this message]
2009-10-27  2:26     ` Alex Williamson
2009-10-27  1:47   ` FUJITA Tomonori
2009-10-26 23:25 ` [PATCH 2/5] intel-iommu: Use dma_generic_alloc_coherent() for passthrough mappings Alex Williamson
2009-10-27  3:24   ` [PATCH v2 2/5] intel-iommu: Obey coherent_dma_mask for alloc_coherent on passthrough Alex Williamson
2009-10-26 23:25 ` [PATCH 3/5] intel-iommu: Use max_pfn to determine whether a device can passthrough Alex Williamson
2009-10-26 23:25 ` [PATCH 4/5] intel-iommu: Reinstate RMRRs if a device is removed from passthrough domain Alex Williamson
2009-10-27  8:15   ` David Woodhouse
2009-10-27 15:50     ` Alex Williamson
2009-10-28 14:36       ` David Woodhouse
2009-10-28 16:06         ` Alex Williamson
2009-10-28 20:35           ` Alex Williamson
2009-10-26 23:25 ` [PATCH 5/5] intel-iommu: Quiet unnecessary output Alex Williamson

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=20091027005748.GB17085@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=alex.williamson@hp.com \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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: link
Be 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