From: Alexis Bruemmer <alexisb@us.ibm.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
muli@il.ibm.com, mingo@elte.hu
Subject: Re: [PATCH -mm] fix per-device dma_mapping_ops support
Date: Tue, 01 Jul 2008 14:52:04 -0700 [thread overview]
Message-ID: <1214949124.6553.9.camel@alexis> (raw)
In-Reply-To: <20080612172554X.fujita.tomonori@lab.ntt.co.jp>
Where are we with with this patch-- as well as the needed calgary
update:
http://marc.info/?l=linux-kernel&m=121329005131176&w=2
Are they at a state where they can be picked-up? If not what is needed
to progress?
Thanks!
Alexis
On Thu, 2008-06-12 at 17:21 +0900, FUJITA Tomonori wrote:
> Andrew, can you put this patch to -mm?
>
> This patch fixes a bug in per-device dma_mapping_ops support. The
> patch to fix Calgary IOMMU with per-device dma_mapping_ops support is
> ready so we need this fix in -mm.
>
> http://lkml.org/lkml/2008/6/11/447
>
> This is a resend of:
>
> http://lkml.org/lkml/2008/6/3/430
>
> =
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Date: Thu, 12 Jun 2008 17:14:02 +0900
> Subject: [PATCH] fix per-device dma_mapping_ops support
>
> On x86, pci_dma_supported, pci_alloc_consistent, and
> pci_free_consistent don't call DMA APIs directly (the majority of
> platforms do). per-device dma_mapping_ops support patch needs to
> modify pci-dma.c.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> ---
> arch/x86/kernel/pci-dma.c | 25 +++++++++++++++----------
> 1 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index fa500c4..a2b98a5 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -318,6 +318,8 @@ static int dma_release_coherent(struct device *dev, int order, void *vaddr)
>
> int dma_supported(struct device *dev, u64 mask)
> {
> + struct dma_mapping_ops *ops = get_dma_ops(dev);
> +
> #ifdef CONFIG_PCI
> if (mask > 0xffffffff && forbid_dac > 0) {
> dev_info(dev, "PCI: Disallowing DAC for device\n");
> @@ -325,8 +327,8 @@ int dma_supported(struct device *dev, u64 mask)
> }
> #endif
>
> - if (dma_ops->dma_supported)
> - return dma_ops->dma_supported(dev, mask);
> + if (ops->dma_supported)
> + return ops->dma_supported(dev, mask);
>
> /* Copied from i386. Doesn't make much sense, because it will
> only work for pci_alloc_coherent.
> @@ -373,6 +375,7 @@ void *
> dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
> gfp_t gfp)
> {
> + struct dma_mapping_ops *ops = get_dma_ops(dev);
> void *memory = NULL;
> struct page *page;
> unsigned long dma_mask = 0;
> @@ -435,8 +438,8 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
> /* Let low level make its own zone decisions */
> gfp &= ~(GFP_DMA32|GFP_DMA);
>
> - if (dma_ops->alloc_coherent)
> - return dma_ops->alloc_coherent(dev, size,
> + if (ops->alloc_coherent)
> + return ops->alloc_coherent(dev, size,
> dma_handle, gfp);
> return NULL;
> }
> @@ -448,14 +451,14 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
> }
> }
>
> - if (dma_ops->alloc_coherent) {
> + if (ops->alloc_coherent) {
> free_pages((unsigned long)memory, get_order(size));
> gfp &= ~(GFP_DMA|GFP_DMA32);
> - return dma_ops->alloc_coherent(dev, size, dma_handle, gfp);
> + return ops->alloc_coherent(dev, size, dma_handle, gfp);
> }
>
> - if (dma_ops->map_simple) {
> - *dma_handle = dma_ops->map_simple(dev, virt_to_phys(memory),
> + if (ops->map_simple) {
> + *dma_handle = ops->map_simple(dev, virt_to_phys(memory),
> size,
> PCI_DMA_BIDIRECTIONAL);
> if (*dma_handle != bad_dma_address)
> @@ -477,12 +480,14 @@ EXPORT_SYMBOL(dma_alloc_coherent);
> void dma_free_coherent(struct device *dev, size_t size,
> void *vaddr, dma_addr_t bus)
> {
> + struct dma_mapping_ops *ops = get_dma_ops(dev);
> +
> int order = get_order(size);
> WARN_ON(irqs_disabled()); /* for portability */
> if (dma_release_coherent(dev, order, vaddr))
> return;
> - if (dma_ops->unmap_single)
> - dma_ops->unmap_single(dev, bus, size, 0);
> + if (ops->unmap_single)
> + ops->unmap_single(dev, bus, size, 0);
> free_pages((unsigned long)vaddr, order);
> }
> EXPORT_SYMBOL(dma_free_coherent);
next prev parent reply other threads:[~2008-07-01 21:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-12 8:21 [PATCH -mm] fix per-device dma_mapping_ops support FUJITA Tomonori
2008-07-01 21:52 ` Alexis Bruemmer [this message]
2008-07-02 2:37 ` FUJITA Tomonori
2008-07-02 2:48 ` Andrew Morton
2008-07-02 3:43 ` FUJITA Tomonori
2008-07-02 4:06 ` Andrew Morton
2008-07-02 4:29 ` FUJITA Tomonori
2008-07-02 4:46 ` Andrew Morton
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=1214949124.6553.9.camel@alexis \
--to=alexisb@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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