From owner-freebsd-current@freebsd.org Fri Apr 1 16:48:25 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 9D9BAAEAE10 for ; Fri, 1 Apr 2016 16:48:25 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) (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 66BF21011; Fri, 1 Apr 2016 16:48:25 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by mail-io0-x241.google.com with SMTP id e3so18630052ioa.3; Fri, 01 Apr 2016 09:48:25 -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=QRnaavI5AS9w07bLm24oz2gxpmfLqEMq8Aa1y5Dmgdg=; b=Yz3/1KwsUfUOnn4cmtbmDj9tYlD2BH6EOMC/Btk2QH8YSv+AqzW4DkNWZxnqzMgFPt oyBr7RuptAUf6/zBNX5Yi9lG4W9qnnj4hsYIdCyXuaSRKCvtaJ40/859nT2GAR8IeCpr RQpDMV2C84D9fitAEiO7WKJDxhrc0xT6sIRItSIryJJKrp6LQTDui34Uzo4j49wAtUL5 U2jMFIagVRyhKKl/aXqazBDwy9B93jMyPwUwiQ3AmYkUjwmvv3Mgokgla7zU1FikyPS+ zU6pRB9OTXNiUB/LhH82rUhBa7KKB9z9zIdSgNgelEdTkUBu7XKNlROeT2OmmInc2zOH 2sUw== 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=QRnaavI5AS9w07bLm24oz2gxpmfLqEMq8Aa1y5Dmgdg=; b=LPZ68Nd0uKN8V6mk5hAIgXeE0X0Uh5miGp8XGwQYUlW2E4BfUvQh+nch4w7pWibR8o xdhdF8hiVS4B9BSODtCWg5+KzDGG8LpgwyXPvPKALMUDchq4P2IZNL+rNGpLNaZl3i9D zUdh0c1IOCPbh6jTm6nsuQgI6oZJ1pWr8et0hcl1R+ess5yek8FDrtu8AiLrIo/mb3js U10wxSJdSnJNZCH8lBkZgER1739gLG2s8573hf1qvIHkVNwxysb8Yt/RDwckfrgi8TAS +MG7cRkuaCqt/4bjneDGWHh1kHw31dx7Js6D4EAgsynyNMQJwvUv99tWqoSvR/9IQ6SC G7Uw== X-Gm-Message-State: AD7BkJKa8dyqZ/0F4vwXS2kZrTgcgyMWpltPINVDYQad/EZz8wz6PgmsC4PrQJJ5AXWalgNSgrWBJ/HT8C8+bw== MIME-Version: 1.0 X-Received: by 10.107.159.137 with SMTP id i131mr5879884ioe.29.1459529304861; Fri, 01 Apr 2016 09:48:24 -0700 (PDT) Received: by 10.107.153.206 with HTTP; Fri, 1 Apr 2016 09:48:24 -0700 (PDT) In-Reply-To: <5045119.GKNSyI10vh@ralph.baldwin.cx> References: <5045119.GKNSyI10vh@ralph.baldwin.cx> Date: Fri, 1 Apr 2016 12:48:24 -0400 Message-ID: Subject: Re: accessing a PCIe register from userspace through kmem or other ways ? From: Ryan Stone To: John Baldwin Cc: Luigi Rizzo , Jim Harris , FreeBSD Current , Giuseppe Lettieri , Vincenzo Maffione 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: Fri, 01 Apr 2016 16:48:25 -0000 On Fri, Apr 1, 2016 at 12:31 PM, John Baldwin wrote: > 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 reads > 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 > device. > That is actually a really good question. I know that with some recent BIOSes if I enabled allocating 64-bit addresses to BARs, the BAR would actually be mapped outside of the range of /dev/mem. From a quick glance at libpciaccess, I don't think that it handles this case. A specific mechanism for allowing mmaping of BARs would be useful, I think.