lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 17 Apr 2008 08:30:29 -0400
From:	Neal Becker <ndbecker2@...il.com>
To:	linux-kernel@...r.kernel.org
Subject:  Re: [newb] mmap pci

Arjan van de Ven wrote:

> On Wed, 16 Apr 2008 07:23:29 -0400
> Neal Becker <ndbecker2@...il.com> wrote:
> 
>> We have a device - an FPGA board on PCI bus.  It has a range of
>> internal memory mapped to PCI.  I want to expose this to user via
>> mmap.  Is there some example code someone could point me to?
>> 
>> If this is not the best forum for such questions, what would be a
>> better choice?
> 
> Hi,
> 
> if it's just a PCI bar, you can already memory map it without even writing
> a driver! You can just use the sysfs files for this, for example
> /sys/devices/pci0000:00/0000:00:02.0/resource1
> 
> There's also a way to do this via the /proc representation of the PCI
> device..
> 
> Greetings,
>    Arjan van de Ven
> 
> 

Thanks!  Only problem: seems the mapping is read-only?
This python test code works if prot=mmap.PROT_READ, but I get
permission denied if PROT_READ|PROT_WRITE.

import mmap
import struct

f = open ('/sys/bus/pci/devices/0000:05:0f.0/resource0','rw')
m = mmap.mmap(f.fileno(), 1000000, prot=mmap.PROT_READ)


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ