public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Hans J. Koch" <hjk@linutronix.de>
To: "Hans J. Koch" <hjk@linutronix.de>
Cc: Leon Woestenberg <leon.woestenberg@gmail.com>,
	Tom Lyon <pugs@cisco.com>,
	mst@redhat.com, gregkh@suse.de, chrisw@sous-sol.org,
	joro@8bytes.org, avi@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: UIO DMA to userspace question
Date: Tue, 10 Aug 2010 02:12:44 +0200	[thread overview]
Message-ID: <20100810001244.GD2569@local> (raw)
In-Reply-To: <20100809111155.GB2569@local>

On Mon, Aug 09, 2010 at 01:11:56PM +0200, Hans J. Koch wrote:
> On Sat, Aug 07, 2010 at 08:38:30PM +0200, Leon Woestenberg wrote:
> > Hello all,
> > 
> > can I use the UIO framework for the following?
> > 
> > The userspace portion of the driver allocates memory in user-space
> > using malloc() - usually resulting in a scatter pages in physical
> > memory.
> > The UIO kernel portion of the driver maps those using pci_map_sg().
> > 
> > Is this possible, or does the UIO framework assume memory for DMA is
> > allocated in kernel space?
> 
> You would have to write your own mmap() function and and set the pointer
> to it in struct uio_info->mmap. Have a look at uio_mmap() in

A few more thoughts about that: The UIO core currently doesn't support
dynamically allocated memory. That means, even if you manage to mmap your
memory allocated in userspace, it won't show up in sysfs. ATM, all UIO
supports is memory allocated at device creation time in kernel space.

So, what your trying to do is something that could probably work. The
uio_info->mmap pointer was made for unusual mappings. But it still causes
me some headaches. I'm not sure if this can be considered a clean solution.
An extension that makes UIO deal properly with dynamically allocated (DMA-)
memory would certainly be preferable.

Hans


  reply	other threads:[~2010-08-10  0:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-07 18:38 UIO DMA to userspace question Leon Woestenberg
2010-08-09 11:11 ` Hans J. Koch
2010-08-10  0:12   ` Hans J. Koch [this message]
2010-08-11 18:42     ` Leon Woestenberg
2010-08-12  0:14       ` Hans J. Koch
2010-08-15 11:33 ` Avi Kivity

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=20100810001244.GD2569@local \
    --to=hjk@linutronix.de \
    --cc=avi@redhat.com \
    --cc=chrisw@sous-sol.org \
    --cc=gregkh@suse.de \
    --cc=joro@8bytes.org \
    --cc=leon.woestenberg@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pugs@cisco.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