From owner-freebsd-current@freebsd.org Thu Mar 31 21:55:47 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 36E3EAE488A for ; Thu, 31 Mar 2016 21:55:47 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 019881E1D; Thu, 31 Mar 2016 21:55:47 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by mail-io0-x244.google.com with SMTP id g185so15645811ioa.0; Thu, 31 Mar 2016 14:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=iJbrvHtsj4KzAN0WKPQhwIqvL0ZIqPR+teH5WnLiy5I=; b=twNBRnFm2sqYPxMIhfzdiN00yMVAxh5DpC4Wz1RDVx5XW9UFQh2s7GwwHhc22yXH7L 49qFrR211V2NPvys0OiIhHveyXdhSkhZiu9ryBDEwLd8OKcVqYfqdC3ssm1WXgvMm1kg lRm4FO+ZCGxE3a2rnPUOtfGJ6AvbeIGshRPipibOc+RHIHJiXniL3vcIvdBld7lWtpnm yO9xdKfnuxk+IqnN6/p/2DFrHQBWW2ZeQyJOK32ylRIh0Xr6je6db8u+Lj4e7y8Oz7rk zn4+82Wz0Z5zwZrAJ29rvPnaYNogSqdwZnLYITzseXqvy+JEP9HhWWU+t1mkv10+EfaD P19w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=iJbrvHtsj4KzAN0WKPQhwIqvL0ZIqPR+teH5WnLiy5I=; b=ZbzcGQFMXQ7Ow36wrACKTXYQzF955sWOLn9L6OZxlrE41/d0oY7otXP++X395da1kB Z0j3qFNhM002wb+lsSjgfITbFFXmopWghJtjcXGQjk1MvJJ4qa40PWLkCmf84A1AU3fX PYEWAn2DSxNUm9FoZGAfSZuhLU00wes/RYKKW4fWAB7YUudOsX+4zbAmxvHUDbc/aSDU fvphw+Iu1u77U0dNMYi37fNgUAErPZi/OQB2VI0jqgCEjpgQxg3knSmYZh1dsM9kOgOW 6UhVdfInJDrQe8vACJBifKrN6CCLnq4O6Tp+GYf7vP+yEUNeMk0zfpZnZfezSIrBKefJ 2AWw== X-Gm-Message-State: AD7BkJIG9VUz9VW3Uo/jLz0xMcifZNeGpkzJ5rg3Zg2KQXMVKhZCBKWVv5B2/qqPngXnSAELs+8f5JXM6bDXfQ== MIME-Version: 1.0 X-Received: by 10.107.159.137 with SMTP id i131mr1517614ioe.29.1459461346468; Thu, 31 Mar 2016 14:55:46 -0700 (PDT) Received: by 10.107.153.206 with HTTP; Thu, 31 Mar 2016 14:55:46 -0700 (PDT) In-Reply-To: <2550091.UENsv0ilXD@ralph.baldwin.cx> References: <2550091.UENsv0ilXD@ralph.baldwin.cx> Date: Thu, 31 Mar 2016 17:55:46 -0400 Message-ID: Subject: Re: accessing a PCIe register from userspace through kmem or other ways ? From: Ryan Stone To: John Baldwin Cc: FreeBSD Current , Jim Harris , Luigi Rizzo Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 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:55:47 -0000 On Thu, Mar 31, 2016 at 4:39 PM, John Baldwin wrote: > 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). > pciconf can only access the configuration space, right? I believe that Luigi is more interested in measuring the latency to a register mapped from a BAR.