firefly-linux-kernel-4.4.55.git
10 years agoion: Improve ION config description
John Stultz [Fri, 8 Nov 2013 03:58:41 +0000 (19:58 -0800)]
ion: Improve ION config description

Mostly just to quiet checkpatch warnings, be more verbose
in describing the ION config option.

Change-Id: I194235f1a68623dca15ae6e658fc99d00943a827
Signed-off-by: John Stultz <john.stultz@linaro.org>
10 years agoion: Cleanup whitespace issues and other checkpatch problems
John Stultz [Fri, 8 Nov 2013 03:51:09 +0000 (19:51 -0800)]
ion: Cleanup whitespace issues and other checkpatch problems

Just some simple cleanups to address whitespace issues and
other issues found w/ checkpatch.

Change-Id: I181444505627894b8f3bbf59192703b0f65736ee
Signed-off-by: John Stultz <john.stultz@linaro.org>
10 years agoandroid: configs: Reorder config fragments, update README
JP Abgrall [Fri, 22 Nov 2013 22:07:03 +0000 (14:07 -0800)]
android: configs: Reorder config fragments, update README

Change-Id: I5ee4b794dcc00f74f26562e49a406ea292af63ee
(cherry picked from commit 9ebedefd06142c9bc812bfa23401031525002a76)

10 years agoion: fix bugs in cma heap
Colin Cross [Wed, 27 Nov 2013 23:53:21 +0000 (15:53 -0800)]
ion: fix bugs in cma heap

Implement ion_cma_unmap_kernel, ion will call it unconditionally.
Use correct gfp flags when calling dma_alloc_coherent so it doesn't
try to use atomic DMA memory.
Check for invalid alignment when allocating.
Reject cached allocations - the cpu address returned by
dma_alloc_coherent is always going to be an uncached mapping, so
map_kernel will not see data written by a cached userspace mapping.

Change-Id: I2ea03f28fae3749f6de0b89700b69da3845926ea
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: add alignment check to chunk heap
Colin Cross [Wed, 27 Nov 2013 23:53:01 +0000 (15:53 -0800)]
ion: add alignment check to chunk heap

Change-Id: I4be12b9545a81f9b46339a905f00e1e64896b3ed
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: add helper to zero contiguous region of pages
Colin Cross [Wed, 27 Nov 2013 23:51:02 +0000 (15:51 -0800)]
ion: add helper to zero contiguous region of pages

Add ion_heap_pages_zero for ion heaps to use to zero pages
during initialization or allocation, when a struct ion_buffer
may not be available.  Use it from the chunk heap and carveout
heaps.

Change-Id: Ic6c921943a8820cf9896da5164f2d9794d0fe91f
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: carveout heap: zero buffers on free, fix memory leak
Colin Cross [Wed, 27 Nov 2013 05:36:54 +0000 (21:36 -0800)]
ion: carveout heap: zero buffers on free, fix memory leak

The carveout heap wasn't zeroing its buffers after use.
Create the sg_table during allocate instead of map_dma, to allow
using the sg_table during free, and call ion_heap_buffer_zero
during free.  Also fixes a missing kfree when destroying the
table.

Change-Id: I318a8493cce32580250884cae336dd2e2c28e73b
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: fix sparse warnings
Colin Cross [Wed, 27 Nov 2013 05:25:47 +0000 (21:25 -0800)]
ion: fix sparse warnings

Fix sparse warnings in ion.

Change-Id: Icbadf2ca53bea20914f608f619568629c178eae3
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: use alloc_pages in system contig heap
Colin Cross [Tue, 26 Nov 2013 23:35:29 +0000 (15:35 -0800)]
ion: use alloc_pages in system contig heap

There is no reason to use kzalloc, just call alloc_pages directly.
Change the GFP from GFP_KERNEL to include __GFP_HIGH, to allow it
to return contiguous pages from highmem.  virt_to_* functions
aren't valid on highmem pages, so store the struct page * in an
sg_table in buffer->priv_virt like most other heaps, and replace
virt_to_* with page_to_*.

Change-Id: Ida78888b101f080883716e1fa5038dfc4dbabd16
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: allow cached mappings of chunk and system heap buffers
Colin Cross [Tue, 26 Nov 2013 23:33:33 +0000 (15:33 -0800)]
ion: allow cached mappings of chunk and system heap buffers

Now that ion_vm_fault uses vm_insert_pfn instead of vm_insert_page
cached buffers can be supported in any heap.  Remove the checks
in the chunk and system heaps.

Change-Id: I371a44c400ed8a342c3b0eed90d0fb7060537697
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: remove ion_heap_alloc_pages
Colin Cross [Tue, 26 Nov 2013 23:25:59 +0000 (15:25 -0800)]
ion: remove ion_heap_alloc_pages

Now that ion_vm_fault doesn't need a struct page with a nonzero
refcount, there is no need allocate heap memory for cached pages using
split_page.  Remove the ion_heap_alloc_pages and ion_heap_free_pages
helpers in favor of direct calls to alloc_pages and __free_pages,
and remove the special handling in the system heap.

Change-Id: I5966a798f48df2d56642e662a69c1495944f6509
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: use vm_insert_pfn for faulted pages
Colin Cross [Tue, 26 Nov 2013 23:05:46 +0000 (15:05 -0800)]
ion: use vm_insert_pfn for faulted pages

Most ion userspace mappings are created with remap_pfn_range.  Use
vm_insert_pfn instead of vm_insert_page to make faulted cached
mappings look more like uncached mappings.

Change-Id: I9ec5cad3fef54f3b80be8b306d7ff2f1fe3f0e66
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: check return value from remap_pfn_range
Colin Cross [Tue, 26 Nov 2013 23:34:50 +0000 (15:34 -0800)]
ion: check return value from remap_pfn_range

Check the return value of remap_pfn_range and return an error if
it fails.

Change-Id: I206cf95a24607ebe1c80274e3ed15cc7c076d007
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: free low memory from page pools first
Colin Cross [Fri, 22 Nov 2013 02:56:37 +0000 (18:56 -0800)]
ion: free low memory from page pools first

When the shrinkers are called with GFP_HIGH free low memory first,
it is more important to have free than high memory.

Change-Id: I7ad8a9c133830f04d429c3d87b781b3e862ccedb
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: optimize ion_heap_buffer_zero
Colin Cross [Mon, 25 Nov 2013 21:32:51 +0000 (13:32 -0800)]
ion: optimize ion_heap_buffer_zero

ion_heap_buffer_zero can spend a long time in unmap_kernel_range
if it has to broadcast a tlb flush to every cpu for every page.
Modify it to batch pages into a larger region to clear using a
single mapping.  This may cause the mapping size to change if
the buffer size is not a multiple of the mapping size, so
switch to allocating the address space for each chunk.  This
allows us to use vm_map_ram to handle the allocation and mapping
together.

The number of pages to zero using a single mapping is set to 32
to hit the fastpath in vm_map_ram.

Change-Id: I1accfe67b285cbc9e95e387bea4246864197827d
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: add alignment check to carveout heap
Colin Cross [Tue, 26 Nov 2013 21:43:29 +0000 (13:43 -0800)]
ion: add alignment check to carveout heap

Change-Id: I25c752b3eacb48cccea5be2df319634b3affd331
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: drop dependency on ARM
Colin Cross [Sat, 23 Nov 2013 06:48:42 +0000 (22:48 -0800)]
ion: drop dependency on ARM

Ion will compile and run on other platforms now, remove the
dependency on ARM.

Change-Id: I9da0ab686708bdab575a021031392b4402cce090
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: Fix two small issues in system_heap allocation
John Stultz [Fri, 22 Nov 2013 23:36:27 +0000 (15:36 -0800)]
ion: Fix two small issues in system_heap allocation

In testing ion system heap allocations, I ran across two issues:

1) Not k*z*allocing the sg table. This can cause trouble if
we end up trying call sg_alloc_table() with too many entries,
then sg_alloc_table() internally fails and tries to free what it
thinks is internal table structure, which causes bad pointer
traversals.

2) The second list_for_each_entry probably should be _safe,
since I was seeing  strange lock warnings and oopses on occasion.
This seems to resolve it, but could use some extra checking.

Change-Id: I59d4c90104a8cf23dc4ae814d0b17348f1b68ac0
Signed-off-by: John Stultz <john.stultz@linaro.org>
10 years agogpu: ion: fix use-after-free in ion_heap_freelist_drain
Mitchel Humpherys [Tue, 6 Aug 2013 18:19:42 +0000 (11:19 -0700)]
gpu: ion: fix use-after-free in ion_heap_freelist_drain

The `buffer' variable is being used after being freed. Fix this.

Change-Id: Iea3471fa7dc7535bbf0620c1639fea2008d7cf19
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
10 years agoion: clean up ioctls
Colin Cross [Sat, 9 Nov 2013 00:55:35 +0000 (16:55 -0800)]
ion: clean up ioctls

Convert the ion ioctls to use _IOW instead of _IOWR where
appropriate, and factor out the copy_from_user and copy_to_user
based on the _IOC_DIR bits.  For the existing incorrect ioctls,
add a function to wrap _IOC_DIR to return the corrected value.

Change-Id: I3cc34c84b9c52305bdbec27a9224447b102fadcd
Signed-off-by: Colin Cross <ccross@android.com>
10 years agogpu: ion: remove unnecessary function from system heap
Colin Cross [Thu, 7 Nov 2013 20:18:57 +0000 (12:18 -0800)]
gpu: ion: remove unnecessary function from system heap

ion_system_contig_heap buffers have an sglist, just call
ion_heap_map_user to map it.

Change-Id: I6dea383955834613fa8833659b31533c957c2b0b
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: fix printk warnings
Colin Cross [Thu, 19 Sep 2013 14:20:23 +0000 (09:20 -0500)]
ion: fix printk warnings

Use %z for size_t and %pa for dma_addr_t to avoid warnings in printks.

Change-Id: I2c72874acd0b69cb35fca691928783817deb9394
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: don't use phys_to_page or __phys_to_pfn
Colin Cross [Thu, 19 Sep 2013 15:13:53 +0000 (10:13 -0500)]
ion: don't use phys_to_page or __phys_to_pfn

phys_to_page and __phys_to_pfn don't exist on all platforms.
Use a combination of pfn_to_page, PFN_DOWN, page_to_pfn, and
virt_to_page to get the same results.

Change-Id: I53cef26059800bc8b7fb85ae458741574c97c257
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: don't use __arm_ioremap to map pages
Colin Cross [Thu, 19 Sep 2013 15:12:05 +0000 (10:12 -0500)]
ion: don't use __arm_ioremap to map pages

ion_heap_map_kernel already implements mapping a scatterlist of
pages into the kernel, and all heaps are required to have struct
pages associated with them, so delete the functions that use
__arm_ioremap and use ion_heap_map_kernel instead.

Change-Id: Ia2dfd8d8c6e719d7d2f68dd4c458826fdb938260
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: update idr to avoid deprecated apis
Colin Cross [Thu, 19 Sep 2013 19:54:56 +0000 (14:54 -0500)]
ion: update idr to avoid deprecated apis

Use idr_alloc instead if idr_pre_get/idr_get_new_above, and
remove idr_remove_all.

Change-Id: I675b789879549bd3767ed3ef2016cf108eb622d2
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: add test device for unit tests to interact with dma_bufs
Colin Cross [Sat, 9 Nov 2013 00:32:47 +0000 (16:32 -0800)]
ion: add test device for unit tests to interact with dma_bufs

Add a /dev/ion-test device that will be created if CONFIG_ION_TEST
is set.  The device accepts a dma_buf fd and allows reading and
writing to the backing memory using DMA-like apis or kernel mapping
apis.  Can be used to test the dma_buf mapping ops, including
the ion implementations, from userspace.

Change-Id: I30703ba69cd75bdfe7767ac642e5f0cacd8d0478
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: check invalid values in ion_system_heap
Colin Cross [Wed, 13 Nov 2013 22:46:06 +0000 (14:46 -0800)]
ion: check invalid values in ion_system_heap

ion_system_heap can only satisfy page alignment, and
ion_system_contig_heap can only satisify alignment to the
allocation size.  Neither can support faulting user mappings
because they use slab pages.

Change-Id: I895c2d4184c672f647f83a17aeb862985dc92f2c
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoARM: fiq_glue: Add custom fiq return handler api.
Arve Hjønnevåg [Tue, 25 Jun 2013 01:02:05 +0000 (18:02 -0700)]
ARM: fiq_glue: Add custom fiq return handler api.

Change-Id: I5ff2764e85151ca0a88576542fda07c2d33dd065
Signed-off-by: Arve Hjønnevåg <arve@android.com>
10 years agonetfilter: xt_qtaguid: fix memory leak in seq_file handlers
Greg Hackmann [Thu, 5 Dec 2013 01:39:27 +0000 (17:39 -0800)]
netfilter: xt_qtaguid: fix memory leak in seq_file handlers

Change-Id: I15b21230d52479d008a00d9e2191dda020f00925
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: fix fbdev blank -> dpms state mapping
Greg Hackmann [Fri, 22 Nov 2013 21:50:24 +0000 (13:50 -0800)]
video: adf: fix fbdev blank -> dpms state mapping

Change-Id: I96132a1b7275d389a6d0ba8899c6be838b63c422
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: validate dpms state passed to blank
Greg Hackmann [Wed, 20 Nov 2013 20:10:35 +0000 (12:10 -0800)]
video: adf: validate dpms state passed to blank

Change-Id: I3a4228d50fc4a2553b3e92e5675a94cbc6e71b8a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: fix ADF_MAX_ATTACHMENTS declaration
Greg Hackmann [Mon, 11 Nov 2013 22:31:12 +0000 (14:31 -0800)]
video: adf: fix ADF_MAX_ATTACHMENTS declaration

Userspace-facing ADF_MAX_ATTACHMENTS must be in terms of
userspace-facing struct adf_attachment_config

Change-Id: Iaaddcd6366f13b3e52eb3911efcfff8a61e0b225
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: remove PAGE_SIZE from userspace-facing header
Greg Hackmann [Wed, 20 Nov 2013 22:02:09 +0000 (14:02 -0800)]
video: adf: remove PAGE_SIZE from userspace-facing header

Systems may define PAGE_SIZE in userspace limits.h but don't have to.
PAGE_SIZE was picked as an arbitrary "reasonable" limit so just use 4096
instead.

Change-Id: I9555e39aba64a3a70f61eb6ded2a4129ab236ce0
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: make device node names less hierarchical
Greg Hackmann [Thu, 7 Nov 2013 18:12:00 +0000 (10:12 -0800)]
video: adf: make device node names less hierarchical

adf/foobar/device -> adf0
adf/foobar/interface1 -> adf-interface0.1
adf/foobar/overlay-engine1 -> adf-overlay-engine0.1

Change-Id: I7af7f84ce3f101ecb02f448070c200ff3e03f2ec
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agoion: convert sg_dma_len(sg) to sg->length
Colin Cross [Tue, 12 Nov 2013 23:28:08 +0000 (15:28 -0800)]
ion: convert sg_dma_len(sg) to sg->length

ion is always dealing with the allocation and not the mapping,
so it should always be using sg->length and not sg->dma_length.

Change-Id: Id9b07f1196b2bafe04636fa1aa46dfc84d003cf0
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: fix dma APIs
Colin Cross [Wed, 18 Sep 2013 17:30:20 +0000 (12:30 -0500)]
ion: fix dma APIs

__dma_page_cpu_to_dev is a private ARM api that is not available
on 3.10 and was never available on other architectures.  We can
get the same behavior by calling dma_sync_sg_for_device with a
scatterlist containing a single page.  It's still not quite a
kosher use of the dma apis, we still conflate physical addresses
with bus addresses, but it should at least compile on all
platforms, and work on any platform that doesn't have a physical
to bus address translation.

Change-Id: I8451c2dae4bf85841015c016640684ac28430a5a
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: fix crash when alloc len is -1
Colin Cross [Wed, 13 Nov 2013 22:44:53 +0000 (14:44 -0800)]
ion: fix crash when alloc len is -1

If userspace passes a length between -4095 and -1 to allocate it
will pass the len != 0 check, but when len is page aligned it will
be 0.  Check len after page aligning.

Drop the warning as well, userspace shouldn't be able to trigger
a warning in the kernel.

Change-Id: I96c7142637638991f3a9af9be7cfbb50f79f3803
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: hold reference to handle after ion_uhandle_get
Colin Cross [Wed, 6 Nov 2013 00:51:27 +0000 (16:51 -0800)]
ion: hold reference to handle after ion_uhandle_get

commit 1262ab1846cf76f7549c66ef709120dbfbe6d49f (ion: replace
userspace handle cookies with idr) broke the locking in ion.
The ION_IOC_FREE and ION_IOC_MAP ioctls were relying on
ion_handle_validate to detect the case where a call raced
with another ION_IOC_FREE which may have freed the struct
ion_handle.

Rename ion_uhandle_get to ion_handle_get_by_id, and have it
take the client lock and return with an extra reference to
the handle.  Make each caller put its reference once it
is done with the handle.

Also modify users of ion_handle_validate to continue to hold
the client lock after calling ion_handle_validate until
they are done with the handle, and warn if ion_handle_validate
is called without the client lock held.

Change-Id: I56da5624fca3bed4ee24806b6ec39de903543341
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: Fix compat support to use proper compat ioctl numbers
John Stultz [Fri, 15 Nov 2013 00:25:08 +0000 (16:25 -0800)]
ion: Fix compat support to use proper compat ioctl numbers

The compat support added to ion didn't provide compat ioctl numbers
(who's value depends on the compat structure size). So 32bit
applications would get an error when trying to make ioctl calls.

This patch adds the needed COMPAT_ macros and uses them in the
compat_ion_ioctl, translating them to their non-compat cmd when
calling the normal ioctl call.

Change-Id: I53636d4ec46d8dc5e694697aaf2d62b98bd78cb1
Signed-off-by: John Stultz <john.stultz@linaro.org>
10 years agoARM: Fix "Make low-level printk work" to use a separate config option
Arve Hjønnevåg [Sat, 15 Jun 2013 02:54:40 +0000 (19:54 -0700)]
ARM: Fix "Make low-level printk work" to use a separate config option

Signed-off-by: Arve Hjønnevåg <arve@android.com>
10 years agoARM: Fix dtb list when DTB_IMAGE_NAMES is empty
Benoit Goby [Fri, 8 Nov 2013 23:24:19 +0000 (15:24 -0800)]
ARM: Fix dtb list when DTB_IMAGE_NAMES is empty

In the 3.10 kernel, dtb-y is not defined in Makefile.boot anymore
but in dts/Makefile, so it needs to be included too.

Change-Id: I6d6fccf933709bcb6220ce8f12b4b9e2a7c40d63
Signed-off-by: Benoit Goby <benoit@android.com>
10 years agoanonymous vma names: fix build with !MMU
Colin Cross [Wed, 30 Oct 2013 20:17:34 +0000 (13:17 -0700)]
anonymous vma names: fix build with !MMU

Disable PR_SET_VMA when building with !MMU

Change-Id: I896b6979b99aa61df85caf4c3ec22eb8a8204e64
Signed-off-by: Colin Cross <ccross@android.com>
10 years agomm: fix anon vma naming
Colin Cross [Wed, 30 Oct 2013 20:14:12 +0000 (13:14 -0700)]
mm: fix anon vma naming

Fix two bugs caused by merging anon vma_naming, a typo in
mempolicy.c and a bad merge in sys.c.

Change-Id: Ia4ced447d50573e68195e95ea2f2b4d9456b8a90
Signed-off-by: Colin Cross <ccross@android.com>
10 years agodrivers: staging: android: split uapi out of sync.h and sw_sync.h
Colin Cross [Thu, 7 Nov 2013 21:46:41 +0000 (13:46 -0800)]
drivers: staging: android: split uapi out of sync.h and sw_sync.h

Move the userspace interfaces of sync.h and sw_sync.h to
drivers/staging/android/uapi/

Change-Id: I3b2598b37385bb993bd03f5faa98a8e196befe45
Signed-off-by: Colin Cross <ccross@android.com>
10 years agodrivers: staging: android: split uapi out of binder.h
Colin Cross [Thu, 7 Nov 2013 21:46:41 +0000 (13:46 -0800)]
drivers: staging: android: split uapi out of binder.h

Move the userspace interface of binder.h to
drivers/staging/android/uapi/binder.h.

Change-Id: I2e56ba89ade5e1f33b121e6ecd456392d588a14e
Signed-off-by: Colin Cross <ccross@android.com>
10 years agodrivers: staging: android: split uapi out of ashmem.h
Colin Cross [Thu, 7 Nov 2013 21:46:41 +0000 (13:46 -0800)]
drivers: staging: android: split uapi out of ashmem.h

Move the userspace interface of ashmem.h to
drivers/staging/android/uapi/ashmem.h

Change-Id: I60f5baa4ce8e2425262a406f2733c089ec55aa72
Signed-off-by: Colin Cross <ccross@android.com>
10 years agodrivers: staging: android: split uapi out of android_alarm.h
Colin Cross [Thu, 7 Nov 2013 21:38:57 +0000 (13:38 -0800)]
drivers: staging: android: split uapi out of android_alarm.h

Move the userspace interface of android_alarm.h to
drivers/staging/android/uapi/android_alarm.h

Change-Id: Ieb96e8e9bf742786efc4e248e6a242dab8199ca3
Signed-off-by: Colin Cross <ccross@android.com>
10 years agonet: move PPPoLAC and PPPoPNS headers to uapi
Colin Cross [Thu, 7 Nov 2013 21:19:34 +0000 (13:19 -0800)]
net: move PPPoLAC and PPPoPNS headers to uapi

Move the entire contents of the linux/if_pppolac.h and
linux/if_pppopns.h headers to uapi, they only contain userspace
interfaces.

Change-Id: I3cfed7f2ae400b53269a1f59144aa3dbc30ae0b5
Signed-off-by: Colin Cross <ccross@android.com>
10 years agousb: gadget: f_accessory: move userspace interface to uapi
Colin Cross [Thu, 7 Nov 2013 21:08:39 +0000 (13:08 -0800)]
usb: gadget: f_accessory: move userspace interface to uapi

Move the entire contents of linux/usb/f_accessory.h header to uapi,
it only contains a userspace interface.

Change-Id: Ieb5547da449588ae554988a201c0e6b4e3afc531
Signed-off-by: Colin Cross <ccross@android.com>
10 years agousb: gadget: f_mtp: move userspace interface to uapi
Colin Cross [Thu, 7 Nov 2013 21:08:15 +0000 (13:08 -0800)]
usb: gadget: f_mtp: move userspace interface to uapi

Move the most of linux/usb/f_mtp.h header to uapi.  Move the only
remaining structure definition into f_mtp.c, the only place that
uses it.

Change-Id: I952c1a9dc15c36bf295a0eb4d74b6b1ad912ed03
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoinput: misc: keychord: move header to uapi
Colin Cross [Thu, 7 Nov 2013 20:46:33 +0000 (12:46 -0800)]
input: misc: keychord: move header to uapi

Move the entire contents of linux/keychord.h header to uapi, it only
contains a userspace interface.

Change-Id: If94f83328b19efb58c66391dce3bd8e927788d8d
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: move userspace api into uapi/ion.h
Colin Cross [Thu, 7 Nov 2013 21:29:12 +0000 (13:29 -0800)]
ion: move userspace api into uapi/ion.h

Split the userspace api out of drivers/staging/android/ion/ion.h
into drivers/staging/android/uapi/ion.h

Change-Id: I51baa4a7c86bf99c493e28a15f8664a489fd5a2d
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: move into staging
Colin Cross [Thu, 7 Nov 2013 20:25:56 +0000 (12:25 -0800)]
ion: move into staging

Move ion from drivers/gpu/ion to drivers/android/staging/ion.

Change-Id: Id6e996aa3954cbb8e1a8abc9578a56204f5eb211
Signed-off-by: Colin Cross <ccross@android.com>
10 years agogpu: ion: delete ion_system_mapper.c
Colin Cross [Fri, 30 Aug 2013 00:50:42 +0000 (17:50 -0700)]
gpu: ion: delete ion_system_mapper.c

The mapper abstraction layer was removed before the initial ion
commit, but a stray ion_system_mapper.c file was left in.  Delete
it.

Change-Id: I0001d1ea1b866ebd7ec1306e94472c67a094855f
Signed-off-by: Colin Cross <ccross@android.com>
10 years agodrivers: switch: remove S_IWUSR from dev_attr
Qiao Zhou [Thu, 31 Oct 2013 01:36:50 +0000 (09:36 +0800)]
drivers: switch: remove S_IWUSR from dev_attr

it doesn't need S_IWUSR attribute since xxx_store API is un-needed.
otherwise the WARN check in device_create_file will alert.

Change-Id: I6360bf022dcd659bfb3f41c84624f954d5d15ea5
Signed-off-by: Qiao Zhou <zhouqiao@marvell.com>
10 years agoMerge branch 'android-3.10-adf' into android-3.10
Greg Hackmann [Tue, 29 Oct 2013 19:43:07 +0000 (12:43 -0700)]
Merge branch 'android-3.10-adf' into android-3.10

10 years agoion: add compat_ioctl
Rom Lemarchand [Thu, 24 Oct 2013 12:39:34 +0000 (05:39 -0700)]
ion: add compat_ioctl

Add a compat_ioctl to the ion driver

Change-Id: I43da387e22ff9c4a29f0159dfe9e898efc500553
Signed-off-by: Rom Lemarchand <romlem@google.com>
10 years agoion: change ion_user_handle_t definition to int
Rom Lemarchand [Thu, 24 Oct 2013 02:30:58 +0000 (19:30 -0700)]
ion: change ion_user_handle_t definition to int

Turn ion_user_handle_t to int. This change reflects the underlying type
returned by the ion driver.

Change-Id: I40390dae8138327769510525bf62e55877a4b37d
Signed-off-by: Rom Lemarchand <romlem@google.com>
10 years agousb: gadget: android: Remove device if probe fails
Benoit Goby [Sat, 19 Oct 2013 00:16:38 +0000 (17:16 -0700)]
usb: gadget: android: Remove device if probe fails

Make sure the android0 device is removed before we can destroy
the class.

Change-Id: Id584888c407beb80a1df4990f73fe31ccb9d4767
Signed-off-by: Benoit Goby <benoit@android.com>
10 years agovideo: adf: expose adf_modeinfo_set_{name,vrefresh} to drivers
Greg Hackmann [Thu, 17 Oct 2013 20:18:53 +0000 (13:18 -0700)]
video: adf: expose adf_modeinfo_set_{name,vrefresh} to drivers

Change-Id: Id9f8b2184927a77b244ce0b33d619d6e44a0f17a
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: set default interface dpms_state to OFF
Greg Hackmann [Wed, 16 Oct 2013 21:53:12 +0000 (14:53 -0700)]
video: adf: set default interface dpms_state to OFF

Interfaces default to unplugged, so they should also default to off

Change-Id: I36500a54b11f354a0d7dd2c9924a79e0d9c6f855
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: make dpms_state sysfs attribute writable
Greg Hackmann [Thu, 15 Aug 2013 19:51:22 +0000 (12:51 -0700)]
video: adf: make dpms_state sysfs attribute writable

Change-Id: I04e7785cbddac160003e6c9edaf62d20b367fdc9
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: add helpers for validating custom formats
Greg Hackmann [Tue, 15 Oct 2013 19:51:20 +0000 (12:51 -0700)]
video: adf: add helpers for validating custom formats

Many custom formats look a lot like the standard ones, but with
different subsampling, bpp, etc.  Expose and document
adf_buffer_validate()'s main body, so drivers can reuse its logic when
validating these formats.

Change-Id: I1d06981c9e5aab26f3ab2956c08c679f2c823bcc
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agosync: Fix a race condition between release_obj and print_obj
Alistair Strachan [Wed, 10 Apr 2013 23:35:14 +0000 (16:35 -0700)]
sync: Fix a race condition between release_obj and print_obj

Before this change, a timeline would only be removed from the timeline
list *after* the sync driver had its release_obj() called. However, the
driver's release_obj() may free resources needed by print_obj().

Although the timeline list is locked when print_obj() is called, it is
not locked when release_obj() is called. If one CPU was in print_obj()
when another was in release_obj(), the print_obj() may make unsafe
accesses.

It is not actually necessary to hold the timeline list lock when calling
release_obj() if the call is made after the timeline is unlinked from
the list, since there is no possibility another thread could be in --
or enter -- print_obj() for that timeline.

This change moves the release_obj() call to after the timeline is
unlinked, preventing the above race from occurring.

Signed-off-by: Alistair Strachan <alistair.strachan@imgtec.com>
(cherry picked from commit 3bfc1e9e0c7d0c0e3f52ee1f3803482416afa295)

Change-Id: Ib2b2b23fde5be34016f9d86b8b9c5e561b56cd4c

10 years agoion: add new ion_user_handle_t type for the user-space token
Rom Lemarchand [Wed, 23 Oct 2013 22:09:11 +0000 (15:09 -0700)]
ion: add new ion_user_handle_t type for the user-space token

Declare new ion_user_handle_t type to contain the token returned to user-space.
This allows a 2-step migration of the user-space code to a new kernel header
first, then will allow us to change the definition of the ion_user_handle_type_t
to int without breaking the API.

Change-Id: I4200b6600df8e56fe98cf1580a13a65cb25ec646
Signed-off-by: Rom Lemarchand <romlem@google.com>
(cherry picked from commit ebb8269bbb05b06ecedca3e21b3e65f23d48eadd)

10 years agocpufreq: interactive: delete timers for GOV_START
Shridhar Rasal [Mon, 9 Sep 2013 13:47:14 +0000 (19:17 +0530)]
cpufreq: interactive: delete timers for GOV_START

Make sure that timers cpu_timer and cpu_slack_timer
deactivated before addition of new.

Change-Id: If31c4049606871df6f00efdc24b1d713c86a6f69
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Signed-off-by: Bharat Nihalani <bnihalani@nvidia.com>
10 years agocpufreq: Interactive: Implement per policy instances of governor
Viresh Kumar [Thu, 16 May 2013 09:28:54 +0000 (14:58 +0530)]
cpufreq: Interactive: Implement per policy instances of governor

If we have a multi-package system, where we have multiple instances of struct
policy (per package), currently we can't have multiple instances of same
governor. i.e. We can't have multiple instances of Interactive governor for
multiple packages.

This is a bottleneck for multicluster system, where we want different packages
to use Interactive governor, but with different tunables.

This patch uses the infrastructure provided by earlier patches pushed in
Mainline in v3.10-rc1/rc2 and implements per policy instances of Interactive
governor.

Change-Id: I70436d4a5a45c6cb6edf37f3e46d0b9fbc930982
[toddpoynor@google.com: merge with later code, minor changes]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
10 years agocpufreq: interactive: Move definition of cpufreq_gov_interactive downwards
Viresh Kumar [Thu, 16 May 2013 09:28:53 +0000 (14:58 +0530)]
cpufreq: interactive: Move definition of cpufreq_gov_interactive downwards

This moves definition of cpufreq_gov_interactive towards the bottom of file, so
that we don't have to add prototype of cpufreq_governor_interactive() in the
beginning of file.

Change-Id: I04bd1004954eb36502c5cd7e35d3d7274cddaf95
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
10 years agocpufreq: interactive: Remove unnecessary cpu_online() check
Viresh Kumar [Thu, 16 May 2013 09:28:52 +0000 (14:58 +0530)]
cpufreq: interactive: Remove unnecessary cpu_online() check

Cpufreq no longer calls governor callback for offlined cpus. i.e. All
policy->cpus are guaranteed to be online. Hence we don't need explicit check to
see if cpu is online or not.

Change-Id: I9ad85ea4addd5b4a40952e59ed730dd15e328690
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
10 years agosync: signal pt before sync_timeline object gets destroyed
Prakash Kamliya [Fri, 4 Oct 2013 12:20:50 +0000 (17:50 +0530)]
sync: signal pt before sync_timeline object gets destroyed

There is a race condition

Assume we have *one* sync_fence object, with *one* sync_pt
which belongs to *one* sync_timeline, given this condition,
sync_timeline->kref will have two counts, one for sync_timeline
(implicit) and another for sync_pt.

Assume following is the situation on CPU

Theead-1 : (Thread which calls sync_timeline_destroy())
  -> (some function calls)
   -> sync_timeline_destory()
    -> sync_timeline_signal() (CPU is inside this
function after putting reference to sync_timeline)

At this time Thread-2 comes and does following

Thread-2 : (fclose on fence fd)
> sync_fence_release() -> because of fclose() on fence object
 -> sync_fence_free()
  -> sync_pt_free()
   -> kref_put(&pt->parent->kref, sync_timeline_free);
    -> sync_timeline_free() (CPU is inside this because
this time kref will be zero after _put)

Thread-2 will free sync_timeline object before Thread-1
has finished its work inside sync_timeline_signal.

With this change we signals all sync_pt before putting
reference to sync_timeline object.

Change-Id: Ic680e4d0bbef1c46bcb7cfba693395645241d203
Signed-off-by: Prakash Kamliya <pkamliya@codeaurora.org>
10 years agovideo: adf: add informational flags to interfaces
Greg Hackmann [Fri, 13 Sep 2013 18:23:05 +0000 (11:23 -0700)]
video: adf: add informational flags to interfaces

Informational flags don't affect ADF directly but may be useful to
clients.  Currently used to indicate primary and external displays.

Change-Id: I343c7f0148da0869244c8e818350e9855525df85
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: add fbdev compatibility helper
Greg Hackmann [Tue, 9 Jul 2013 20:07:26 +0000 (13:07 -0700)]
video: adf: add fbdev compatibility helper

Change-Id: I2b82bb625f805e8edb27799743b290dda5befb97
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: add supported formats to adf_overlay_engine_data
Greg Hackmann [Tue, 11 Jun 2013 19:59:41 +0000 (12:59 -0700)]
video: adf: add supported formats to adf_overlay_engine_data

Change-Id: If2aa783b9ece60160f465bf697508fc58682e1bc
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: support "simple" buffers
Greg Hackmann [Thu, 10 Oct 2013 20:03:26 +0000 (13:03 -0700)]
video: adf: support "simple" buffers

Simple buffers are linear RGB buffers analogous to KMS's dumb buffers.
Simple buffers can be allocated and posted to a display interface
without any driver-private data.

Internally, ADF drivers provide the driver-private data needed (if any)
to post a simple buffer to the display.

Change-Id: Ib0b737622eaf343111310f6623f99d69cf3807d2
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: adf: add memblock helper
Greg Hackmann [Mon, 8 Jul 2013 21:18:18 +0000 (14:18 -0700)]
video: adf: add memblock helper

Provides a dma-buf exporter for memblocks, mainly useful for ADF devices
to wrap their bootloader logos

Change-Id: I936a9b5df099ab6084d433fcaf50f3bc29f93289
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agovideo: add atomic display framework
Greg Hackmann [Wed, 22 May 2013 21:23:10 +0000 (14:23 -0700)]
video: add atomic display framework

Change-Id: I693257e269a99012cd0dbb57576ac222869cf4c7
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agostaging: sw_sync: add stubs for kernels without CONFIG_SW_SYNC
Greg Hackmann [Fri, 11 Oct 2013 20:54:41 +0000 (13:54 -0700)]
staging: sw_sync: add stubs for kernels without CONFIG_SW_SYNC

Change-Id: I7a12679eb3c10b1beaf36c6612cf2e3f6662a034
Signed-off-by: Greg Hackmann <ghackmann@google.com>
10 years agomm: remove compressed copy from zram in-memory
Minchan Kim [Wed, 3 Jul 2013 22:01:24 +0000 (15:01 -0700)]
mm: remove compressed copy from zram in-memory

Swap subsystem does lazy swap slot free with expecting the page would be
swapped out again so we can avoid unnecessary write.

But the problem in in-memory swap(ex, zram) is that it consumes memory
space until vm_swap_full(ie, used half of all of swap device) condition
meet.  It could be bad if we use multiple swap device, small in-memory
swap and big storage swap or in-memory swap alone.

This patch makes swap subsystem free swap slot as soon as swap-read is
completed and make the swapcache page dirty so the page should be
written out the swap device to reclaim it.  It means we never lose it.

I tested this patch with kernel compile workload.

1. before

   compile time : 9882.42
   zram max wasted space by fragmentation: 13471881 byte
   memory space consumed by zram: 174227456 byte
   the number of slot free notify: 206684

2. after

   compile time : 9653.90
   zram max wasted space by fragmentation: 11805932 byte
   memory space consumed by zram: 154001408 byte
   the number of slot free notify: 426972

[akpm@linux-foundation.org: tweak comment text]
[artem.savkov@gmail.com: fix BUG due to non-swapcache pages in end_swap_bio_read()]
[akpm@linux-foundation.org: invert unlikely() test, augment comment, 80-col cleanup]
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Konrad Rzeszutek Wilk <konrad@darnok.org>
Cc: Shaohua Li <shli@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
10 years agoAdd compat_ioctl support for VFAT_IOCTL_GET_VOLUME_ID
Bintian Wang [Sun, 30 Jun 2013 12:34:24 +0000 (20:34 +0800)]
Add compat_ioctl support for VFAT_IOCTL_GET_VOLUME_ID

Add VFAT_IOCTL_GET_VOLUME_ID to vfat dir compat_ioctl() interface,
which enable you read vfat volume ID from a 32bit app on a 64bit
kernel

Change-Id: I3e93dfcc1e7a364a6b11bc7e3f5f210e82f306ed
Signed-off-by: Bintian Wang <bintian.wang@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
10 years agoUSB: remove duplicate out endpoint creation in MTP mode
Peter Oh [Thu, 12 Sep 2013 01:42:18 +0000 (01:42 +0000)]
USB: remove duplicate out endpoint creation in MTP mode

Android MTP gadget uses 3 endpoints which are 1 in endpoint,
1 out endpoint, and 1 interrupt endpoint. However when MTP
gadget creates its endpoints, it creates the out endpoint twice
and overwrites the first created out endpoint with the second one,
so that it causes a leak of endpoint resources.

Change-Id: Iba82950095610b26b362f4b10a67cedfb1fee366
Signed-off-by: Peter Oh <poh@broadcom.com>
Reviewed-on: http://mps-gerrit.broadcom.com/37744
Reviewed-by: Graham Williams <gwilli@broadcom.com>
Reviewed-by: John Garry <jgarry@broadcom.com>
Branch-Open: Branch Status <branch_status_noreply@broadcom.com>
Reviewed-by: Checkpatch Status <checkpatch_status_noreply@broadcom.com>
Reviewed-by: Joyjit Nath <joyjit@broadcom.com>
Tested-by: AutoSubmit Status <autosubmit_status_noreply@broadcom.com>
10 years agocpufreq: interactive: fix show_target_loads and show_above_hispeed_delay
Minsung Kim [Sun, 25 Aug 2013 10:23:34 +0000 (19:23 +0900)]
cpufreq: interactive: fix show_target_loads and show_above_hispeed_delay

Remove a trailing whitespace from target_loads and above_hispeed_delay. Problem
happens when user-space program tried to restore parameters that saved before
changing parameters. In this case was returned error(EINVAL).

Change-Id: I5a74e3824602cd6f2b74651adda5ec1b627e61e9
Signed-off-by: Minsung Kim <ms925.kim@samsung.com>
10 years agoion: don't use id 0 for handle cookie
Colin Cross [Fri, 23 Aug 2013 02:29:44 +0000 (19:29 -0700)]
ion: don't use id 0 for handle cookie

ion userspace clients think that the cookie is a pointer, so they
use NULL to check if the handle has been initialized.  Set the first
id number to 1.

Change-Id: Ifb9af6029a8b08f57e41bc6160cc11e11001a2a9
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: index client->handles rbtree by buffer
Colin Cross [Wed, 21 Aug 2013 18:23:12 +0000 (11:23 -0700)]
ion: index client->handles rbtree by buffer

The only remaining users of the client->handles rbtree are
iterating through it like a list.  Keep the rbtree, but change
its index to be the buffer address instead of the handle address,
which makes ion_handle_lookup a fast rbtree search.

Change-Id: Ie7d974b3a5d9831c0d664de85ddae8db3c3abdf9
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: replace userspace handle cookies with idr
Colin Cross [Wed, 21 Aug 2013 05:59:41 +0000 (22:59 -0700)]
ion: replace userspace handle cookies with idr

Userspace handles should not leak kernel virtual addresses to
userspace.  They have to be validated by looking them up in an
rbtree anyways, so replace them with an idr and validate them
by using idr_find to convert the id number to the struct
ion_handle pointer.

Change-Id: Iab5667ba6f3a73256fec3949b23a9a6f8e14a283
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: remove IS_ERR_OR_NULL
Colin Cross [Wed, 21 Aug 2013 04:31:34 +0000 (21:31 -0700)]
ion: remove IS_ERR_OR_NULL

IS_ERR_OR_NULL is often part of a bad pattern that can accidentally
return 0 on error:
if (IS_ERR_OR_NULL(ptr))
    return PTR_ERR(ptr);

It also usually means that the errors of a function are not well
defined.  Replace all uses in ion.c by ensure that the return
type of any function in ion is an ERR_PTR.

Specify that the expected return value from map_kernel or map_dma
heap ops is ERR_PTR, and warn if a heap returns NULL.

Change-Id: I6e7ea0d2e62fa08d4e372a7ef6da649f7a62289c
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: convert map_kernel to return ERR_PTR
Colin Cross [Wed, 21 Aug 2013 19:50:37 +0000 (12:50 -0700)]
ion: convert map_kernel to return ERR_PTR

ion is going to stop accepting NULL as an error value, use ERR_PTR.

Change-Id: I030e8b72138904e38a4a5d225beaaa98427651fb
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: add free list size to heap debug files
Colin Cross [Wed, 14 Aug 2013 21:10:19 +0000 (14:10 -0700)]
ion: add free list size to heap debug files

Change-Id: I3c6309afdbd661a2f870fd1ba3fea9543e229882
Signed-off-by: Colin Cross <ccross@android.com>
10 years agoion: chunk_heap: fix leak in allocated counter
Colin Cross [Wed, 14 Aug 2013 21:03:55 +0000 (14:03 -0700)]
ion: chunk_heap: fix leak in allocated counter

buffer->size is controlled by the outer ion layer, don't modify it
inside the heap.  Instead, compute the rounded up allocated size
on demand.

Change-Id: I288ffc1221ce96cfe2591468502ac3279065bde4
Signed-off-by: Colin Cross <ccross@android.com>
10 years agomm: add a field to store names for private anonymous memory
Colin Cross [Thu, 27 Jun 2013 00:26:01 +0000 (17:26 -0700)]
mm: add a field to store names for private anonymous memory

Userspace processes often have multiple allocators that each do
anonymous mmaps to get memory.  When examining memory usage of
individual processes or systems as a whole, it is useful to be
able to break down the various heaps that were allocated by
each layer and examine their size, RSS, and physical memory
usage.

This patch adds a user pointer to the shared union in
vm_area_struct that points to a null terminated string inside
the user process containing a name for the vma.  vmas that
point to the same address will be merged, but vmas that
point to equivalent strings at different addresses will
not be merged.

Userspace can set the name for a region of memory by calling
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, (unsigned long)name);
Setting the name to NULL clears it.

The names of named anonymous vmas are shown in /proc/pid/maps
as [anon:<name>] and in /proc/pid/smaps in a new "Name" field
that is only present for named vmas.  If the userspace pointer
is no longer valid all or part of the name will be replaced
with "<fault>".

The idea to store a userspace pointer to reduce the complexity
within mm (at the expense of the complexity of reading
/proc/pid/mem) came from Dave Hansen.  This results in no
runtime overhead in the mm subsystem other than comparing
the anon_name pointers when considering vma merging.  The pointer
is stored in a union with fieds that are only used on file-backed
mappings, so it does not increase memory usage.

Change-Id: Ie2ffc0967d4ffe7ee4c70781313c7b00cf7e3092
Signed-off-by: Colin Cross <ccross@android.com>
10 years agopower_supply: kill android-battery driver
Todd Poynor [Tue, 30 Jul 2013 23:45:24 +0000 (16:45 -0700)]
power_supply: kill android-battery driver

Discontinued in favor of future userspace charging helpers.

Change-Id: I840a94ff42e2219cfd8759f919f6188355a63d92
Signed-off-by: Todd Poynor <toddpoynor@google.com>
10 years agoadd extra free kbytes tunable
Rik van Riel [Thu, 1 Sep 2011 19:26:50 +0000 (15:26 -0400)]
add extra free kbytes tunable

Add a userspace visible knob to tell the VM to keep an extra amount
of memory free, by increasing the gap between each zone's min and
low watermarks.

This is useful for realtime applications that call system
calls and have a bound on the number of allocations that happen
in any short time period.  In this application, extra_free_kbytes
would be left at an amount equal to or larger than than the
maximum number of allocations that happen in any burst.

It may also be useful to reduce the memory use of virtual
machines (temporarily?), in a way that does not cause memory
fragmentation like ballooning does.

[ccross]
Revived for use on old kernels where no other solution exists.
The tunable will be removed on kernels that do better at avoiding
direct reclaim.

Change-Id: I765a42be8e964bfd3e2886d1ca85a29d60c3bb3e
Signed-off-by: Rik van Riel<riel@redhat.com>
Signed-off-by: Colin Cross <ccross@android.com>
10 years agogpu: ion: Fix performance issue in faulting code
Rebecca Schultz Zavin [Wed, 12 Jun 2013 22:22:16 +0000 (15:22 -0700)]
gpu: ion: Fix performance issue in faulting code

Previously the code to fault ion buffers in one page at a time had a
performance problem caused by the requirement to traverse the sg list
looking for the right page to load in (a result of the fact that the items in
the list may not be of uniform size).  To fix the problem, for buffers
that will be faulted in, also keep a flat array of all the pages in the buffer
to use from the fault handler.  To recover some of the additional memory
footprint this creates per buffer, dirty bits used to indicate which
pages have been faulted in to the cpu are now stored in the low bit of each
page struct pointer in the page array.

Change-Id: I891b077dc0c88ed6d416b256626d8778fd67be84
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
10 years agogpu: ion: add CMA heap
Benjamin Gaignard [Fri, 22 Mar 2013 17:08:30 +0000 (18:08 +0100)]
gpu: ion: add CMA heap

New heap type ION_HEAP_TYPE_DMA where allocation is done with dma_alloc_coherent API.
device coherent_dma_mask must be set to DMA_BIT_MASK(32).
ion_platform_heap private field is used to retrieve the device linked to CMA,
if NULL the default CMA area is used.
ion_cma_get_sgtable is a copy of dma_common_get_sgtable function which should
be in kernel 3.5

Change-Id: If4b1a3f9c8a6bd72053226208832f4971e44372f
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
10 years agogpu: ion: fix ion_platform_data definition
Benjamin Gaignard [Fri, 22 Mar 2013 17:08:29 +0000 (18:08 +0100)]
gpu: ion: fix ion_platform_data definition

fix ion_platform_heap to make is use an usual way in board configuration file.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
10 years agoARM: kgdb: ignore breakpoint instructions from user mode
Todd Poynor [Wed, 3 Jul 2013 22:48:04 +0000 (15:48 -0700)]
ARM: kgdb: ignore breakpoint instructions from user mode

Avoid conflicts with user mode usage of the same instructions, as with
Clang -ftrapv.

Change-Id: I12d1c6d8f94376bfd2503cb0be843d7e478fb6ea
Signed-off-by: Todd Poynor <toddpoynor@google.com>
10 years agokconfig: Fix defconfig when one choice menu selects options that another choice menu...
Arve Hjønnevåg [Fri, 7 Jun 2013 03:05:40 +0000 (20:05 -0700)]
kconfig: Fix defconfig when one choice menu selects options that another choice menu depends on

The defconfig and Kconfig combination below, which is based on 3.10-rc4
Kconfigs, resulted in several options getting set to "m" instead of "y".

defconfig:
---
CONFIG_MODULES=y
CONFIG_USB_GADGET=y
CONFIG_USB_ZERO=y
---

Kconfig:
---
menuconfig MODULES
bool "Enable loadable module support"

config CONFIGFS_FS
tristate "Userspace-driven configuration filesystem"

config OCFS2_FS
        tristate "OCFS2 file system support"
        depends on CONFIGFS_FS
        select CRC32

config USB_LIBCOMPOSITE
tristate
select CONFIGFS_FS

choice
tristate "USB Gadget Drivers"
default USB_ETH

config USB_ZERO
tristate "Gadget Zero (DEVELOPMENT)"
select USB_LIBCOMPOSITE

config USB_ETH
tristate "Ethernet Gadget (with CDC Ethernet support)"
select USB_LIBCOMPOSITE

endchoice

config CRC32
        tristate "CRC32/CRC32c functions"
        default y

choice
        prompt "CRC32 implementation"
        depends on CRC32
        default CRC32_SLICEBY8

config CRC32_SLICEBY8
        bool "Slice by 8 bytes"

endchoice

---

Signed-off-by: Arve Hjønnevåg <arve@android.com>
10 years agonetfilter: xt_qtaguid: 3.10 fixes
Arve Hjønnevåg [Tue, 14 May 2013 03:45:02 +0000 (20:45 -0700)]
netfilter: xt_qtaguid: 3.10 fixes

Stop using obsolete procfs api.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
10 years agomisc: uidstat: Remove use of obsolete create_proc_read_entry api
Arve Hjønnevåg [Tue, 14 May 2013 03:34:22 +0000 (20:34 -0700)]
misc: uidstat: Remove use of obsolete create_proc_read_entry api

Signed-off-by: Arve Hjønnevåg <arve@android.com>
10 years agonetfilter: xt_quota2: 3.10 fixes.
Arve Hjønnevåg [Tue, 14 May 2013 03:42:46 +0000 (20:42 -0700)]
netfilter: xt_quota2: 3.10 fixes.

- Stop using obsolete create_proc_entry api.
- Use proc_set_user instead of directly accessing the private structure.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
10 years agonet: activity_stats: Stop using obsolete create_proc_read_entry api
Arve Hjønnevåg [Tue, 14 May 2013 03:39:30 +0000 (20:39 -0700)]
net: activity_stats: Stop using obsolete create_proc_read_entry api

Convert to use seq_read

Signed-off-by: Arve Hjønnevåg <arve@android.com>