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: I6ec6310d66c0d014adf0f41e75cd4c48c233f83d
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: iommu: Use threaded IRQ handler for page faults

A threaded interrupt handler for IOMMU page faults will
allow the use of the new clock APIs from the interrupt
handler.

Change-Id: I381df3974daa7fbc4bc4ec0558434959597b4f24
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/iommu_dev.c
msm: iommu: Enable use of TTBR1 register of IOMMU

Add a new platform data in iommu devices to indicate whether ttbr1
should be used which also dictates how the address space should be
split between ttbr0 and ttbr1.

Change-Id: Iab3aac74256bd4d49f47f89e6638f014e6e539e9
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: iommu: Support mapping attributes

Add support for the IOMMU_READ and IOMMU_WRITE attributes
for mappings. Read-only and read-write mappings are fully
supported. Write-only mappings are not supported in
hardware and will fall back to read-write. Specifying
neither attribute in iommu_map will result in a warning on
the first call, and the mapping will be treated as
read-write.

Change-Id: Ibe9bd340d0743f37c91580c7db4f199fb4afba8b
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: Move subsystem map specific code to the subsystem map file

Code to translate between the old style subsystem map ids and
newer domain/partition numbers is no longer dependent on anything
in iommu_domains.c. Move it to the subsystem_map file to better
separate the old code from the new code.

Change-Id: I899a3215f17b7b8c55969086389b89c4401bea3f
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: iommu: Use ttbr1 for graphics 2d devices

Split the virtual address between ttbr0 and ttbr1 for
2d devices of graphics

Change-Id: I6f5751c0586cfd16e01f2e324b544463efdd54d2
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: Add simple APIs to map contiguous buffer

Typicall, most iommu mapping happens through Ion or another
API. There may be other cases when clients need a simple
API to map a contiguous physical address into an iommu.
Add apis to support mapping and unmapping a physical range
into the iommu. The client is responsible for any reference
counting that needs to occur.

Change-Id: Ie5cb330417f7dd967748bb76cfdf9d123c579e04
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/include/mach/iommu_domains.h
msm: iommu: Clean newly-allocated page tables

If L2 redirection is disabled, clean page tables upon
allocation to prevent hardware table walks into unmapped
areas from accessing stale data.

Change-Id: If1e70bfa52f86d9ddc5a001a699050667b075631
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: iommu: Refactor cache cleaning functionality

Refactor clean_pte to accept a redirection attribute, which
allows for cleaner code at the caller.

Change-Id: Iff77abdced1fa6ea295a4bf6ec76f644b9922e63
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
msm: iommu: Use iommu_map_range for 4K mappings

iommu_map_range is much more effective than
calling iommu_map for each page to be mapped.

Change-Id: I674af262f730cddbc49cdabe564e14f0874c0196
CRs-fixed: 369080
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
msm: krait-l2-accessor: Add missing barriers

The Krait processor requires a barrier to be executed
between writing to L2CPUCPSELR and accessing L2CPUCPDR, to
ensure that the write to L2CPUCPSELR is reflected in the
access to L2CPUCPDR.

CRs-fixed: 367753
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
(cherry picked from commit 4d055616056994de077122c1a8c0a4370363c2ed)

Change-Id: I52a330455cb7c5d002d1d01ae6700c1347f9dc21
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
fs: fat: rate limit the kernel messages

If FAT formatted SD card gets removed without unmounting,
FAT file system may throw many kernel error messages which
could too much traffic for console driver and can sometimes
even cause the system to trigger watchdog timeout.

This patch converts the printk to printk_ratelimited to rate
limit the error messages from FAT fs.

CRs-fixed: 368446
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
(cherry picked from commit a872b71069d717ced1a2de642afa0693d1bb9448)

Change-Id: I3ace0ffc5a0119641dff8084adccf7ed780c7900
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
arm: free all .init memory when CONFIG_STRICT_MEMORY_RWX is set

When CONFIG_STRICT_MEMORY_RWX is set, the .init section is
padded to the next megabyte boundary. The part of the .init
section past __init_end (i.e. the pad) was not being freed
since the kernel uses the address of __init_end to determine
how much memory to free.

The fix is to set __init_end to the end of the pad.

CRs-fixed: 367748
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
(cherry picked from commit f759542791356b1678698551b198ba062bfa97bd)

Change-Id: I2adf714b6a89a21b336990fc2f9398b7344963fc
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
gpu: ion: Check return code of msm_allocate_iova_address

In the IOMMU heap, the return value of msm_allocate_iova_address
needs to be checked instead of the value of the iova address.
Check the return value instead.

Change-Id: I4554515d17c926a7dd738824aff21eb65d2ba56a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>

Conflicts:

	drivers/gpu/ion/ion_iommu_heap.c
msm: Make iommu domains platform devices

Information about the layout of iommu domains is a device
specific option. Convert the iommu domain information
into a platform driver with a corresponding platform device.
This allows different devices to have different layouts as
needed.

Change-Id: I6bf4162476143daabe16a2f5de3b655ae4377902
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/board-8064.c
	arch/arm/mach-msm/board-8930.c
	arch/arm/mach-msm/board-8960.c
	arch/arm/mach-msm/devices-8064.c
	arch/arm/mach-msm/devices-8960.c
	arch/arm/mach-msm/devices.h
msm: HTC 8960: Make iommu domains platform devices

Change-Id: I6cc59f40649cd36b3686d4bab8293a6dc1f95919
msm: Add api to register virtual domain space

Going forward, clients may want to have more control over the
virtual address space for iommu domains. Add API to support
clients registering virtual address space information. Current
clients are internally converted to use the new APIs.

Change-Id: Iaec9f1cd150eefc02ce22c34790494b61f21eb12
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>

Conflicts:

	arch/arm/mach-msm/include/mach/iommu_domains.h
	drivers/gpu/ion/ion_iommu_heap.c
msm: Correctly lookup iommu domains.

Correctly compare against the value in the domain
structure when looking up domains.

Change-Id: Ibeb4ffff4ee14b651797668606a8e81f102b3a19
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
(cherry picked from commit 723970deb6b98b4577689eb413378051dbf3fe72)

Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
gpu: ion: Check return code of msm_allocate_iova_address

In the IOMMU heap, the return value of msm_allocate_iova_address
needs to be checked instead of the value of the iova address.
Check the return value instead.

Change-Id: I4554515d17c926a7dd738824aff21eb65d2ba56a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
video: msm: Migrate away from subsystem map APIs

This reverts commit 526068c5f872b805bfb6c4a66365d2483f2f1237.
This used the split domain names for display and rotator
subsystems compared to earlier version.

Change-Id: I385de26a0cfb5a976ead5f2687216fbab0104045
Signed-off-by: Ravishangar Kalyanam <rkalya@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay_dsi_video.c