From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Vijay Kumar <vijaykumar@bravegnu.org>
Cc: "J.R. Mauro" <jrm8005@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
Paul Mackerras <paulus@samba.org>, Greg KH <greg@kroah.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
LKML <linux-kernel@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"William L. Irwin" <wli@holomorphy.com>,
jayakumar.lkml@gmail.com, sparclinux@vger.kernel.org
Subject: Re: sparc/staging compile error
Date: Sat, 08 Nov 2008 10:06:32 +1100 [thread overview]
Message-ID: <1226099192.13603.78.camel@pasglop> (raw)
In-Reply-To: <4913FEE1.9030807@bravegnu.org>
> May be the code is not doing what is supposed to do, but here is what the
> driver is trying to achieve:
>
> The driver allocates a set of buffers for DMA. These buffers are mapped
> into user space, when the user does an mmap. In transmit, when the user
> space writes to these buffers, the data has to reach physical memory so
> that the device can access them. For receive, the cache has to be
> invalidated before the user space reads the buffer.
>
> Do let me know if further clarification is required. Any inputs and
> suggestions are welcome.
Well, this is the wrong API to do that. First, some platforms are cache
coherent and thus don't need anything there other than maybe a barrier.
Then, the dma_* API is what you want to ensure cache coherency with DMA
transfers within the kernel.
If userspace can directly trigger DMA from pre-allocated buffers, then
doing an ioctl to sync is a major wastage, since most platforms are
cache coherent (and thus don't need it) and those who are not generally
provide user-space accessible ways of doing the flush to some extent
(not all, for example, BookE PPC cannot invalidate the data cache from
userspace, only flush it).
In any case, we would need to understand better your driver userspace
API and transfer model to find the right solution.
Ben.
next prev parent reply other threads:[~2008-11-07 23:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 5:36 sparc/staging compile error Stephen Rothwell
2008-11-06 6:37 ` Greg KH
2008-11-06 6:39 ` David Miller
2008-11-06 10:32 ` Paul Mackerras
2008-11-06 14:06 ` J.R. Mauro
2008-11-06 17:32 ` Christoph Hellwig
2008-11-06 17:36 ` J.R. Mauro
2008-11-07 8:40 ` Vijay Kumar
2008-11-07 23:06 ` Benjamin Herrenschmidt [this message]
2008-11-11 6:58 ` Vijay Kumar
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=1226099192.13603.78.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=greg@kroah.com \
--cc=hch@infradead.org \
--cc=jayakumar.lkml@gmail.com \
--cc=jrm8005@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=sfr@canb.auug.org.au \
--cc=sparclinux@vger.kernel.org \
--cc=vijaykumar@bravegnu.org \
--cc=wli@holomorphy.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