Re: [PATCH RFC] UIO: Pass information about ioports to userspace

Greg KH
2008-11-24T01:45:24Z

On Sun, Nov 23, 2008 at 01:14:20PM +0100, Hans J. Koch wrote:
> Devices sometimes have memory where all or parts of it can not be mapped to
> userspace. But it might still be possible to access this memory from
> userspace by other means. An example are PCI cards that advertise not only
> mappable memory but also ioport ranges. On x86 architectures, these can be
> accessed with ioperm, iopl, inb, outb, and friends. Mike Frysinger (CCed)
> reported a similar problem on Blackfin arch where it doesn't seem to be easy
> to mmap non-cached memory but it can still be accessed from userspace.
>
> This patch allows kernel drivers to pass information about such ports to
> userspace. Similar to the existing mem[] array, it adds a port[] array to
> struct uio_info. Each port range is described by start, size, and porttype.
>
> If a driver fills in at least one such port range, the UIO core will simply
> pass this information to userspace by creating a new directory "portio"
> underneath /sys/class/uio/uioN/. Similar to the "mem" directory, it will
> contain a subdirectory (portX) for each port range given.

This is good, but it would really be nice to provide a way for userspace
to access individual ports without having to have access to all ports in
the system. Lots of times we don't want to give root privileges to some
programs that only need to read and write simple data to a single
device.

thanks,

greg k-h