From owner-freebsd-current@freebsd.org Thu Mar 31 21:53:10 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6212DAE476E for ; Thu, 31 Mar 2016 21:53:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42A241C81 for ; Thu, 31 Mar 2016 21:53:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E61B8B988; Thu, 31 Mar 2016 17:53:08 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Cc: Jim Harris , Luigi Rizzo Subject: Re: accessing a PCIe register from userspace through kmem or other ways ? Date: Thu, 31 Mar 2016 13:39:25 -0700 Message-ID: <2550091.UENsv0ilXD@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 31 Mar 2016 17:53:09 -0400 (EDT) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2016 21:53:10 -0000 On Wednesday, March 30, 2016 11:20:51 AM Jim Harris wrote: > On Wed, Mar 30, 2016 at 10:47 AM, Luigi Rizzo wrote: > > > Hi, > > I'd like to test the rate at which I can access device registers > > on a PCIe card, and was wondering whether I need to patch a device > > 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() method that uses an ioctl on an fd of /dev/pci). -- John Baldwin