public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Christoph Hellwig <hch@infradead.org>,
	William Lee Irwin III <wli@holomorphy.com>,
	rmk@arm.linux.org.uk, Andrew Morton <akpm@osdl.org>,
	Andrea Arcangeli <andrea@suse.de>,
	linux-kernel@vger.kernel.org
Subject: Re: can device drivers return non-ram via vm_ops->nopage?
Date: Sun, 21 Mar 2004 17:17:39 -0500	[thread overview]
Message-ID: <405E1483.5060001@pobox.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0403211349340.1106@ppc970.osdl.org>

I wonder if we could jump back a step...

Years ago, I wanted to avoid remap_page_range() when I was writing 
via82cxxx_audio.c, and so Linus suggested the ->nopage approach (which I 
liked, and which is still present today in the sound/oss dir).

AFAICS device drivers have three needs that keep getting reinvented over 
and over again, WRT mmap(2):
1) letting userspace directly address a region allocated by the kernel 
DMA APIs
2) ditto, for MMIO (ioremap)
3) ditto, for PIO (inl/outl)

Alas, #3 must be faked on x86[-64], but this is done anyway for e.g. 
mmap'd PCI config access.  Many platforms implement in[bwl] essentially 
as read[bwl], so for them mmap'd PIO is easy.

#1-3 above are really what device drivers want to do.  My 
suggestion/request to the VM wizards would be to directly provide mmap 
helpers for dma/mmio/pio, that Does The Right Thing.  And require their 
use in every driver.  Don't give driver writers the opportunity to think 
about this stuff and/or screw it up.

If there are special DMA requirements of a particular bus or platform, 
hide that in there.  If some methods of DMA or MMIO or PIO do not lend 
themselves to directly mapping to a struct page, the MM guys may dicker 
about the interface, but the device driver guys just want #1-3 and don't 
really care :)  Either it's directly addressible [via some page table 
magic] from userland, or it isn't.

So please forgive the tangent, but this thread is IMO talking more about 
implementation than the real problem :)  pci_dma_mmap() helper or 
something like it should be the only thing the driver should care about. 
  I'm tired of the same platform bugs and issues, in mmap handlers, 
reappearing over and over again...  Tired of platform-specific ifdefs in 
mmap-capable drivers, too.

	Jeff




  reply	other threads:[~2004-03-21 22:19 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-20 13:30 can device drivers return non-ram via vm_ops->nopage? Andrea Arcangeli
2004-03-20 14:40 ` William Lee Irwin III
2004-03-20 15:06   ` Andrea Arcangeli
2004-03-20 15:27     ` William Lee Irwin III
2004-03-20 15:44     ` Russell King
2004-03-20 15:57       ` Andrea Arcangeli
2004-03-20 16:15         ` Russell King
2004-03-20 16:25           ` Andrea Arcangeli
2004-03-20 16:57             ` William Lee Irwin III
2004-03-20 17:48             ` Andrea Arcangeli
2004-03-20 19:03               ` Andrea Arcangeli
2004-03-20 15:58       ` Jaroslav Kysela
2004-03-20 16:09         ` Russell King
2004-03-20 19:44           ` Jaroslav Kysela
2004-03-20 22:23             ` Russell King
2004-03-20 22:45               ` William Lee Irwin III
2004-03-20 23:54                 ` Russell King
2004-03-21  0:22                   ` Zwane Mwaikambo
2004-03-22  4:46                     ` Benjamin Herrenschmidt
2004-03-22 18:23                       ` Richard Curnow
2004-03-21  0:23                   ` William Lee Irwin III
2004-03-21  9:52                   ` Arjan van de Ven
2004-03-21 10:39                   ` Jaroslav Kysela
2004-03-22  4:43             ` Benjamin Herrenschmidt
2004-03-20 20:13     ` Andrew Morton
2004-03-20 20:28       ` Andrea Arcangeli
2004-03-20 20:50       ` William Lee Irwin III
2004-03-20 22:26         ` Russell King
2004-03-20 22:45           ` William Lee Irwin III
2004-03-21 20:45             ` David Woodhouse
2004-03-21 20:49               ` Christoph Hellwig
2004-03-21 20:57                 ` David Woodhouse
2004-03-21 21:53                   ` Linus Torvalds
2004-03-21 22:17                     ` Jeff Garzik [this message]
2004-03-21 22:23                     ` David Woodhouse
2004-03-21 22:23                     ` Russell King
2004-03-21 22:34                       ` Jeff Garzik
2004-03-21 22:42                         ` David Woodhouse
2004-03-21 23:06                           ` Jeff Garzik
2004-03-21 22:51                         ` Russell King
2004-03-21 23:09                           ` Jeff Garzik
2004-03-21 23:11                           ` Linus Torvalds
2004-03-21 23:22                             ` Jeff Garzik
2004-03-21 23:51                               ` Linus Torvalds
2004-03-21 23:58                                 ` Russell King
2004-03-22  0:34                                   ` Andrea Arcangeli
2004-03-22  3:05                                     ` Linus Torvalds
2004-03-23 17:59                                   ` Andy Whitcroft
2004-03-23 17:58                                     ` David Woodhouse
2004-03-23 18:11                                     ` William Lee Irwin III
2004-03-22  0:02                                 ` David Woodhouse
2004-03-22  3:28                                   ` Linus Torvalds
2004-03-22  0:10                                 ` Jeff Garzik
2004-03-22  0:20                                   ` Russell King
2004-03-22  0:33                                     ` Jeff Garzik
2004-03-22  4:57                                     ` Benjamin Herrenschmidt
2004-03-21 23:45                             ` Russell King
2004-03-22  0:23                               ` William Lee Irwin III
2004-03-22  0:29                                 ` Jeff Garzik
2004-03-22  1:28                                   ` William Lee Irwin III
2004-03-22  6:36           ` William Lee Irwin III
2004-03-20 17:39 ` Linus Torvalds
2004-03-20 17:56   ` Andrea Arcangeli
2004-03-20 18:22   ` William Lee Irwin III
2004-03-21  3:13   ` Chris Wedgwood
2004-03-21  6:23     ` Christoph Hellwig
2004-03-21  7:00       ` Chris Wedgwood

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=405E1483.5060001@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=dwmw2@infradead.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=torvalds@osdl.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