Re: Special handling of sysfs device resource files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday, April 11, 2006 4:59 pm, Ian Romanick wrote:
> Ian Romanick wrote:
> > I'm in the process of modifying X to be civilized in it's handling
> > of PCI devices on Linux.  As part of that, I've modified it to map
> > the /sys/bus/pci/device/*/resource[0-6] files instead of mucking
> > about with /dev/mem.
> >
> > This seems to mostly work, but I am having one problem.  I map the
> > region by opening the file with O_RDWR, then mmap with
> > (PROT_READ|PROT_WRITE) and MAP_SHARED.  In all cases, the open and
> > mmap succeed.  However, for I/O BARs, the resulting pointer from
> > mmap is invalid.  Any access to it results in a segfault and GDB
> > says it's "out of range".
>
> I was a little mistaken about this.  The BAR that causes the problem
> is not I/O.  It *is* memory.
>
> 01:00.0 VGA compatible controller: Matrox Graphics, Inc. G400/G450
> (rev 03) (prog-if 00 [VGA])
>         Subsystem: Matrox Graphics, Inc. Millennium G400 16Mb SGRAM
>         Flags: bus master, medium devsel, latency 64, IRQ 11
>         Memory at cc000000 (32-bit, prefetchable) [size=32M]
>         Memory at cfefc000 (32-bit, non-prefetchable) [size=16K]
>         Memory at cf000000 (32-bit, non-prefetchable) [size=8M]
>         Expansion ROM at cfee0000 [disabled] [size=64K]
>
> When I open and mmap resource0 (the framebuffer) I get 0x2b9aa48ea000.
> When I open and mmap resource1 (the card's registers) I get
> 0x2b9aa68ea000.  I can access the resource0 pointer all day long
> without problems.  The firs access to the resource1 pointer results in
> a segfault.

Hm, that's strange.  On my via machine I can access all my VGA resources 
correctly, but that's not x86-64.  Maybe the x86-64 implementation of 
pci_mmap_page_range is doing the wrong thing for uncacheable, non-WC 
regions somehow?

Jesse
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux