All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andi Kleen <andi@firstfloor.org>, Tejun Heo <htejun@gmail.com>,
	Natalie Protasevich <protasnb@gmail.com>,
	Jeff Garzik <jgarzik@pobox.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-ide@vger.kernel.org, Jens Axboe <jens.axboe@oracle.com>
Subject: Re: AMD64 dma_alloc_coherent crashes on non PCI device (was SATA open bugs)
Date: Thu, 09 Aug 2007 13:19:49 -0700	[thread overview]
Message-ID: <1186690789.3426.4.camel@localhost.localdomain> (raw)
In-Reply-To: <20070809185310.682dffbc@the-village.bc.nu>

On Thu, 2007-08-09 at 18:53 +0100, Alan Cox wrote:
> > Someone must ask that caller library to DMA to/from that device
> > in the first place. Whoever it is it is wrong. 
> 
> No I disagree.

I'm with Andi here ... you're fortunate that parisc has no working
IDE/SATA interface (or rather we have so few running boxes with PCMCIA),
but if it did this call sequence would explode on that platform for a
different reason.

> > Or perhaps you got the wrong device here? For ISA devices we 
> > traditionally used NULL. Or if you set up your own ISA devices
> > (which I can't see a reason for but there might be one I'm missing) 
> > at least give them a dma mask. Then it should probably work on x86-64.
> 
> The libata code currently (and this seems to work for all but x86-64)
> does the following if it is setting up a potentially DMA capable device
> 
> 	- Allocate a dma_coherent buffer

You cannot allocate a dma_coherent buffer without passing in the correct
underlying device ... on parisc we'd explode trying to find the iommu to
map through (some of our hw has more than one).

> 	- If it is refused then turn off DMA and use PIO
> 
> It has no idea whether a pcmcia, isa, platform or even PCI device happens
> to be DMA capable, and there are platforms with PCI but very limited DMA
> for example in the embedded space. In fact it has no idea this level
> whether it is working a PCI, ISA, PCMCIA, SBUS or some other bus device.
> It's supposed to be generic code.
> 
> Obviously doing anything other than dma_alloc_coherent if the allocation
> fails is stupid but trying to allocate dma memory to find out if the
> device can be used with DMA on a given platform is quite logical and
> sensible in some cases.
> 
> Thus I think dma_alloc_coherent() for an ISA, PCMCIA or other class
> (platform particularly) shouldn't explode on AMD64 but simply return
> NULL. Its a sane request to make when you don't in your library know what
> dev is.

PCMCIA should be correctly plumbed into the generic model.  It's really
just a bridge ... how that bridge is wired critically affects how
coherent memory is allocated.

James



  parent reply	other threads:[~2007-08-09 20:19 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08 22:31 SATA open bugs Natalie Protasevich
2007-08-09  2:17 ` Mark Lord
2007-08-09  3:58 ` Tejun Heo
2007-08-09  5:44   ` Jens Axboe
2007-08-09 11:17   ` Matt Sealey
2007-08-09 13:53   ` AMD64 dma_alloc_coherent crashes on non PCI device (was SATA open bugs) Alan Cox
2007-08-09 17:05     ` Andi Kleen
2007-08-09 17:21       ` Alan Cox
2007-08-09 17:23         ` Andi Kleen
2007-08-09 17:53           ` Alan Cox
2007-08-09 19:28             ` Andi Kleen
2007-08-09 22:34               ` Alan Cox
2007-08-09 22:43                 ` Andi Kleen
2007-08-09 23:14                   ` Alan Cox
2007-08-09 23:08                     ` Andi Kleen
2007-08-09 23:11                     ` AMD64 dma_alloc_coherent crashes on non PCI device (was SATA open bugs) II Andi Kleen
2007-08-09 23:24                       ` Alan Cox
2007-08-10  9:43                         ` Andi Kleen
2007-08-10 13:54                           ` Alan Cox
2007-08-10 14:52                             ` James Bottomley
2007-08-10 16:58                               ` Alan Cox
2007-08-10 18:28                                 ` James Bottomley
2007-08-10 20:27                                   ` Andi Kleen
2007-09-16 17:12                                     ` James Bottomley
2007-09-16 17:15                                       ` [PATCH 1/1] introduce DMA_MASK_NONE as a signal for unable to do DMA James Bottomley
2007-09-16 17:16                                       ` [Patch 2/2] pcmcia: use DMA_MASK_NONE for the default for all pcmcia devices James Bottomley
2007-08-09 20:19             ` James Bottomley [this message]
2007-08-09 22:37               ` AMD64 dma_alloc_coherent crashes on non PCI device (was SATA open bugs) Alan Cox
2007-08-09 22:53                 ` James Bottomley
2007-08-09 23:17                   ` Alan Cox
2007-08-09 23:26                     ` James Bottomley
2007-08-09  5:28 ` SATA open bugs James Bottomley

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=1186690789.3426.4.camel@localhost.localdomain \
    --to=james.bottomley@steeleye.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andi@firstfloor.org \
    --cc=htejun@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=protasnb@gmail.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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.