Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:26 +0000 (14:24 -0800)]
gpu: ion: Refactor common mapping functions out of system heap
The system heap contained several general purpose functions to map
buffers to the kernel and userspace. This patch refactors those
into ion_heap.c so they can be used by other heaps.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:25 +0000 (14:24 -0800)]
gpu: ion: Switch heap rbtree to a prio list
Switches the rbtree tree of heaps for a plist. This significantly
simplifies the code and the list is small and is modified only at
first boot so the rbtree is unnecessary. This also switches
the traversal of the heap list to traverse from highest to lowest
id's. This allows allocations to pass a heap mask that falls
back on the system heap -- typically id 0, which is the common case.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:24 +0000 (14:24 -0800)]
gpu: ion: Fix bug where MAP ioctl was no longer supported
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:23 +0000 (14:24 -0800)]
gpu: ion: Modify reserve function for carveouts with no start address
This patch allows you to specify a heap that requires carveout memory
but that doesn't specify a start address. Memblock_alloc will be called
to find a location for these heaps.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Benjamin Gaignard [Fri, 13 Dec 2013 22:24:22 +0000 (14:24 -0800)]
gpu: ion: fix compilation warning
use atomic_read to get the refcount value to avoid compilation warning
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Benjamin Gaignard [Fri, 13 Dec 2013 22:24:21 +0000 (14:24 -0800)]
gpu: ion: fix carveout ops
when using carveout heap ion_buffer_create function failed because
map_dma and unmap_dma operations aren't set by carveout heap.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:20 +0000 (14:24 -0800)]
gpu: ion: Fix bug in zeroing pages in system heap
Pages are zeroed for security purposes when returned to the
ion heap. There was a bug in this code preventing this
from happening.
Bug:
7573871
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:19 +0000 (14:24 -0800)]
gpu: ion: Fix bug in ion_system_heap map_user
When the requested mmap length was not an integer number of
chunks or the buffer, or if an offset was provided, a bug
would cause extra or incorrect pages of the buffer to be mapped.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:18 +0000 (14:24 -0800)]
gpu: ion: Don't flush allocatoins that come from the page pools
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:17 +0000 (14:24 -0800)]
gpu: ion: Clear GFP_WAIT flag on high order allocations
This will prevent the kernel from kicking off compaction
when higher order allocations are made. Instead we will
get these high order allocations only if they are readily
available.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:16 +0000 (14:24 -0800)]
gpu: ion: Refactor locking
Removes contention for lock between allocate and free by reducing
the length of time the lock is held for. Split out a seperate
lock to protect the list of heaps and replace it with a rwsem since
the list will most likely only be updated during initialization.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:15 +0000 (14:24 -0800)]
gpu: ion: Switch to using a single shrink function
The single shrink function will free lower order pages first. This
enables compaction to work properly.
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:14 +0000 (14:24 -0800)]
gpu: ion: Fix lockdep issue in ion_page_pool
Currently the mutex is held while kmalloc is called, under a low memory
condition this might trigger the shrinker which also takes this mutex.
Refactor so the mutex is not held during allocation.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:13 +0000 (14:24 -0800)]
gpu: ion: Fix several issues with page pool
Split out low and high mem pages so they are correctly reported
when the shrinker is called.
Fix potential deadlock caused by holding the page pool lock while
allocationg and also needing that lock from the shrink function
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:12 +0000 (14:24 -0800)]
gpu: ion: Modify gfp flags in ion_system_heap
When allocations larger than order 4 are made, use _GFP_NORETRY
and __GFP_NO_KSWAPD so kswapd doesn't get kicked off to reclaim
these larger chunks. For smaller allocaitons, these are
unnecessary, as the system should be able to reclaim these.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:11 +0000 (14:24 -0800)]
gpu: ion: Use the ion_page_pool from the system heap
With this change the system heap will use pagepools to avoid
having to invalidate memory when it is allocated, a
significant performance improvement on some systems.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:10 +0000 (14:24 -0800)]
gpu: ion: Add ion_page_pool.
This patch adds a new utility heaps can use to manage
memory. In the past we have found it can be very
expensive to manage the caches when allocating memory,
but it is imposible to know whether a previous user of a
given memory allocation had a cached mapping. This patch
adds the ability to store a pool of pages that were
previously used uncached so that cache maintenance
only need be done when growing this pool. The pool also
contains a shrinker so memory from the pool can be
recovered in low memory conditions.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:09 +0000 (14:24 -0800)]
gpu: ion: use vmalloc to allocate page array to map kernel
When ion_map_kernel is execute the system must allocate
an array large enough to hold a pointer to each page in
the buffer. If the buffer is very large and the system
memory has become very fragmented, there may not be
sufficient high order allocations available from kmalloc.
Use vmalloc instead.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:08 +0000 (14:24 -0800)]
gpu: ion: ion_system_heap: Fix bug preventing compilation
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:07 +0000 (14:24 -0800)]
gpu: ion: Stop trying to allocate from an order on first failure
With this patch the system heap will only try to allocate from each
order as long as allocations succeed. If it failes to obtain a higher
order allocation, it doesn't retry that order.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:06 +0000 (14:24 -0800)]
gpu: ion: optimize system heap for non fault buffers
If a buffer's user mappings are not going to be faulted
in it need not be allocated page wise. We can optimize
this common case by allocating an sglist of larger chunks
rather than creating an entry for each page in the
allocation.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:05 +0000 (14:24 -0800)]
gpu: ion: Add support for cached mappings that don't fault
We have found that faulting in the mappings for cached
allocations has a significant performance impact and is
only a benefit if only a small part of the buffer is
touched by the cpu (an uncommon case for software rendering).
This patch introduces a ION_FLAG_CACHED_NEEDS_SYNC
which determines whether a mapping should be created by
faulting or at mmap time. If this flag is set,
userspace must manage the caches explictly using the SYNC ioctl.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:04 +0000 (14:24 -0800)]
gpu: ion: Fix memory leak of dirty bits
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:03 +0000 (14:24 -0800)]
gpu: ion: Add debug information for orphaned handles
It is possible for a buffer to exist only as a dma_buf file
descriptor without it being held in any handles. When this
occurs it is impossible to track where the buffer is in the
system (without traversing every process in the system and
inspecting its file table). When buffers are orphaned like
this, copy the task comm and pid of the last client to hold
them into the buffer so we have a debugging hint as to where
this buffer came from. In practice this will probalby be
the process that allocated the buffer.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:02 +0000 (14:24 -0800)]
gpu: ion: Fix bug in ion_free
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:24:01 +0000 (14:24 -0800)]
gpu: ion: Fix race between ion_import and ion_free
If preemted during ion_free after the refcount is updated but
before the handle can be removed from the rb_tree, import
might find that handle in the tree and try to reuse it
when execution returns to free, the handle will be cleaned
up leaving the caller of import with a corrupt handle.
This patch modifies the locking to protect agains this race.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Hackmann [Fri, 13 Dec 2013 22:24:00 +0000 (14:24 -0800)]
gpu: ion: fix page offset in dma_buf_kmap()
Signed-off-by: Greg Hackmann <ghackmann@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:59 +0000 (14:23 -0800)]
gpu: ion: Switch to using kmalloc rather than kmap during allocation
Previously, metadata was stored in the allocated pages themselves
during allocation. However the system can only have a limited
number of kmapped pages. A very large allocation might exceed
this limit.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:58 +0000 (14:23 -0800)]
gpu: ion: Only map as much of the vma as the user requested
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Fri, 13 Dec 2013 22:23:57 +0000 (14:23 -0800)]
gpu: ion: Don't call ion_buffer_put on error path
If dma_buf_fd fails, the dma_buf needs to be cleaned up by
calling dma_buf_put. dma_buf_put will call ion_dma_buf_release
which in turn calls ion_buffer_put to clean up the buffer
reference. Calling ion_buffer_put after dma_buf_put drops the
reference count by one more which is incorrect. Fix this by
getting rid of the extra ion_buffer_put call.
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Olav Haugan [Fri, 13 Dec 2013 22:23:56 +0000 (14:23 -0800)]
gpu: ion: IOCTL return success when error occurs
ION_IOC_MAP, ION_IOC_SHARE, and ION_IOC_IMPORT may return
success when an error occurs.
Add correct error handling to ION_IOC_MAP, ION_IOC_SHARE, and
ION_IOC_IMPORT.
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Olav Haugan [Fri, 13 Dec 2013 22:23:55 +0000 (14:23 -0800)]
gpu: ion: Add EXPORT_SYMBOL to functions
Several functions in the ion interface is missing
EXPORT_SYMBOL. This is needed to allow clients to
use these functions from kernel modules.
Add EXPORT_SYMBOL to functions that are supposed
to be exposed.
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Olav Haugan [Fri, 13 Dec 2013 22:23:54 +0000 (14:23 -0800)]
gpu: ion: Add missing argument to WARN call
The condition argument to the WARN call in ion_free and
ion_share_dma_buf are missing. Add the argument to
allow correct printing of warning message.
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dima Zavin [Fri, 13 Dec 2013 22:23:53 +0000 (14:23 -0800)]
gpu: ion: do not ask for compound pages in system heap
Signed-off-by: Dima Zavin <dima@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:52 +0000 (14:23 -0800)]
gpu: ion: Add explicit sync ioctl
This is deprecated in favor of using the dma_buf api which will
automatically sync a buffer to memory when it is mapped to a device.
However, that functionality is not ready, so this patch adds the
ability to sync a buffer explicitly.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:51 +0000 (14:23 -0800)]
gpu: ion: Modify the system heap to try to allocate large/huge pages
On some systems there is a performance benefit to reducing tlb pressure
by minimizing the number of chunks in an allocation.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:50 +0000 (14:23 -0800)]
gpu: ion: Add cache maintenance to ion.
This patch adds cache maintenance operations to ion. As per mailing
list discussions regarding dma_buf, cache operations are done implicitly.
At buffer allocaiton time the user can select whether he'd like mappings
(both kernel and user) to be cached. When cached mappings are selected,
no mappings will be created for a buffer at mmap time. Instead pages will
be faulted in one at a time so we can track which pages require flushing
before dma. When the buffers are mapped for dma (via the dma_buf apis)
any pages which were touched will be synced for device.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Fri, 13 Dec 2013 22:23:49 +0000 (14:23 -0800)]
gpu: ion: Map only the vma size given
When mapping carveout buffers into userspace, only map
the size of the vma given, not the full size of the buffer
since clients may map less than the buffer size.
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Laura Abbott [Fri, 13 Dec 2013 22:23:48 +0000 (14:23 -0800)]
gpu: ion: Loop on the handle count when destroying
When destroying a handle, all kernel mappings to that handle
should be destroyed. Other handles may still have references
and valid mappings to the buffer underneath which should not
be destroyed. Loop on the handle reference count, not the buffer
reference count to get rid of all kernel mappings for the handle.
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:47 +0000 (14:23 -0800)]
gpu: ion: ion_system_heap: Change allocations to GFP_HIGHUSER
Previously the ion_system_heap was using GFP_KERNEL, forcing all allocations
to be in lowmem. This quickly causes us to run out of lowmem.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:46 +0000 (14:23 -0800)]
gpu: ion: Set the dma_address of the sg list at alloc time
This patch sets the dma_address field of the sglist representing
an allocation at allocation time. This technically breaks the dma api
which states that these addresses should be set when a particular device
takes ownership of a buffer via the dma_map apis. In the case of our
systems the only dma address space is physical addresses. Additionally,
we can not afford the overhead of calling dma_map_sg from this location
as it implies a cache invalidate that is not necessary if the memory
was previously mapped cached. Instead, the expectation is that memory
being returned from the heaps is ready for dma in that if any cached
mappings of that memory exist they have been invalidated.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Hackmann [Fri, 13 Dec 2013 22:23:45 +0000 (14:23 -0800)]
gpu: ion: fill in buffer->{dev,size} before mapping new buffers
At least one map_dma() implementation (EXYNOS_CONTIG) assumes the fields
are filled in
Signed-off-by: Greg Hackmann <ghackmann@google.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:44 +0000 (14:23 -0800)]
gpu: ion: Get an sg_table from an ion handle
This patch adds an interface to return and sg_table given a
valid ion handle.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:43 +0000 (14:23 -0800)]
gpu: ion: Allocate the sg_table at creation time rather than dynamically
Rather than calling map_dma on the allocations dynamically, this patch
switches to creating the sg_table at the time the buffer is created.
This is necessary because in future updates the sg_table will be used
for cache maintenance.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:42 +0000 (14:23 -0800)]
gpu: ion: support begin/end and kmap/kunmap dma_buf ops
These ops were added in the 3.4 kernel. This patch adds support
for them to ion. Previous ion_map/unmap_kernel api is also
retained in addition to this new api.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:41 +0000 (14:23 -0800)]
gpu: ion: Use alloc_pages instead of vmalloc from the system heap
With this change the ion_system_heap will only use kernel address
space when the memory is mapped into the kernel (rare case).
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:40 +0000 (14:23 -0800)]
ion: Switch ion to use dma-buf
Ion now uses dma-buf file descriptors to share
buffers with userspace. Ion becomes a dma-buf
exporter and any driver that can import dma-bufs
can now import ion file descriptors.
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
KyongHo Cho [Fri, 13 Dec 2013 22:23:39 +0000 (14:23 -0800)]
gpu: ion: several bugfixes and enhancements of ION
1. Verifying if the size of memory allocation in ion_alloc() is aligned
by PAGE_SIZE at least. If it is not, this change makes the size to be
aligned by PAGE_SIZE.
2. Unmaps all mappings to the kernel and DMA address spaces when
destroying ion_buffer in ion_buffer_destroy(). This prevents leaks in
those virtual address spaces.
3. Makes the return value of ion_alloc() to be explicit Linux error code
when it fails to allocate a buffer.
4. Makes ion_alloc() implementation simpler. Removes 'goto' statement and
relavant call to ion_buffer_put().
5. Checks if the task is valid before calling put_task_struct() due
to failure on creating a ion client in ion_client_create().
6. Returns error when buffer allocation requested by userspace is failed.
Signed-off-by: KyongHo Cho <pullip.cho@samsung.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:38 +0000 (14:23 -0800)]
ion: Add reserve function to ion
Rather than requiring each platform call memblock_remove or reserve
from the board file, add this to ion
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Fri, 13 Dec 2013 22:23:37 +0000 (14:23 -0800)]
ion: Switch map/unmap dma api to sg_tables
Switch these api's from scatterlists to sg_tables
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Colin Cross [Fri, 13 Dec 2013 22:23:36 +0000 (14:23 -0800)]
gpu: ion: ion_carveout_heap: fix for 3.4
__arch_ioremap is no longer available, use __arm_ioremap instead.
Signed-off-by: Colin Cross <ccross@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rebecca Schultz Zavin [Sat, 14 Dec 2013 03:38:38 +0000 (19:38 -0800)]
gpu: ion: Add ION Memory Manager
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: Squished in Colin Cross' move to staging change,
also disables ION from the build, as it won't compile till
the end of the patchset]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Mon, 9 Dec 2013 18:32:58 +0000 (11:32 -0700)]
staging: comedi: ni_at_a2150: fix an always true condition test
As pointed out by the kbuild test robot, and Ian Abbott, the dma >= 0 test
is always true because dma is unsigned. This generates a warn message:
drivers/staging/comedi/drivers/ni_at_a2150.c:715 a2150_attach()
warn: always true condition '(dma >= 0) => (0-u32max >= 0)'
Fix the test as suggested by Ian Abbott.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eli Billauer [Mon, 9 Dec 2013 08:16:52 +0000 (10:16 +0200)]
staging: xillybus: Removed force to be a module
The driver was forced to "module only" following a previous failure to build
into the kernel. The problem was resolved several months ago.
This has been successfully tested with "make allyesconfig" on x86_64.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Malcolm Priestley [Mon, 9 Dec 2013 23:08:35 +0000 (23:08 +0000)]
staging: vt6656: Move double definition of MAX_RATE to device_cfg.h
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Malcolm Priestley [Sun, 8 Dec 2013 09:11:30 +0000 (09:11 +0000)]
staging: vt6656: [BUG] BBvUpdatePreEDThreshold Always set sensitivity on bScanning
byBBPreEDIndex value is initially 0, this means that from
cold BBvUpdatePreEDThreshold is never set.
This means that sensitivity may be in an ambiguous state,
failing to scan any wireless points or at least distant ones.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Malcolm Priestley [Mon, 9 Dec 2013 22:30:14 +0000 (22:30 +0000)]
staging: vt6656: Replace pStatistic->abyTxPktInfo with struct vnt_tx_pkt_info
Change s_vSaveTxPktInfo and BSSvUpdateNodeTxCounter to use vnt_tx_pkt_info
relayed to BSSvUpdateNodeTxCounter via INTnsProcessData.
pStatistic->abyTxPktInfo[byPktNum].byBroadMultiUni is unused and discarded.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Malcolm Priestley [Mon, 9 Dec 2013 22:28:24 +0000 (22:28 +0000)]
staging: vt6656: s_uCalculateLinkQual use netstats rx values
Use netstats rx_packets and rx_frame_errors.
Add frame errors to RXbBulkInProcessData
The current scStatistic.RxFcsErrCnt only records
USB errors not frame errors.
The scStatistic.RxOkCnt only recorded successful USB
transfers not actual successfully received packets.
So a more accurate reading is to use netstats rx_packets and
rx_frame_errors.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Malcolm Priestley [Mon, 9 Dec 2013 22:25:48 +0000 (22:25 +0000)]
staging: vt6656: Get wireless stats qual.qual directly from s_uCalculateLinkQual
Calculate the qual from the tx_packets and wstats.discard.retries and
apply to wstats.qual.qual
Discard pDevice->scStatistic.LinkQuality.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Malcolm Priestley [Mon, 9 Dec 2013 22:23:19 +0000 (22:23 +0000)]
staging: vt6656: Remove STAvUpdateTDStatCounter and apply directly to stats
Apply directly to net_device_stats and wireless stats.
tx_bytes are relayed from s_vSaveTxPktInfo via scStatistic,
so collect them there.
All other statistics in STAvUpdateTDStatCounter are dead code
and don't reach user.
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ZHAO Gang [Mon, 9 Dec 2013 11:38:30 +0000 (19:38 +0800)]
staging: et131x: remove unnecessary pointer typecast
Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ZHAO Gang [Mon, 9 Dec 2013 11:38:29 +0000 (19:38 +0800)]
staging: et131x: remove item that have been done in TODO file
Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ZHAO Gang [Mon, 9 Dec 2013 11:38:28 +0000 (19:38 +0800)]
staging: et131x: reduce split lines in nic_rx_pkts
Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ZHAO Gang [Mon, 9 Dec 2013 11:38:27 +0000 (19:38 +0800)]
staging: et131x: reduce split lines in nic_return_rfd
Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ZHAO Gang [Mon, 9 Dec 2013 11:38:26 +0000 (19:38 +0800)]
staging: et131x: reduce split lines in et131x_rx_dma_memory_free
Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ZHAO Gang [Mon, 9 Dec 2013 11:38:25 +0000 (19:38 +0800)]
staging: et131x: reduce split lines in et131x_rx_dma_memory_alloc
Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ZHAO Gang [Mon, 9 Dec 2013 11:38:24 +0000 (19:38 +0800)]
staging: et131x: reduce split lines in et131x_config_rx_dma_regs
Signed-off-by: ZHAO Gang <gamerh2o@gmail.com>
Acked-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Paul Gortmaker [Tue, 10 Dec 2013 20:36:50 +0000 (15:36 -0500)]
lustre: delete pointless wait queue related casts.
These serve no purpose at all, and can only mask real type
clash issues that one would want to actually see.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mikhail Pershin [Mon, 9 Dec 2013 14:56:57 +0000 (22:56 +0800)]
staging/lustre/seq: remove seq_{query,handle}
This is only part of the original Lustre tree commit. Main part of the
original commit modifies server side code.
Lustre-change: http://review.whamcloud.com/6765
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3467
Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Mikhail Pershin [Mon, 9 Dec 2013 14:56:56 +0000 (22:56 +0800)]
staging/lustre/target: move OUT to the unified target code
- Move OUT handler to the unified target code, so it can be
used by both MDS and OST.
Lustre-change: http://review.whamcloud.com/6763
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3467
Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
[pick client side of change. target is mostly server side code -- PengTao]
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
JC Lafoucriere [Mon, 9 Dec 2013 14:56:55 +0000 (22:56 +0800)]
staging/lustre/api: HSM import uses new released pattern
Import creates a released file using new RAID pattern flag
Import used a new ioctl() to implement the import in the
client kernel.
Lustre-change: http://review.whamcloud.com/6536
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3363
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
[Fix up kuid_t/guid_t conversion in llite/file.c -- Peng Tao]
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Doug Oucharek [Mon, 9 Dec 2013 14:56:54 +0000 (22:56 +0800)]
staging/lustre/lnet: Add LNet Router Priority parameter
This change adds a priority parameter to the route module settings.
This paramter can be >= 0. Like hops, the lower the prioirty number
the higher the priority. So lower numbered priorities will be
selected over higher numbers.
Lustre-change: http://review.whamcloud.com/5663
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2934
Signed-off-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peng Tao [Mon, 9 Dec 2013 14:56:53 +0000 (22:56 +0800)]
staging/lustre: remove server macros from lustre_net.h
These macros are only used on server side.
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Nitin Cupta [Wed, 11 Dec 2013 02:04:37 +0000 (11:04 +0900)]
zsmalloc: add more comment
This patch adds lots of comments and it will help others
to review and enhance.
Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Minchan Kim [Wed, 11 Dec 2013 02:04:36 +0000 (11:04 +0900)]
zsmalloc: add Kconfig for enabling page table method
Zsmalloc has two methods 1) copy-based and 2) pte based to
access objects that span two pages.
You can see history why we supported two approach from [1].
But it was bad choice that adding hard coding to select arch
which want to use pte based method because there are lots of
SoC in an architecure and they can have different cache size,
CPU speed and so on so it would be better to expose it to user
as selectable Kconfig option like Andrew Morton suggested.
[1] https://lkml.org/lkml/2012/7/11/58
Acked-by: Nitin Gupta <ngupta@vflare.org>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman [Mon, 9 Dec 2013 01:33:16 +0000 (17:33 -0800)]
staging: btmtk_usb: remove driver
No one seems to be working on it anymore, and it really should be merged
into the already-existing btusb driver. Also, there is not any proper
author attribution on the code (it was copied from the in-kernel
driver...)
If someone wants to pick this back up, we can easily revert this, but
for now, delete the driver.
Cc: Yu-Chen, Cho <acho@suse.com>
Cc: Jay Hung <jay.hung@mediatek.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Daniel Dodge [Sat, 7 Dec 2013 08:36:32 +0000 (03:36 -0500)]
Drivers: Staging: ft1000: Fixed C99 // comments styling issue
This patch removes C99 style comments from the driver and whenever
possible attempts to match coding style of the rest of the driver.
Signed-off-by: Daniel Dodge <danieldodgese@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Malcolm Priestley [Sat, 7 Dec 2013 11:40:28 +0000 (11:40 +0000)]
staging: vt6656: baseband.c clean up BBbVT3184Init
White space clean up and remove camel case from variables.
pDevice-> priv
ntStatus -> status
wLength ->length
pbyAddr -> addr
pbyAgc -> agc
wLengthAgc ->length_agc
abyArray -> array
Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Nick Hudson [Fri, 6 Dec 2013 22:01:44 +0000 (14:01 -0800)]
staging: dwc2: don't issue traffic to LS devices in FS mode
I fell over the problem reported in
https://github.com/raspberrypi/linux/pull/390:
"Issuing low-speed packets when the root port is in full-speed mode
causes the root port to stop responding. Explicitly fail when
enqueuing URBs to a LS endpoint on a FS bus."
with my dwc2 testing in NetBSD, so I adapted the change to dwc2.
Signed-off-by: Nick Hudson <skrll@netbsd.org>
[paulz: fixed up the patch to compile under Linux, and tested it]
Signed-off-by: Paul Zimmerman <paulz@synopsys.com>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fabio Estevam [Fri, 29 Nov 2013 10:46:32 +0000 (08:46 -0200)]
imx-drm: Add mx6 hdmi transmitter support
Add mx6 hdmi transmitter support.
Original work has been done by Sascha Hauer and Tony Prisk.
Special thanks to Russell King for his carefully review, many bug fixes and
testing of the mx6 HDMI driver.
Tested on the following boards:
- mx6q sabresd
- mx6dl sabresd
- mx6solo wandboard
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:16 +0000 (16:54 -0700)]
staging: comedi: pcmuio: tidy up pcmuio_start_intr()
Refactor this function a bit to remove the need for an extra indent
level and cleanup some of the odd line breaks.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:15 +0000 (16:54 -0700)]
staging: comedi: pcmuio: tidy up pcmuio_attach()
Clean up the local variables, 'sdev_no' and 'asic' are both used in
simple for () loops. Use the local variable 'i' for both cases. The
'n_subdevs' variable is only used in one place, just remove it.
For aesthetics, add some whitespace to the subdevice init and reorder
it to follow the more typical style in comedi drivers.
Remove the unnecessary init of s->len_chanlist for subdevices that do
not support async commands (interrupts). The core will default it to
the correct value.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:14 +0000 (16:54 -0700)]
staging: comedi: pcmuio: remove unneeded include
The <linux/slab.h> header is no longer needed by this driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:12 +0000 (16:54 -0700)]
staging: comedi: pcmuio: fix types of some private data variables
The 'enabled_mask' is a bit mask of the channels that are enabled
for interrupt detection and should be an unsigned int.
The 'stop_count' is a >= 0 value that is set by the unsigned int
cmd->stop_arg. Make it an unsigned int.
The 'active' and 'continuous' members are flags. Make them unsigned
int bit-fields to save a bit of space.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:11 +0000 (16:54 -0700)]
staging: comedi: pcmuio: document the spinlock_t variables
Add some comments about the two spinlock_t variables in the private
data. Also, add come comments for the functions that do not need to
lock/unlock the spinlock.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:10 +0000 (16:54 -0700)]
staging: comedi: pcmuio: add inline helpers to get the 'iobase', 'asic', and 'port'
To reduce the potential for bugs, and better document the code, introduce
some inline helper functions to consolidate the calculations needed to get
the 'iobase' for a given asic and the 'asic' and 'port' associated with a
given subdevice.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:09 +0000 (16:54 -0700)]
staging: comedi: pcmuio: remove unnecessary mask of triggered channels
The 'triggered' value is read directly from the three trigger id
registers and does not have any extra data that needs masked off.
Remove the 'mytrig' local variable and just use 'triggered' directly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:08 +0000 (16:54 -0700)]
staging: comedi: pcmuio: fix pcmuio_dio_insn_bits()
This dio subdevice (*insn_bits) function does not follow the "norm"
for comedi drivers. It also _appears_ to return the incorrect state
of the channels.
Use the comedi_dio_update_state() helper to handle the boilerplate
for updating the output channel state. Due to the hardware we then
need to invert the state and mask the input channels before updating
the outputs.
Then read the hardware and invert the result to get the current true
state of the dio channels.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:07 +0000 (16:54 -0700)]
staging: comedi: pcmuio: remove subdevice private data
The subdevice private data is only needed for each 'asic' not for each
subdevice. Since the 'asic' can be calculated easily from the subdevice
we can merge the subdevice private data members directly into the
private data.
This removes the need to kcalloc/free the subdevice private data and
saves a bit of space.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:06 +0000 (16:54 -0700)]
staging: comedi: pcmuio: remove 'asic' member from subdevice private data
The 'asic' associated with a subdevice can be easily calculated. The
functions that use this member in the subdevice private data can only
be called by the subdevices that support interrupts. Just calculate
the 'asic' when needed and remove the member variable and sanity checks.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Fri, 6 Dec 2013 16:43:02 +0000 (09:43 -0700)]
staging: comedi: pcmuio: tidy up pcmuio_handle_asic_interrupt()
Unfortunatly, since there could be two asics, we can't use dev->read_subdev
to get the subdevice. But, the comedi_subdevice associated with the 'asic'
can easily be calculated. This allows removing the for () loop that searched
for the correct subdevice.
Tidy up the function.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:04 +0000 (16:54 -0700)]
staging: comedi: pcmuio: spinlock protect pcmuio_{write, read}()
Currently only the pcmuio_handle_asic_interrupt() function uses the
spinlock in the private data to protect the read of the paged interrupt
id registers. All accesses to the paged registers should be protected
to ensure that the page is not changed until the access is complete.
Move the lock/unlock into the pcmuio_{write,read}() functions to make
sure the access completes correctly. Rename the spinlock to variable
to clarify its use.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 23:54:03 +0000 (16:54 -0700)]
staging: comedi: pcmuio: fix interrupt requests
Legacy (ISA) interrupts are not sharable so this driver should not
be passing the IRQF_SHARED flag when requesting the interrupts.
This driver supports two board types:
PCM-UIO48 with one asic (one interrupt source)
PCM-UIO96 with two asics (two interrupt sources)
The PCM-UIO96 has a jumper that allows the two interrupt sources to
share an interrupt. This is safe for legacy interrupts as long as
the "shared" interrupt is handled by a single driver.
Modify the request_irq() code in this driver to correctly request the
interrupts. For the PCM-UI048 case (one asic) only one request_irq()
is needed. For the PCM-UIO96 (two asics) there are three cases:
1) irq is shared, one request_irq() call
2) only one asic has an irq, one request_irq() call
3) two irqs, two request_irq() calls
The irq for the first asic (dev->irq) will be requested during the
attach if required. The comedi core will handle the freeing of this
irq during the detach.
The irq for the second asic (devpriv->irq2) will also be requested
during the attach if required. The freeing of this irq will be
handled by the driver during the detach.
Move the board reset and interrupt request code so it occurs early
in the attach. We can then check dev->irq and devpriv->irq2 to see
if the subdevice command support actually needs to be initialized.
This also simplifies the interrupt handler. The irq can be simply
checked against dev->irq and devpriv->irq2 to see which asic caused
the interrupt.
Add a call to pcmuio_reset() in the (*detach) to make sure the
interrupts are disabled before freeing the irqs.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 20:43:49 +0000 (13:43 -0700)]
staging: comedi: ni_pcidio: use dev->read_subdev
Use the dev->read_subdev that was setup in the device attach instead
of accessing the dev->subdevices array directly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 20:43:48 +0000 (13:43 -0700)]
staging: comedi: ni_pcidio: factor board reset out of attach
Factor the code that resets the board and disables the interrupts out
of the attach.
Move the reset so it happens before the subdevices are initialized.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 20:43:47 +0000 (13:43 -0700)]
staging: comedi: rtd520: use dev->read_subdev
Use the dev->read_subdev that was setup in the device attach instead
of accessing the dev->subdevices array directly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 20:43:46 +0000 (13:43 -0700)]
staging: comedi: ni_atmio16d: use dev->read_subdev
Use the dev->read_subdev that was setup in the device attach instead
of accessing the dev->subdevices array directly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 20:43:45 +0000 (13:43 -0700)]
staging: comedi: ni_65xx: use dev->read_subdev
Use the dev->read_subdev that was setup in the device attach instead
of accessing the dev->subdevices array directly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 20:43:44 +0000 (13:43 -0700)]
staging: comedi: amplc_pci224: use dev->write_subdev
Use the dev->write_subdev that was setup in the device attach instead
of accessing the dev->subdevices array directly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
H Hartley Sweeten [Thu, 5 Dec 2013 20:43:43 +0000 (13:43 -0700)]
staging: comedi: amplc_pc236: use dev->read_subdev
Use the dev->read_subdev that was setup in the device attach instead
of accessing the dev->subdevices array directly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>