From: Michael Buesch <mb@bu3sch.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
linux-kernel@vger.kernel.org, amit.shah@qumranet.com,
muli@il.ibm.com, alexisb@us.ibm.com, andi@firstfloor.org,
kvm-devel@lists.sourceforge.net, avi@qumranet.com
Subject: Re: [PATCH v2 -mm 1/2] add the device argument to dma_mapping_error
Date: Wed, 2 Jul 2008 12:18:40 +0200 [thread overview]
Message-ID: <200807021218.41153.mb@bu3sch.de> (raw)
In-Reply-To: <20080702030723.dabf7546.akpm@linux-foundation.org>
On Wednesday 02 July 2008 12:07:23 Andrew Morton wrote:
> On Mon, 19 May 2008 15:31:28 +0900 FUJITA Tomonori <fujita.tomonori@lab.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.
next prev parent reply other threads:[~2008-07-02 10:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-19 6:31 [PATCH v2 -mm 0/2] x86: per-device dma_mapping_ops FUJITA Tomonori
2008-05-19 6:31 ` [PATCH v2 -mm 1/2] add the device argument to dma_mapping_error FUJITA Tomonori
2008-05-19 6:31 ` [PATCH v2 -mm 2/2] x86: per-device dma_mapping_ops support FUJITA Tomonori
2008-07-02 10:07 ` [PATCH v2 -mm 1/2] add the device argument to dma_mapping_error Andrew Morton
2008-07-02 10:18 ` Michael Buesch [this message]
2008-07-02 10:20 ` Michael Buesch
2008-07-02 10:41 ` Andrew Morton
2008-05-22 10:43 ` [PATCH v2 -mm 0/2] x86: per-device dma_mapping_ops Amit Shah
2008-05-25 7:20 ` Muli Ben-Yehuda
2008-05-26 4:09 ` Amit Shah
2008-05-26 6:11 ` FUJITA Tomonori
2008-05-26 16:44 ` Amit Shah
2008-05-26 23:50 ` FUJITA Tomonori
2008-05-27 4:53 ` Amit Shah
2008-05-27 5:24 ` FUJITA Tomonori
2008-05-27 5:54 ` Amit Shah
2008-05-28 10:19 ` FUJITA Tomonori
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=200807021218.41153.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=akpm@linux-foundation.org \
--cc=alexisb@us.ibm.com \
--cc=amit.shah@qumranet.com \
--cc=andi@firstfloor.org \
--cc=avi@qumranet.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=kvm-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=muli@il.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox