<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 20, 2015 at 8:17 PM, Greg KH <span dir="ltr">&lt;<a href="mailto:greg@kroah.com" target="_blank">greg@kroah.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Oct 20, 2015 at 07:40:37PM -0400, Kenneth Adam Miller wrote:<br>
&gt;<br>
&gt; On Tue, Oct 20, 2015 at 6:54 PM, Greg KH &lt;<a href="mailto:greg@kroah.com">greg@kroah.com</a>&gt; wrote:<br>
&gt;<br>
&gt;     On Tue, Oct 20, 2015 at 11:58:21AM -0400, Kenneth Adam Miller wrote:<br>
&gt;     &gt; So I&#39;m building a uio kernel driver with buildroot, and I&#39;ve gotten the<br>
&gt;     driver<br>
&gt;     &gt; to compile, installed it and can insmod it in the final buildroot target<br>
&gt;     after<br>
&gt;     &gt; booting the image with QEMU.<br>
&gt;     &gt;<br>
&gt;     &gt; I&#39;m on linux kernel version 3.14, and I followed the guide here:<br>
&gt;     &gt;<br>
&gt;     &gt; <a href="https://www.kernel.org/doc/htmldocs/uio-howto/userspace_driver.html" rel="noreferrer" target="_blank">https://www.kernel.org/doc/htmldocs/uio-howto/userspace_driver.html</a><br>
&gt;     &gt;<br>
&gt;     &gt; And it describes the location on where the device file that should be<br>
&gt;     opened by<br>
&gt;     &gt; userland code as either one of two locations:<br>
&gt;     &gt;<br>
&gt;     &gt; /dev/uioX, with X being a number<br>
&gt;     &gt;<br>
&gt;     &gt; or /sys/class/uio/uioX<br>
&gt;     &gt;<br>
&gt;     &gt; But the each of following returns nothing:<br>
&gt;     &gt;<br>
&gt;     &gt; ls /dev/uio*<br>
&gt;     &gt; ls /sys/class/uio/<br>
&gt;     &gt;<br>
&gt;     &gt; After I compile the uio example that is provided in the linux source at<br>
&gt;     source/<br>
&gt;     &gt; drivers/uio/uio.c and uio_dmem_genirq.c, and insmod them, I do modprobe<br>
&gt;     uio and<br>
&gt;     &gt; modprobe uio_dmem_genirq and each of those return nothing. However, I do<br>
&gt;     see<br>
&gt;     &gt; that /sys/modules/uio and /sys/modules/uio_dmem_genirq <br>
&gt;<br>
&gt;     uio.ko is the uio &quot;core&quot;, you need a uio driver in order to actually use<br>
&gt;     it.<br>
&gt;<br>
&gt;     uio_dmem_genirq is a uio driver, have you added the needed device tree<br>
&gt;     entries to have it actually create a device for you?  Without them, this<br>
&gt;     driver can not find any hardware to bind to, and as such, no device node<br>
&gt;     will ever be created.<br>
&gt;<br>
&gt;<br>
&gt; I didn&#39;t know about that. How do I do that? I&#39;m using buildroot; I guess<br>
&gt; there&#39;s something missing in menuconfig or linux-menuconfig.<br>
<br>
</div></div>Um, no, device tree doesn&#39;t have anything to do with buildroot, other<br>
than the fact that you need such a thing for your platform to work<br>
properly.<br></blockquote><div><br></div><div>Well, often there are options and relation configurations that are implicitly required by the target development objective that have to be enabled by buildroot. For instance, right now I&#39;m using devtempfs, and I know that because one of the things I considered was that it was possible that it was a silent failure on the part of the module insertion that it wasn&#39;t creating the current /dev entry because it was static. But I followed up in buildroot to make sure that I had it.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
&gt;     I would suggest reading the UIO documentation, it should explain all of<br>
&gt;     this for you already.  If not, specific questions are always gladly<br>
&gt;     answered.<br>
&gt;<br>
&gt;<br>
&gt; The one that I linked? I read that repeatedly. What other documentation is<br>
&gt; there to read? I also read from Essential Linux Device Drivers, and none of<br>
&gt; them explained that. There has to be something I&#39;m missing. <br>
<br>
</span>Step back, what exactly are you trying to do here that you think UIO is<br>
the answer?  Where is the uio driver that you want to run for your<br>
hardware platform?  UIO is a _very_ hardware-specific solution to a<br>
_very_ specific problem that people have, are you sure it&#39;s what you<br>
need?<br>
<br></blockquote><div><br></div><div>Right now, we are building a security solution that requires that communication be fully isolated by subject. We don&#39;t have special devices, we actually have very special, extra security software that we&#39;re trying to support. One of those is a permissions capability that can be set beneath the guest that determines what memory can be observed or written to. If a violation occurs, the guest is killed. We like this model because only the data makes it through. The problem with doing it the old way was 1) it was too slow. 2) it was very hard to write in a kernel module context, and therefore it was overkill 3) all we really wanted was to facilitate the ability to access special limited access memory. </div><div><br></div><div>So effectively, we are moving code that is currently in a driver, out of a driver. In fact, all we want to do is map memory into user space, and then access that memory as though it were an array in the user land code.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
thanks,<br>
<br>
greg k-h<br>
</blockquote></div><br></div></div>