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.

Change-Id: I9c79b30e3105e796060fc74b058f04093ee5e96e
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
gpu: ion: Fix bug where MAP ioctl was no longer supported

Change-Id: Idbe628ed7dbd6a14469194120b94934d6e99d367
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
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.

Change-Id: I715be6f4cf020a84ca4f1947c30ee3d2559fb523
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
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.

Change-Id: If64591798bdc2c248bf9064ace2c927909d7adb8
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
gpu: ion: Add chunk heap

This patch adds support for a chunk heap that allows for buffers that are
made up of a list of fixed size chunks taken from a carveout.  Chunk sizes
are configured when the heaps are created by passing the chunk size in the
priv field of the heap platform data.

Change-Id: Ia9e003f727b553a92804264debe119dcf78b14e0
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
gpu: ion: Clarify variable names and comments around heap ids v types

There is some confusion between when to use the heap type and when
the id.  This patch clarifies this by using clearer variable names
and describing the intention in the comments.  Also fixes the client
debug code to print heaps by id instead of type.

Change-Id: Ie8b3dadded52e18590fcb2ca94001f6ed46ef07d
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
gpu: ion: Export ion_client_create

Will enable modules to allocate memory with ion.

Signed-off-by: Johan Mossberg <johan.mossberg@stericsson.com>
gpu: ion: Remove heapmask from client

The heapmask in the client generally wasn't being used.  This
patch removes it.

Change-Id: I3526723fbf8f2e81c28c0733deb583ea14bdd837
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
cpufreq: interactive: adjust load for changes in speed

Add notifier for speed transitions.  Keep a count of CPU active
microseconds times current frequency, converted to a percentage relative
to the current frequency when load is evaluated.

Change-Id: I5c27adb11081c50490219784ca57cc46e97fc28c
Signed-off-by: Todd Poynor <toddpoynor@google.com>
cpufreq: interactive: specify duration of CPU speed boost pulse

Sysfs attribute boostpulse_duration specifies the duration of boosting CPU
speed in response to bootpulse events.  Duration is specified in usecs,
default 80ms.

Change-Id: Ifd41625574891a44f1787a4e85d1e7b4f2afb52b
Signed-off-by: Todd Poynor <toddpoynor@google.com>
hardlockup: detect hard lockups without NMIs using secondary cpus

Emulate NMIs on systems where they are not available by using timer
interrupts on other cpus.  Each cpu will use its softlockup hrtimer
to update a per-cpu timestamp and then check the timestamp on the
next cpu.

The emulation uses the softlockup threshold instead of the hardlockup
threshold because the implementation runs at the same resolution as
the softlockup detector.

This patch is useful on systems where the hardlockup detector is not
available due to a lack of NMIs, for example most ARM SoCs.
Without this patch any cpu stuck with interrupts disabled can
cause a hardware watchdog reset with no debugging information,
but with this patch the kernel can detect the lockup and panic,
which can result in useful debugging info.

Change-Id: I3e6de6da27183b2a0a73a390e394f95a945856d9
Signed-off-by: Colin Cross <ccross@android.com>
cpufreq: interactive: add timer slack to limit idle at speed > min

Always use deferrable timer for load sampling.

Set a non-deferrable timer to an additional slack time to allow prior to
waking up from idle to drop speed when not at minimum speed.  Slack value
-1 avoids wakeups to drop speed.  Default is 80ms.

Remove the governidle module param and its timer management in idle.  For
platforms on which holding speed above mimum in idle costs power, use the
new timer slack to select how long to wait before waking up to drop speed.

Change-Id: I270b3980667e2c70a68e5bff534124b4411dbad5
Signed-off-by: Todd Poynor <toddpoynor@google.com>
net: wireless: bcmdhd: Postpone taking wd_wake lock

Change-Id: I3926d7a1a357d173144f408996f35f0929db711e
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
net: wireless: bcmdhd: Update to Version 1.28-23

- Add locale support via NL80211_CMD_REQ_SET_REG
- Fix P2P and VSDB
- Move setting for KEEP_ALIVE and PNO_LOCK into Makefile as
  CUSTOM_PNO_EVENT_LOCK_xTIME and CUSTOM_KEEP_ALIVE_SETTING

Change-Id: I4d2e7c1c72f1109cc9ca3c79b07ad76aea1fd513
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
cpufreq: interactive: fix boosting logic

35a84de cpufreq: interactive: apply above_hispeed_delay to each step above hispeed

caused the speed choice logic to osciallate between boosting and not boosting.
Add back code to ensure speed does not drop below boost frequency while
boosting.

Change-Id: Id420068480fcc7f5c4989ff523e2a8d22e2f4db2
Signed-off-by: Todd Poynor <toddpoynor@google.com>
cpufreq: interactive: fix racy timer stopping

When stopping the governor, del_timer_sync() can race against an
invocation of the idle notifier callback, which has the potential
to reactivate the timer.

To fix this issue, a read-write semaphore is used. Multiple readers are
allowed as long as pcpu->governor_enabled is true.  However it can be
moved to false only after taking a write semaphore which would wait for
any on-going asynchronous activities to complete and prevent any more of
those activities to be initiated.

[toddpoynor@google.com: cosmetic and commit text changes]
Change-Id: Ib51165a735d73dcf964a06754c48bdc1913e13d0
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
cpufreq: interactive: fix race on timer restart on governor start

Starting the governor, or restarting on a hotplugged-in CPU, can race
with the timer start in idle, triggering a BUG on timer already pending.
Start the timer before setting the enable flag, and use enable_sem to
protect the sequence (and ensure correct order of the update to the
enable flag).  Delete any existing timer for safety.

Change-Id: Ife77cf9fe099e8fd8543224cbf148c6722c2ffb0
Reported-by: Francisco Franco <francisco.franco@cloudcar.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
cpufreq: interactive: default go_hispeed_load 99%, doc updates

Update default go_hispeed_load from 85% to 99%.  Recent changes to the
governor now use a default target_load of 90%.  go_hispeed_load should
not be lower than the target load for hispeed_freq, which could lead
to oscillating speed decisions.  Other recent changes reduce the need
to dampen speed jumps on load spikes, while input event boosts from
userspace are the preferred method for anticipating load spikes with
UI impacts.

General update to the documentation to reflect recent changes.

Change-Id: I1b92f3091f42c04b10503cd1169a943b5dfd6faf
Signed-off-by: Todd Poynor <toddpoynor@google.com>
cpufreq: interactive: init default values at compile time

Change-Id: Ia4966e949a6c24c34fdbd4a6e522cd7c37e4108e
Signed-off-by: Todd Poynor <toddpoynor@google.com>