linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Prefered method to map PCI memory into userspace.
  2003-09-27  4:42     ` Prefered method to map PCI memory into userspace Andi Kleen
@ 2003-09-26 13:59       ` Anton Blanchard
  2003-09-27 23:38         ` David S. Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Anton Blanchard @ 2003-09-26 13:59 UTC (permalink / raw)
  To: Andi Kleen; +Cc: David S. Miller, linux-kernel


> Just curious - what does the X server use on these many systems then ?

FYI ppc64 and some ppc32 systems fall into the cant use /dev/mem
category. The answer is to use pci domains (ie using /proc/bus/pci/...
to be able to mmap PCI memory and IO regions)

Anton

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
       [not found]   ` <Aezg.6hA.9@gated-at.bofh.it>
@ 2003-09-27  4:42     ` Andi Kleen
  2003-09-26 13:59       ` Anton Blanchard
  0 siblings, 1 reply; 11+ messages in thread
From: Andi Kleen @ 2003-09-27  4:42 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

"David S. Miller" <davem@redhat.com> writes:

> On 27 Sep 2003 00:03:42 +0200
> Andi Kleen <ak@suse.de> wrote:
>
>> 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
>
> Platform dependant, mmap on /dev/mem doesn't work on many systems.

Just curious - what does the X server use on these many systems then ?

-Andi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
  2003-09-26 13:59       ` Anton Blanchard
@ 2003-09-27 23:38         ` David S. Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David S. Miller @ 2003-09-27 23:38 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: ak, linux-kernel

On Fri, 26 Sep 2003 23:59:08 +1000
Anton Blanchard <anton@samba.org> wrote:

> 
> > Just curious - what does the X server use on these many systems then ?
> 
> FYI ppc64 and some ppc32 systems fall into the cant use /dev/mem
> category. The answer is to use pci domains (ie using /proc/bus/pci/...
> to be able to mmap PCI memory and IO regions)

Exactly.

XFREE86-4.3.0 and later has full domain infrastructure, it just isn't
enabled on anything other than ppc and sparc because the other platforms
haven't made their /proc/bus/pci/* mmap() arch support routines fully
functional yet.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
  2003-09-27  5:09       ` Andi Kleen
@ 2003-09-27 23:39         ` David S. Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David S. Miller @ 2003-09-27 23:39 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel

On 27 Sep 2003 07:09:01 +0200
Andi Kleen <ak@suse.de> wrote:

> "David S. Miller" <davem@redhat.com> writes:
> 
> > If someone is looking for something to do, it would be incredibly
> > value to make it so that all arches support this, and in particular
> > get right the case of mmap()'ing the PCI host bridge.
> > 
> > If this were done, the PCI domain code in xfree86 could be enabled
> > for all Linux platforms, not just the ones that have this implemented
> > properly.
> 
> What semantics would it have? Can the "seek offset" just be the 
> bus address?
> 
> If yes then it would be trivial to implement for x86/x86-64

I did everything for x86 already, egrep for "PCI_MMAP" under
arch/i386/.

The uncompleted part is the PCI host bridge mmap() support, I just
never got around to it.  Someone can easily complete it.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
       [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
  0 siblings, 1 reply; 11+ messages in thread
From: Andi Kleen @ 2003-09-27  5:09 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-kernel

"David S. Miller" <davem@redhat.com> writes:

> If someone is looking for something to do, it would be incredibly
> value to make it so that all arches support this, and in particular
> get right the case of mmap()'ing the PCI host bridge.
> 
> If this were done, the PCI domain code in xfree86 could be enabled
> for all Linux platforms, not just the ones that have this implemented
> properly.

What semantics would it have? Can the "seek offset" just be the 
bus address?

If yes then it would be trivial to implement for x86/x86-64

-andi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
  2003-09-26 22:03 ` Andi Kleen
@ 2003-09-27  4:01   ` David S. Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David S. Miller @ 2003-09-27  4:01 UTC (permalink / raw)
  To: Andi Kleen; +Cc: jdeas, linux-kernel

On 27 Sep 2003 00:03:42 +0200
Andi Kleen <ak@suse.de> wrote:

> 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

Platform dependant, mmap on /dev/mem doesn't work on many systems.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
  2003-09-27  0:40   ` Benjamin Herrenschmidt
@ 2003-09-27  4:00     ` David S. Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David S. Miller @ 2003-09-27  4:00 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: joe.korty, jdeas, linux-kernel

On Sat, 27 Sep 2003 02:40:10 +0200
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> mmap of /proc/bus/pci is a standard thing in 2.4 already and so in 2.6
> as well, though not all archs may implement it..

If someone is looking for something to do, it would be incredibly
value to make it so that all arches support this, and in particular
get right the case of mmap()'ing the PCI host bridge.

If this were done, the PCI domain code in xfree86 could be enabled
for all Linux platforms, not just the ones that have this implemented
properly.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
  2003-09-26 21:17 ` Joe Korty
@ 2003-09-27  0:40   ` Benjamin Herrenschmidt
  2003-09-27  4:00     ` David S. Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Benjamin Herrenschmidt @ 2003-09-27  0:40 UTC (permalink / raw)
  To: joe.korty; +Cc: Jim Deas, linux-kernel mailing list


> 
> Albert Cahalan wrote a patch, for 2.6, that makes mmappable all PCI device
> memory regions.  They show up as files in the appropriate subdirectories
> under /proc/bus/pci.  See http://lkml.org/lkml/2003/7/13/258 for the
> patch and details.

mmap of /proc/bus/pci is a standard thing in 2.4 already and so in 2.6
as well, though not all archs may implement it..

Regarding bus mastering, there's no way to do that without a kernel
driver.

Ben.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
       [not found] <1064609623.16160.11.camel@ArchiveLinux.suse.lists.linux.kernel>
@ 2003-09-26 22:03 ` Andi Kleen
  2003-09-27  4:01   ` David S. Miller
       [not found] ` <20030926211740.GA27352@tsunami.ccur.com.suse.lists.linux.kernel>
  1 sibling, 1 reply; 11+ messages in thread
From: Andi Kleen @ 2003-09-26 22:03 UTC (permalink / raw)
  To: Jim Deas; +Cc: 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Prefered method to map PCI memory into userspace.
  2003-09-26 20:53 Jim Deas
@ 2003-09-26 21:17 ` Joe Korty
  2003-09-27  0:40   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 11+ messages in thread
From: Joe Korty @ 2003-09-26 21:17 UTC (permalink / raw)
  To: Jim Deas; +Cc: linux-kernel

On Fri, Sep 26, 2003 at 01:53:43PM -0700, Jim Deas wrote:
> 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.
> 
> My problem is a 64M window into a frame buffer that I would
> like to map into user space. I am more than willing to put
> forth the effort, I just want to make sure I'm heading in
> the right direction.
> 
> Is there a better forum for posting this? Regards,
> J. Deas
> 
> RH9.0 2.4.20-6smp kernel and above.

Albert Cahalan wrote a patch, for 2.6, that makes mmappable all PCI device
memory regions.  They show up as files in the appropriate subdirectories
under /proc/bus/pci.  See http://lkml.org/lkml/2003/7/13/258 for the
patch and details.

Joe

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Prefered method to map PCI memory into userspace.
@ 2003-09-26 20:53 Jim Deas
  2003-09-26 21:17 ` Joe Korty
  0 siblings, 1 reply; 11+ messages in thread
From: Jim Deas @ 2003-09-26 20:53 UTC (permalink / raw)
  To: linux-kernel

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.

My problem is a 64M window into a frame buffer that I would
like to map into user space. I am more than willing to put
forth the effort, I just want to make sure I'm heading in
the right direction.

Is there a better forum for posting this? Regards,
J. Deas

RH9.0 2.4.20-6smp kernel and above.


-- 
Jim Deas <jdeas@jadsystems.com>
JAD Systems


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-09-27 23:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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     ` Prefered method to map PCI memory into userspace Andi Kleen
2003-09-26 13:59       ` Anton Blanchard
2003-09-27 23:38         ` David S. Miller
     [not found] <1064609623.16160.11.camel@ArchiveLinux.suse.lists.linux.kernel>
2003-09-26 22:03 ` Andi Kleen
2003-09-27  4:01   ` 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
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

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).