<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/uio_driver.h, branch v4.14.148</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.14.148</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.14.148'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2019-02-15T07:09:14Z</updated>
<entry>
<title>uio: change to use the mutex lock instead of the spin lock</title>
<updated>2019-02-15T07:09:14Z</updated>
<author>
<name>Xiubo Li</name>
<email>xiubli@redhat.com</email>
</author>
<published>2019-02-13T16:29:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3f400c2c2e7043b64c65d9b8709a0b353e1f8384'/>
<id>urn:sha1:3f400c2c2e7043b64c65d9b8709a0b353e1f8384</id>
<content type='text'>
commit 543af5861f41af0a5d2432f6fb5976af50f9cee5 upstream.

We are hitting a regression with the following commit:

commit a93e7b331568227500186a465fee3c2cb5dffd1f
Author: Hamish Martin &lt;hamish.martin@alliedtelesis.co.nz&gt;
Date:   Mon May 14 13:32:23 2018 +1200

    uio: Prevent device destruction while fds are open

The problem is the addition of spin_lock_irqsave in uio_write. This
leads to hitting  uio_write -&gt; copy_from_user -&gt; _copy_from_user -&gt;
might_fault and the logs filling up with sleeping warnings.

I also noticed some uio drivers allocate memory, sleep, grab mutexes
from callouts like open() and release and uio is now doing
spin_lock_irqsave while calling them.

Reported-by: Mike Christie &lt;mchristi@redhat.com&gt;
CC: Hamish Martin &lt;hamish.martin@alliedtelesis.co.nz&gt;
Reviewed-by: Hamish Martin &lt;hamish.martin@alliedtelesis.co.nz&gt;
Signed-off-by: Xiubo Li &lt;xiubli@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Tommi Rantala &lt;tommi.t.rantala@nokia.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: Prevent device destruction while fds are open</title>
<updated>2019-02-15T07:09:14Z</updated>
<author>
<name>Hamish Martin</name>
<email>hamish.martin@alliedtelesis.co.nz</email>
</author>
<published>2019-02-13T16:29:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=085d735c858934e5d5bfaedb1fc98bd9135e6ff1'/>
<id>urn:sha1:085d735c858934e5d5bfaedb1fc98bd9135e6ff1</id>
<content type='text'>
commit a93e7b331568227500186a465fee3c2cb5dffd1f upstream.

Prevent destruction of a uio_device while user space apps hold open
file descriptors to that device. Further, access to the 'info' member
of the struct uio_device is protected by spinlock. This is to ensure
stale pointers to data not under control of the UIO subsystem are not
dereferenced.

Signed-off-by: Hamish Martin &lt;hamish.martin@alliedtelesis.co.nz&gt;
Reviewed-by: Chris Packham &lt;chris.packham@alliedtelesis.co.nz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
[4.14 change __poll_t to unsigned int]
Signed-off-by: Tommi Rantala &lt;tommi.t.rantala@nokia.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: Allow handling of non page-aligned memory regions</title>
<updated>2017-04-08T16:13:27Z</updated>
<author>
<name>Michal Sojka</name>
<email>sojkam1@fel.cvut.cz</email>
</author>
<published>2017-03-16T13:50:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=171058fb0883247b3a484a542b5dc89753c57cb5'/>
<id>urn:sha1:171058fb0883247b3a484a542b5dc89753c57cb5</id>
<content type='text'>
Since commit b65502879556 ("uio: we cannot mmap unaligned page
contents") addresses and sizes of UIO memory regions must be
page-aligned. If the address in the BAR register is not
page-aligned (which is the case of the mf264 card), the mentioned
commit forces the UIO driver to round the address down to the page
size. Then, there is no easy way for user-space to learn the offset of
the actual memory region within the page, because the offset seen in
/sys/class/uio/uio?/maps/map?/offset is calculated from the rounded
address and thus it is always zero.

Fix that problem by including the offset in struct uio_mem. UIO
drivers can set this field and userspace can read its value from
/sys/class/uio/uio?/maps/map?/offset.

The following commits update the uio_mf264 driver to set this new offs
field.

Drivers for hardware with page-aligned BARs need not to be modified
provided that they initialize struct uio_info (which contains uio_mem)
with zeros.

Signed-off-by: Michal Sojka &lt;sojkam1@fel.cvut.cz&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: support memory sizes larger than 32 bits</title>
<updated>2014-11-07T18:09:07Z</updated>
<author>
<name>Cristian Stoica</name>
<email>cristian.stoica@freescale.com</email>
</author>
<published>2014-10-09T12:00:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e0f1147cc9512d3610d2f2a0f069690661444703'/>
<id>urn:sha1:e0f1147cc9512d3610d2f2a0f069690661444703</id>
<content type='text'>
This is a completion to 27a90700a4275c5178b883b65927affdafa5185c
The size field is also increased to allow values larger than 32 bits
on platforms that have more than 32 bit physical addresses.

Signed-off-by: Cristian Stoica &lt;cristian.stoica@freescale.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>uio: Export definition of struct uio_device</title>
<updated>2014-10-03T04:35:54Z</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2014-10-01T23:07:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f14bb039a4e8206439d3e9abd92bc76bd142f243'/>
<id>urn:sha1:f14bb039a4e8206439d3e9abd92bc76bd142f243</id>
<content type='text'>
In order to prevent a O(n) search of the filesystem to link up its uio
node with its target configuration, TCMU needs to know the minor number
that UIO assigned. Expose the definition of this struct so TCMU can
access this field.

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
</content>
</entry>
<entry>
<title>include: replace linux/module.h with "struct module" wherever possible</title>
<updated>2011-10-31T23:32:32Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2011-05-26T17:46:22Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=de47725421ad5627a5c905f4e40bb844ebc06d29'/>
<id>urn:sha1:de47725421ad5627a5c905f4e40bb844ebc06d29</id>
<content type='text'>
The &lt;linux/module.h&gt; pretty much brings in the kitchen sink along
with it, so it should be avoided wherever reasonably possible in
terms of being included from other commonly used &lt;linux/something.h&gt;
files, as it results in a measureable increase on compile times.

The worst culprit was probably device.h since it is used everywhere.
This file also had an implicit dependency/usage of mutex.h which was
masked by module.h, and is also fixed here at the same time.

There are over a dozen other headers that simply declare the
struct instead of pulling in the whole file, so follow their lead
and simply make it a few more.

Most of the implicit dependencies on module.h being present by
these headers pulling it in have been now weeded out, so we can
finally make this change with hopefully minimal breakage.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>include: convert various register fcns to macros to avoid include chaining</title>
<updated>2011-10-31T23:32:32Z</updated>
<author>
<name>Paul Gortmaker</name>
<email>paul.gortmaker@windriver.com</email>
</author>
<published>2011-05-27T13:02:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=eb5589a8f0dab7e29021344228856339e6a1249c'/>
<id>urn:sha1:eb5589a8f0dab7e29021344228856339e6a1249c</id>
<content type='text'>
The original implementations reference THIS_MODULE in an inline.
We could include &lt;linux/export.h&gt;, but it is better to avoid chaining.

Fortunately someone else already thought of this, and made a similar
inline into a #define in &lt;linux/device.h&gt; for device_schedule_callback(),
[see commit 523ded71de0] so follow that precedent here.

Also bubble up any __must_check that were used on the prev. wrapper inline
functions up one to the real __register functions, to preserve any prev.
sanity checks that were used in those instances.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>uio: Support physical addresses &gt;32 bits on 32-bit systems</title>
<updated>2011-10-18T18:18:57Z</updated>
<author>
<name>Kai Jiang</name>
<email>Kai.Jiang@freescale.com</email>
</author>
<published>2011-10-17T18:50:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=27a90700a4275c5178b883b65927affdafa5185c'/>
<id>urn:sha1:27a90700a4275c5178b883b65927affdafa5185c</id>
<content type='text'>
To support &gt;32-bit physical addresses for UIO_MEM_PHYS type we need to
extend the width of 'addr' in struct uio_mem.  Numerous platforms like
embedded PPC, ARM, and X86 have support for systems with larger physical
address than logical.

Since 'addr' may contain a physical, logical, or virtual address the
easiest solution is to just change the type to 'phys_addr_t' which
should always be greater than or equal to the sizeof(void *) such that
it can properly hold any of the address types.

For physical address we can support up to a 44-bit physical address on a
typical 32-bit system as we utilize remap_pfn_range() for the mapping of
the memory region and pfn's are represnted by shifting the address by
the page size (typically 4k).

Signed-off-by: Kai Jiang &lt;Kai.Jiang@freescale.com&gt;
Signed-off-by: Minghuan Lian &lt;Minghuan.Lian@freescale.com&gt;
Signed-off-by: Kumar Gala &lt;galak@kernel.crashing.org&gt;
Signed-off-by: Hans J. Koch &lt;hjk@hansjkoch.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>uio: Change mail address of Hans J. Koch</title>
<updated>2010-11-11T00:57:11Z</updated>
<author>
<name>Hans J. Koch</name>
<email>hjk@hansjkoch.de</email>
</author>
<published>2010-10-29T22:36:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=318af55ddd38bdaaa2b57f5c3bd394f3ce3a2610'/>
<id>urn:sha1:318af55ddd38bdaaa2b57f5c3bd394f3ce3a2610</id>
<content type='text'>
My old mail address doesn't exist anymore. This changes all occurrences
to my new address.

Signed-off-by: Hans J. Koch &lt;hjk@hansjkoch.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>uio: Cleanup irq handling.</title>
<updated>2010-10-22T17:16:43Z</updated>
<author>
<name>Eric W. Biederman</name>
<email>ebiederm@aristanetworks.com</email>
</author>
<published>2010-09-14T18:37:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6427a7655afd7f07dfa83736defd1d94656c83e5'/>
<id>urn:sha1:6427a7655afd7f07dfa83736defd1d94656c83e5</id>
<content type='text'>
Change the value of UIO_IRQ_NONE -2 to 0.  0 is well defined in the rest
of the kernel as the value to indicate an irq has not been assigned.

Update the calls to request_irq and free_irq to only ignore UIO_IRQ_NONE
and UIO_IRQ_CUSTOM allowing the rest of the kernel's possible irq
numbers to be used.

Signed-off-by: Eric W. Biederman &lt;ebiederm@aristanetworks.com&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Hans J. Koch &lt;hjk@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
</feed>
