[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200807021218.41153.mb@bu3sch.de>
Date: Wed, 2 Jul 2008 12:18:40 +0200
From: Michael Buesch <mb@...sch.de>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
linux-kernel@...r.kernel.org, amit.shah@...ranet.com,
muli@...ibm.com, alexisb@...ibm.com, andi@...stfloor.org,
kvm-devel@...ts.sourceforge.net, avi@...ranet.com
Subject: Re: [PATCH v2 -mm 1/2] add the device argument to dma_mapping_error
On Wednesday 02 July 2008 12:07:23 Andrew Morton wrote:
> On Mon, 19 May 2008 15:31:28 +0900 FUJITA Tomonori <fujita.tomonori@....ntt.co.jp> wrote:
>
> > dma_mapping_error doesn't take a pointer to the device unlike other
> > DMA operations. So we can't have dma_mapping_ops per device.
> >
> > Note that POWER already has dma_mapping_ops per device but all the
> > POWER IOMMUs use the same dma_mapping_error function. x86 IOMMUs use
> > different dma_mapping_error functions. So dma_mapping_error needs the
> > device argument.
>
> This patch continues to turn my hair grey.
>
> I'm currently staring at this, in include/linux/ssb/ssb.h:
>
> static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
> {
> switch (dev->bus->bustype) {
> case SSB_BUSTYPE_PCI:
> return pci_dma_mapping_error(dev->dev, addr);
> case SSB_BUSTYPE_SSB:
> return dma_mapping_error(dev->dev, addr);
> default:
> __ssb_dma_not_implemented(dev);
> }
> return -ENOSYS;
> }
>
> How do I go from an ssb_device* to a pci_dev*?
>
> Dunno. I think I'll cheat and do:
>
> static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
> {
> switch (dev->bus->bustype) {
> case SSB_BUSTYPE_PCI:
> return dma_mapping_error(dev->dev, addr);
The statement above is wrong. The PCI-specific dma-mapping-error function
must be used here. (I hope such a thing exists. Otherwise the API is broken).
So
return pci_mapping_error(dev->bus->host_pci, addr);
> case SSB_BUSTYPE_SSB:
> return dma_mapping_error(dev->dev, addr);
> default:
> __ssb_dma_not_implemented(dev);
> }
> return -ENOSYS;
> }
--
Greetings Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists