linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Jim Deas <jdeas@jadsystems.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Prefered method to map PCI memory into userspace.
Date: 27 Sep 2003 00:03:42 +0200	[thread overview]
Message-ID: <p73ad8r5hs1.fsf@oldwotan.suse.de> (raw)
In-Reply-To: <1064609623.16160.11.camel@ArchiveLinux.suse.lists.linux.kernel>

Jim Deas <jdeas@jadsystems.com> writes:

> I am looking for the most current (blessed) structure
> for mapping PCI memory to a user process. One that allows
> both PIO and busmastering to work on a common block of
> PCI RAM. I am not concerned with backporting to older
> kernels but it would be nice if the solution wasn't ibm specific.

mmap on /dev/mem

PIO cannot be done on memory, for that you have to use iopl() 
or ioperm() to get access to the port and then issue the PIO 
instructions yourself

The only trap with the mapping is getting uncached mappings
(most PCI hardware prefers uncached accesses). When the mapping
is beyond the end of memory the kernel will automatically 
map it uncached. PCI mappings are normally in the PCI hole
at the end of the 4GB area. When you machine has more than
4GB of ram this heuristic does not work and you have 
set MTRRs by hand using /proc/mtrr or use O_SYNC. The later is 
cleanest, but only works in newer kernels.

[BTW I consider this a kernel bug - it should always map mappings
to non memory uncached] 


-Andi

       reply	other threads:[~2003-09-26 22:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1064609623.16160.11.camel@ArchiveLinux.suse.lists.linux.kernel>
2003-09-26 22:03 ` Andi Kleen [this message]
2003-09-27  4:01   ` Prefered method to map PCI memory into userspace David S. Miller
     [not found] ` <20030926211740.GA27352@tsunami.ccur.com.suse.lists.linux.kernel>
     [not found]   ` <1064623209.631.26.camel@gaston.suse.lists.linux.kernel>
     [not found]     ` <20030926210034.3a1b4de7.davem@redhat.com.suse.lists.linux.kernel>
2003-09-27  5:09       ` Andi Kleen
2003-09-27 23:39         ` David S. Miller
     [not found] <A8WS.6Uf.9@gated-at.bofh.it>
     [not found] ` <A8WR.6Uf.7@gated-at.bofh.it>
     [not found]   ` <Aezg.6hA.9@gated-at.bofh.it>
2003-09-27  4:42     ` Andi Kleen
2003-09-26 13:59       ` Anton Blanchard
2003-09-27 23:38         ` David S. Miller
2003-09-26 20:53 Jim Deas
2003-09-26 21:17 ` Joe Korty
2003-09-27  0:40   ` Benjamin Herrenschmidt
2003-09-27  4:00     ` David S. Miller

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=p73ad8r5hs1.fsf@oldwotan.suse.de \
    --to=ak@suse.de \
    --cc=jdeas@jadsystems.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).