Linux 3.0.88
Revert "mali: GPU OC/UV"

This reverts commit 814a3c9dbc915fd968caeaeedd81dcf2bfd24cf9.
mali: GPU clock and voltage control including auto-applied full freq. range voltage table (Yank555.lu)

- Fixed a derp in mali_platform_dvfs.c that impeeded voltage being initialized for highest frequency (Yank555.lu)

    mali_dvfs_table_update gets called before the initialization of the ASV level, which
    at that stage is reported as ASV 0 when it is 6 once boot is completed on my device

- Included proper voltage table for all 20 freq. levels with automatic update when changing any GPU freq. (Yank555.lu)

SysFS interface :

 * clock control (old legacy interface) :
 *
 *    - set frequencies (5 steps) :
 *
 *          echo "step0 step1 step2 step3 step4" > /sys/class/misc/gpu_clock_control/gpu_control
 *
 *      available frequency steps :
 *
 *           54,  108,  160,  200*, 266,  275, 300,
 *          333,  350,  400*, 440,  500*, 533, 600*,
 *          640*, 666*, 700*, 733*, 750*, 800
 *          (* newly introduced steps)
 *
 *      NB: Any change will trigger a reset of all voltages !
 *
 *    - set frequency-step thresholds (up & down) :
 *
 *          echo "step0_up% step1_down% step1_up% step2_down% step2_up% step3_down% step3_up% step4_down%" > /sys/class/misc/gpu_clock_control/gpu_control
 *
 *      available thresholds :
 *
 *          0% - 100%
 *
 *    - set staycount for each step (default = 0) :
 *
 *          echo "step0 step1 step2 step3 step4" > /sys/class/misc/gpu_clock_control/gpu_staycount
 *
 *      available staycount values :
 *
 *          0 - 255
 *
 * clock control (new interface) :
 *
 *    - set frequencies (5 steps) :
 *
 *          echo "freq" > /sys/class/misc/gpu_clock_control/gpu_freq_0...4
 *
 *      available frequency steps :
 *
 *           54,  108,  160,  200*, 266,  275, 300,
 *          333,  350,  400*, 440,  500*, 533, 600*,
 *          640*, 666*, 700*, 733*, 750*, 800
 *          (* newly introduced steps)
 *
 *      NB: Only actually existing steps will be accepted (old legacy accepts anything between min and max !!)
 *          Any change will trigger a reset of all voltages !
 *
 *    - set frequency-step thresholds (up & down) :
 *
 *          echo "threshold" > /sys/class/misc/gpu_clock_control/gpu_upthreshold_0...3
 *
 *          echo "threshold" > /sys/class/misc/gpu_clock_control/gpu_downthreshold_1...4
 *
 *      available thresholds :
 *
 *          0 - 100
 *
 *    - set staycount for each step (default = 0) :
 *
 *          echo "staycount" > /sys/class/misc/gpu_clock_control/gpu_staycount_0...4
 *
 *      available staycount values :
 *
 *          0 - 255
 *
 *    - list all available frequencies (read-only) :
 *
 *          cat /sys/class/misc/gpu_clock_control/available_frequencies
 *
 * voltage control (old legacy interface) :
 *
 *    - set frequency-step voltage (5 steps) :
 *
 *          echo "step0 step1 step2 step3 step4" > /sys/class/misc/gpu_voltage_control/gpu_control
 *
 *      available voltages :
 *
 *          600000 - 1400000
 *
 * voltage control (new interface) :
 *
 *    - set frequency-step voltage (5 steps) :
 *
 *          echo "voltage" > /sys/class/misc/gpu_voltage_control/gpu_voltage_0...4
 *
 *      available voltages :
 *
 *          600000 - 1400000
 *
 *    - display ASV level (read-only) :
 *
 *          cat /sys/class/misc/gpu_voltage_control/asv_level
 *
 *    - recalculate mali_dvfs_table (write-only) :
 *
 *          echo 1 > /sys/class/misc/gpu_voltage_control/mali_dvfs_table_update
Version 0.6a - scaling logic felxibility (in cooperation with Yank555)
Changelog:

  - added check if CPU freq. table is in ascending or descending order and scale accordingly
    (compatibility for systems with 'inverted' frequency table like it is on OMAP4 platform)
    thanks and credits to Yank555
rename temasek defconfig
Update/rename temasek defconfig
Revert "zram: optimize for Android use"

This reverts commit e76aafb05b9b6764bd9283001975f9ab8a7583f1.
Revert "Staging: Migrate Zram to ZsmAlloc"

This reverts commit 5928d555cc01d14629826b7b2323ea83db945624.
Revert "Backport zcache and zsmalloc from 3.4"

This reverts commit 7eda2bed5e583e9ce3accaca6e2933a953da502b.

Conflicts:

	drivers/staging/Makefile
Revert "Replaced SNAPPY-v3 with faster LZ4 compress/decompress algorithm"

This reverts commit cd5f9552848b8a72c0424a5c120e170b52a80229.

Conflicts:

	drivers/staging/Makefile
Staging: zram: Refactor zram_read/write() functions

This patch refactor the code of zram_read/write() functions. It does
not removes a lot of duplicate code alone, but is mostly a helper for
the third patch of this series (Staging: zram: allow partial page
operations).

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Conflicts:

	drivers/staging/zram/zram_drv.c
Staging: zram: allow partial page operations

Commit 7b19b8d45b216ff3186f066b31937bdbde066f08 (zram: Prevent overflow
in logical block size) introduced ZRAM_LOGICAL_BLOCK_SIZE constant to
prevent overflow of logical block size on 64k page kernel.
However, the current implementation of zram only allow operation on block
of the same size as a page. That makes theorically legit 4k requests fail
on 64k page kernel.

This patch makes zram allow operation on partial pages. Basically, it
means we still do operations on full pages internally, but only copy the
relevent segments from/to the user memory.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Staging: zram: Replace mutex lock by a R/W semaphore

Currently, nothing protects zram table from concurrent access.
For instance, ZRAM_UNCOMPRESSED bit can be cleared by zram_free_page()
called from a concurrent write between the time ZRAM_UNCOMPRESSED has
been set and the time it is tested to unmap KM_USER0 in
zram_bvec_write(). This ultimately leads to kernel panic.

Also, a read request can occurs when the page has been freed by a
running write request and before it has been updated, leading to
zero filled block being incorrectly read and "Read before write"
error message.

This patch replace the current mutex by a rw_semaphore. It extends
the protection to zram table (currently, only compression buffers are
protected) and read requests (currently, only write requests are
protected).

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Staging: zram: Fix kunmapping order

This patch fixes the unmapping order of KM_USER0/1 in
handle_uncompressed_page() and zram_read() so that kmap()/kunmap() calls
are correctly nested.

Reported-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Reviewed-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
staging: zram: make global var "num_devices" use unique name

The global variable "num_devices" is too general to be
global. This patch switches the name to be "zram_num_devices".

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
staging: zram: fix zram locking

Currently init_lock only prevents concurrent execution of zram_init_device()
and zram_reset_device() but not zram_make_request() nor sysfs store functions.

This patch changes init_lock into a rw_semaphore. A write lock is taken by
init, reset and store functions, a read lock is taken by zram_make_request().
Also, avoids to release the lock before calling __zram_reset_device() for
cleaning after a failed init, thus preventing any concurrent task to see an
inconsistent state of zram.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
staging: zram: prevent accessing an unallocated table when init fails early

When the allocation of zram->table fails, we set zram->disksize to zero
to prevent accessing the unallocated table entries during cleanup.
However, we currently don't take this precaution when the initialization
fails earlier.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
zram: Fix sparse warnings

Fixes sparse warning:
zram_drv.c:666:6: warning: symbol 'zram_slot_free_notify' was not
declared. Should it be static?

Also, max_zpage_size is now size_t just to be consistent with data-type
of other variables maintaining sizes of various kinds.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Staging: zram/zram_sysfs.c: Fixed call of obsolete function strict_strtoX

As reported by checkpatch.pl strict_strtoX is obsolet and should be
replaced by kstrtoX.

Signed-off-by: Sergey Datsevich <srgdts@gmail.com>
Signed-off-by: Bjoern Meier <bjoernmeier@hotmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Staging: zram: Add a missing GFP_KERNEL specifier in zram_init_device()

The allocation of zram->compress_buffer is misssing a GFP_* specifier.
This is equivalent to GFP_NOWAIT but it is more likely a omission.
Since the allocation just above it uses GFP_KERNEL, there is no reason
to use GFP_NOWAIT here. Therefore, add GFP_KERNEL.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>