Date: Fri, 01 Apr 2016 09:31:22 -0700 From: John Baldwin <jhb@freebsd.org> To: Luigi Rizzo <rizzo@iet.unipi.it> Cc: Ryan Stone <rysto32@gmail.com>, Jim Harris <jim.harris@gmail.com>, FreeBSD Current <freebsd-current@freebsd.org>, Giuseppe Lettieri <g.lettieri@iet.unipi.it>, Vincenzo Maffione <v.maffione@gmail.com> Subject: Re: accessing a PCIe register from userspace through kmem or other ways ? Message-ID: <5045119.GKNSyI10vh@ralph.baldwin.cx> In-Reply-To: <CA%2BhQ2%2BjeyVFp-bHckuLtBQ1VBkk%2BA86EvUyC%2BCB2ZZFiye6k1g@mail.gmail.com> References: <CA%2BhQ2%2BiU4odjhaNicFA4QjvSZR2OZOOy%2BFu4LTqsibdoK4M8zg@mail.gmail.com> <CAFMmRNxCHgRD4bUWwZiG%2B6HiLD2DxagFgHTGmH5jtRj%2BUEtJNA@mail.gmail.com> <CA%2BhQ2%2BjeyVFp-bHckuLtBQ1VBkk%2BA86EvUyC%2BCB2ZZFiye6k1g@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, April 01, 2016 01:07:55 PM Luigi Rizzo wrote: > On Thu, Mar 31, 2016 at 11:55 PM, Ryan Stone <rysto32@gmail.com> wrot= e: >=20 > > On Thu, Mar 31, 2016 at 4:39 PM, John Baldwin <jhb@freebsd.org> wro= te: > > > >> On Wednesday, March 30, 2016 11:20:51 AM Jim Harris wrote: > >> > On Wed, Mar 30, 2016 at 10:47 AM, Luigi Rizzo <rizzo@iet.unipi.i= t> > >> wrote: > >> > > >> > > Hi, > >> > > I'd like to test the rate at which I can access device registe= rs > >> > > on a PCIe card, and was wondering whether I need to patch a de= vice > >> > > driver, or perhaps I can use /dev/kmem once I figure out where= > >> > > the registers are mapped ? > >> > > > >> > > >> > You do not need to patch a device driver. Have you looked at > >> > libpciaccess? This should give you everything you need. > >> > >> You can also look at what pciconf uses. (It has a read_config() m= ethod > >> that uses an ioctl on an fd of /dev/pci). > >> > > > > pciconf can only access the configuration space, right? I believe = that > > Luigi is more interested in measuring the latency to a register map= ped from > > a BAR. > > >=20 > =E2=80=8BThank you all for you answers, I will look at libpciaccess. >=20 > Yes my goal is to look at the rate and latency for accessing > BAR-mapped registers Sorry, I mapped PCIe registers to the PCI-e config space register set. = I am not sure exactly how libpciaccess handles register access (perhaps it r= eads raw bars and maps them via /dev/mem)? However, it would not be hard to= a new ioctl to /dev/pci to allow one to mmap a specific BAR of a given de= vice. --=20 John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5045119.GKNSyI10vh>