Date: Sat, 17 Jan 2015 10:34:53 +1100 From: Johny Mattsson <johny.mattsson+fbsd@gmail.com> To: Ian Lepore <ian@freebsd.org> Cc: freebsd-arm@freebsd.org Subject: Re: mmap-issue Message-ID: <CAGW5k5YqK-xP_erf6H2XXUKmX8Dkbex81SYC5am5saAAqRfp8A@mail.gmail.com> In-Reply-To: <1421432019.14601.302.camel@freebsd.org> References: <54B945FB.10609@freenet.de> <1421432019.14601.302.camel@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 17 January 2015 at 05:13, Ian Lepore <ian@freebsd.org> wrote: > My gut-level reply is "Don't try to access hardware registers like that, > you're only going to run into problems" (as you already have). But I've > just been informed that linux allows such things. Indeed it does, and what a life^Wproject-saver it can be! Only last year I had to deal with an existing large-scale deployment (100,000s of devices) where a peripheral on the SPI bus had a hardware bug where it could intermittently "lose" a clock pulse and get itself completely out of sync on the bus. Being able to quietly pull the SPI control from the driver and do a little dance on the clock and data lines in GPIO mode before returning control to the driver saved the day on that one. A few years before that, we had some extremely performance sensitive network I/O to deal with, where we effectively had a driver stub which allocated the resources and then allowed them to be mmap()ed into userspace for direct hardware control. Given the complexity of the system, it wasn't considered viable to have this processing done in the kernel. Another case is the Linux Raspberry Pi userpace library libbcm2835 which provides gpio control (among other things), similar to what you'd get normally through /sys/class/gpio but with two major distinctions: (a) it provides access to pull-up/downs, which is not normally available in Linux, and (b) it provides a whole different level of performance compared to going through the kernel. > It seems crazy to me > to allow userland access to the same hardware that freebsd drivers are > trying to work with. > Absolutely, and you can't complain if things break when you do. But having the ability to pull stunts like this is gold. Cheers, /Johny
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGW5k5YqK-xP_erf6H2XXUKmX8Dkbex81SYC5am5saAAqRfp8A>