msm: platsmp-8625: cleanup macro names

All the macros defined for 8625 secondary core indicates dual
core. Cleanup macros to be more generic to fit for multi core.

Change-Id: Ia21b2fe6e4a980ae1d60729ceb4085d1a72a16d3
Signed-off-by: Taniya Das <tdas@codeaurora.org>
msm: board-7627a: Add power driver platform data for 8x25Q

Add different LPM modes platform data for 8x25Q.

Signed-off-by: Murali Nalajala <mnalajal@codeaurora.org>
(cherry picked from commit 28ced1b50a13a87303165ddf047205eddbbb4fa9)

Change-Id: I07846c4729d3653faf147241fc6fc5796b35b815
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
board: 7627a: Update the GDFS residency values to optimal value.

The current residency setting of 6msec for GDFS is way too high to be
entered during active test cases like video, gfx. We profiled this setting
for optimal value on Strider and found 500usec is large enough without
sacrificing the power savings. Hence this change updates the setting to
500usec.

Signed-off-by: Krishna Vanka <kvanka@codeaurora.org>
(cherry picked from commit d89bcd21b554311da13f429f1733d5f9103fa8d0)

Change-Id: I30857ec5e488576700a8f4c018d06819717e3d63
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
Revert "board: 7627a: Update the GDFS residency values to optimal value."

This reverts commit 236e0c867bee95638cc4fa5f17d5b50dae68ab92.

Change-Id: I1b162e31d9ee1af66d5b961ca6b47f874427e3fb
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
board: 7627a: Update the GDFS residency values to optimal value.

The current residency setting of 6msec for GDFS is way too high to be
entered during active test cases like video, gfx. We profiled this setting
for optimal value on Strider and found 500usec is large enough without
sacrificing the power savings. Hence this change updates the setting to
500usec.

(cherry picked from commit d89bcd21b554311da13f429f1733d5f9103fa8d0)

(cherry picked from commit 236e0c867bee95638cc4fa5f17d5b50dae68ab92)

Change-Id: I3c4050c8a2f41909ae507ef1fc942eadede5e9c7
Signed-off-by: Krishna Vanka <kvanka@codeaurora.org>
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
msm: 7627a: Increase ADSP heap size to 19MB

ADSP heap memory is increased from 18MB to 19MB to support
720P video playback suspend/resume and CTS media stress test cases.

Change-Id: Id521b9cf8c010e2c0d9c07b1730a4edc91c81a2f
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
fix ion_platform_data definition

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

Change-Id: Ia5129a4c81bb6719f471214e75d77e51f5f50c59
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
[lauraa: Fixup msm board files]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[cpandya: clean up for checkpatch]
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
msm: Rip out fmem related memory adjustments

fmem is deprecated. Get rid of the special handling for
fmem in memory reservation code.

Change-Id: I5c69357eb75c53a7666efc1904579b979be2f3a4
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[cpandya: taken out fmem code from 7627a board files]
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
msm: board7627a: Make CAMERA/MM use CMA heap

Make camera_preview heap use CMA heap type. With this, that
heap area will be under linux memory space when heap is not
being used by any client.

Change-Id: I831a9e338af8e78dc3c440557b8596e4ad12801b
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-qrd7627a.c
msm: board-msm7x27a: Add one ION heap for audio from bootloader memory

Divide the audio heap into two different heaps with size 960KB and
232 KB. Allocate the audio heap taking 960 KB from bootloader memory
by initializing the base address of the heap in platform data which
saves upto 960 KB of memory space

Change-Id: If10ee4b04401bc3069700e340cdf6859be886249
Signed-off-by: Sriranjan Srikantam <cssrika@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-msm7x27a.c
	arch/arm/mach-msm/board-qrd7627a.c
msm: board7627a: Support ZSL with 512MB RAM when CMA is enabled

To support advanced camera features like ZSL with 5MP
sensor, we require camera_preview heap to be of 60 MB.
Allocate this size with 512MB RAM only when we enable
CMA.

Change-Id: Id4ec9e561a3d5eb2f6cc1cc4ad59fa83d3857bb9
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/board-qrd7627a.c
msm: board7627a: Allocate CMA region in lowmem

Give hard limit of 768 MB, so that CMA allocation won't
happen in HIGHMEM.

Change-Id: I471b4e0180e5f2f9ea264f2dfdcffe67e9ae9cd6
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
Signed-off-by: Manish Kumar <manishku@codeaurora.org>
msm: board7627a: bring CMA regions even lower

With earlier limit of 768 MB, CMA regions were overlapping
with the HIGHMEM, which was leading to many issues. So,
bring down CMA region limit of 0x26000000, so that they
never fall into HIGHMEM regions.

Change-Id: I480dd6c38fe1446c4b2c3701c8a4b013d0764bcf
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
msm: board7627a: Disabling ZSL feature on low RAM devices

ZSL feature is enabled only for devices with more than 512MB DDR
or 512MB DDR and CMA enabled.

Change-Id: I2c5f56090d03a09f273903eca7af0d410a0a84c2
Signed-off-by: Sravan Kumar Ambapuram <asravan@codeaurora.org>
[M4-COMMON/U0] Add one ION heap for audio from bootloader memory

Divide the audio heap into two different heaps with size 960KB and
232 KB. Allocate the audio heap taking 960 KB from bootloader memory
by initializing the base address of the heap in platform data which
saves upto 960 KB of memory space

Change-Id: Ia39798f154ac2cd1b8cc5416d4a27fa9709c7323
Signed-off-by: RonGokhale <cips173@gmail.com>
bdi: use deferable timer for sync_supers task

sync_supers task currently wakes up periodically for superblock
writeback. This hurts power on battery driven devices. This patch
turns this housekeeping timer into a deferable timer so that it
does not fire when system is really idle.

CRs-Fixed: 353700
Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Signed-off-by: Xia Wu <xia.wu@intel.com>
Signed-off-by: Krishna Vanka <kvanka@codeaurora.org>
(cherry picked from commit f398f30d1f34632d3c96758b5b19e65b056af072)

Change-Id: I672217685adc1e4391dd73f222f9928b69c3d33e
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
mm: Hold a file reference in madvise_remove

commit 9ab4233dd08036fe34a89c7dc6f47a8bf2eb29eb upstream.

Otherwise the code races with munmap (causing a use-after-free
of the vma) or with close (causing a use-after-free of the struct
file).

The bug was introduced by commit 90ed52ebe481 ("[PATCH] holepunch: fix
mmap_sem i_mutex deadlock")

Change-Id: Iaacd42f6c319463a5e09ce55947fc8efdb46de53
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Miklos Szeredi <mszeredi@suse.cz>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.2:
 - Adjust context
 - madvise_remove() calls vmtruncate_range(), not do_fallocate()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David Ng <dave@codeaurora.org>
mm: Use aligned zone start for pfn_to_bitidx calculation

The current calculation in pfn_to_bitidx assumes that
(pfn - zone->zone_start_pfn) >> pageblock_order will return the
same bit for all pfn in a pageblock. If zone_start_pfn is not
aligned to pageblock_nr_pages, this may not always be correct.

Consider the following with pageblock order = 10, zone start 2MB:

pfn     | pfn - zone start | (pfn - zone start) >> page block order
----------------------------------------------------------------
0x26000 | 0x25e00	   |  0x97
0x26100 | 0x25f00	   |  0x97
0x26200 | 0x26000	   |  0x98
0x26300 | 0x26100	   |  0x98

This means that calling {get,set}_pageblock_migratetype on a single
page will not set the migratetype for the full block. Fix this by
rounding down zone_start_pfn when doing the bitidx calculation.

Change-Id: I13e2f53f50db294f38ec86138c17c6fe29f0ee82
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
mm: split_free_page ignore memory watermarks for CMA

Memory watermarks were sometimes preventing CMA allocations
in low memory.

Change-Id: I550ec987cbd6bc6dadd72b4a764df20cd0758479
Signed-off-by: Liam Mark <lmark@codeaurora.org>
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
cma: fix migration mode

__alloc_contig_migrate_range calls migrate_pages with wrong argument
for migrate_mode. Fix it.

Change-Id: I84697cf7c6aef6253e9ee7e5b3028c946b95e253
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Minchan Kim <minchan@kernel.org>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>