From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: Eli Billauer <eli.billauer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org,
Shuah Khan <shuah.kh-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
discuss-Wa75r+71Mmgdnm+yROfE0A@public.gmane.org,
gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v2 1/4] dma-mapping: Add devm_ interface for dma_map_single()
Date: Wed, 4 Jun 2014 23:25:25 +0200 [thread overview]
Message-ID: <20140604212525.GE23880@8bytes.org> (raw)
In-Reply-To: <538F3548.4050101-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hi,
On Wed, Jun 04, 2014 at 06:03:36PM +0300, Eli Billauer wrote:
> I believe that I need a managed dma_map_single() my own driver,
> which doesn't fall in the case of a single use: The driver allocates
> its buffers with __get_free_pages() (or the to-be managed version of
> it). Then it cuts the allocated memory into smaller buffers (in some
> cases, and with certain alignment rules), and then calls
> dma_map_single() to do the DMA mapping for each. The buffers are
> held along the driver's lifetime, with DMA sync API juggling control
> back and forth to the hardware. Note that the DMA is noncoherent.
What you are trying to do should work with dma_alloc_noncoherent(). The
API allows partial syncs on this memory, so you should be fine.
The problem with a devm variant of dma_map_* is that it is too easy to
misuse or to use it wrong so that a driver could eat up all available
DMA handles on some platforms.
Joerg
WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: Eli Billauer <eli.billauer@gmail.com>
Cc: Tejun Heo <tj@kernel.org>, Shuah Khan <shuah.kh@samsung.com>,
devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
bhelgaas@google.com, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org,
discuss@x86-64.org
Subject: Re: [PATCH v2 1/4] dma-mapping: Add devm_ interface for dma_map_single()
Date: Wed, 4 Jun 2014 23:25:25 +0200 [thread overview]
Message-ID: <20140604212525.GE23880@8bytes.org> (raw)
In-Reply-To: <538F3548.4050101@gmail.com>
Hi,
On Wed, Jun 04, 2014 at 06:03:36PM +0300, Eli Billauer wrote:
> I believe that I need a managed dma_map_single() my own driver,
> which doesn't fall in the case of a single use: The driver allocates
> its buffers with __get_free_pages() (or the to-be managed version of
> it). Then it cuts the allocated memory into smaller buffers (in some
> cases, and with certain alignment rules), and then calls
> dma_map_single() to do the DMA mapping for each. The buffers are
> held along the driver's lifetime, with DMA sync API juggling control
> back and forth to the hardware. Note that the DMA is noncoherent.
What you are trying to do should work with dma_alloc_noncoherent(). The
API allows partial syncs on this memory, so you should be fine.
The problem with a devm variant of dma_map_* is that it is too easy to
misuse or to use it wrong so that a driver could eat up all available
DMA handles on some platforms.
Joerg
next prev parent reply other threads:[~2014-06-04 21:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-01 7:01 [PATCH v2 0/4] devres: dma-mapping: Introducing new functions Eli Billauer
2014-06-01 7:01 ` [PATCH v2 1/4] dma-mapping: Add devm_ interface for dma_map_single() Eli Billauer
2014-06-01 7:01 ` Eli Billauer
2014-06-03 21:24 ` Shuah Khan
[not found] ` <538E3D04.9060808-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-06-03 23:39 ` Joerg Roedel
2014-06-03 23:39 ` Joerg Roedel
2014-06-04 14:04 ` Tejun Heo
2014-06-04 14:04 ` Tejun Heo
[not found] ` <20140604140408.GC5004-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-06-04 14:12 ` Joerg Roedel
2014-06-04 14:12 ` Joerg Roedel
2014-06-04 14:14 ` Tejun Heo
2014-06-04 14:14 ` Tejun Heo
2014-06-04 15:03 ` Eli Billauer
2014-06-04 15:03 ` Eli Billauer
[not found] ` <538F3548.4050101-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-04 21:25 ` Joerg Roedel [this message]
2014-06-04 21:25 ` Joerg Roedel
[not found] ` <20140604212525.GE23880-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-06-06 11:45 ` Eli Billauer
2014-06-06 11:45 ` Eli Billauer
[not found] ` <5391A9C2.3040602-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-06 16:01 ` Greg KH
2014-06-06 16:01 ` Greg KH
[not found] ` <20140606160103.GG15110-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2014-06-06 16:21 ` Eli Billauer
2014-06-06 16:21 ` Eli Billauer
2014-06-06 17:02 ` Shuah Khan
2014-06-07 11:23 ` Eli Billauer
2014-06-07 11:23 ` Eli Billauer
2014-06-01 7:01 ` [PATCH v2 2/4] dma-mapping: Add devm_ interface for dma_map_single_attrs() Eli Billauer
2014-06-01 7:01 ` Eli Billauer
2014-06-01 7:01 ` [PATCH v2 3/4] dma-mapping: pci: Add devm_ interface for pci_map_single Eli Billauer
2014-06-01 7:01 ` [PATCH v2 4/4] staging: xillybus: Use devm_ API for memory allocation and DMA mapping Eli Billauer
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=20140604212525.GE23880@8bytes.org \
--to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
--cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
--cc=discuss-Wa75r+71Mmgdnm+yROfE0A@public.gmane.org \
--cc=eli.billauer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=shuah.kh-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 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.