From owner-freebsd-emulation@FreeBSD.ORG Wed Oct 1 05:44:49 2014 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE6B71F3F for ; Wed, 1 Oct 2014 05:44:49 +0000 (UTC) Received: from mail-ie0-x22f.google.com (mail-ie0-x22f.google.com [IPv6:2607:f8b0:4001:c03::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 82A1C8C0 for ; Wed, 1 Oct 2014 05:44:49 +0000 (UTC) Received: by mail-ie0-f175.google.com with SMTP id y20so99209ier.34 for ; Tue, 30 Sep 2014 22:44:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=84EYYejXN+tTOynqeDutnfOiNKxBwrZC6muzZXGkWV8=; b=u4WGgQOpzU/XZ1SHC4wyOTSEsI5+4Em1xU4uyJERTue4ycrOXiK8r9TgqpXmkutmDV fbZ04/WGGqBbEekcXrsU2kXJLgTGz0M2aoLDDlOv2JkaHhgk6UOfF3PkyRk1ZIfVD56h Fbq/CPEKN86J7V0SPBk3fRNuBfqFL/aJM59fyTTvAL6adu+uGilTK7PFBu01Z2ClUK6y ImIV/tqio7XOiNAHLOOTvqqHroD03NAoExvIG88mL+mTo6ky/fH6qcIPg2EEMqtUv7dc xuZaoieNnvQheMKgIu7QjoPxtA6OIoxsAbyBnMJssM4NMBjoPYFlK46pHPq5vY16T8kR A9Rw== MIME-Version: 1.0 X-Received: by 10.43.115.9 with SMTP id fc9mr52424275icc.37.1412142288886; Tue, 30 Sep 2014 22:44:48 -0700 (PDT) Received: by 10.50.2.69 with HTTP; Tue, 30 Sep 2014 22:44:48 -0700 (PDT) Date: Wed, 1 Oct 2014 15:44:48 +1000 Message-ID: Subject: does linsysfs support mmap on pci resources (e.g. pci device's registers etc.) From: leon zadorin To: freebsd-emulation@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2014 05:44:49 -0000 Hello everyone, Sorry if this is a bit of a noob question -- I'm just starting on this topic... does FreeBSD's emulation of sysfs (from linux world) support "mmap" on pci resources? Something similar to the following in the linux environment: fd = open("/sys/devices/pci0001\:00/0001\:00\:07.0/resource0", O_RDWR | O_SYNC); ptr = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); printf("PCI BAR0 0x0000 = 0x%4x\n", *((unsigned short *) ptr); (above taken from http://billfarrow.blogspot.com.au/2010/09/userspace-access-to-pci-memory.html) The reason I am asking is because I would like to map pci device registers/memory in user space (and read/write some of the device's registers from userspace). The reasons are auxiliary to this post (e.g. kernel-bypass, system call bypass, etc.) At this stage it would suffice to simply accept that user space pci-register access is needed without paying the price of any system/ioctl/etc. call on every access-instance to device's config/control register(s). I would prefer to avoid writing additional explicit (albeit generic) pci related kernel module in order to provide "mmapping" of the given pci resources to userspace if there is already such a generic way to do it via sysfs "syntax" (I would like to reduce any of the specific/additional code re-writing at the kernel level as much as possible). many thanks leon.