msm: Remove pmem_kalloc APIs

All clients are now migrated from the pmem_kalloc APIs. Remove
references to these APIs so no one can call them.

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

Conflicts:
	arch/arm/mach-msm/memory.c
msm: 8974: Add function to reserve memory from device tree

Memory reservations for memory pools or using memblock remove
must happen early at bootup. Add a function at early boot to
walk the flattened device tree and extract memory reservation
information from appropriate bindings in device tree. To ensure
that the memory is only reserved when a driver is enabled,
drivers must put EXPORT_COMPAT(<compat string>) in the driver
as well as adding the binding to the device tree. More
documentation is available in
Documentation/devicetree/bindings/arm/msm/memory-reserve.txt

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

Conflicts:
	arch/arm/mach-msm/include/mach/msm_memtypes.h
msm: memory: Calculate DDR size early at boot time

Calculate the DDR size available to APPS which can be
used during early boot up time such as reservation
size based on the available RAM.

Change-Id: Ib765913ed95f8c23e4db3c044e5a43bcc10b7c1c
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
msm: memory: remove obsolete stable_size function

The notion of `stable' memory is going away (i.e. all memory is now
treated as `stable'). Remove the stable_size function. Remove the
notion of stability from the total_stable_size function and rename it
to total_size.

Change-Id: I8fd08a36b4948d57f430aea9113a0c704b8a00d0
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: memory: use memblock instead of meminfo

msm currently uses meminfo (not memblock) in memory.c for several
purposes (mainly the placement of the memory pool(s)).  When the code
was written originally, memblock didn't exist yet.

Now that memblock exists, this is not strictly correct, but works as
long as nobody calls memblock_remove() besides this code (if that
occurs then the meminfo data no longer reflect reality and will likely
cause overlap problems).

To avoid problems meminfo usage should be replaced with memblock.

Also, since memblock regions of the same type can't be contiguous, the
total_size function, which calculated the aggregate size of contiguous
meminfo banks, can be removed.

Change-Id: I34054c4fe367986f472bdaae65be67cd8fbf273a
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
msm: memory: Use already defined MT_MEMORY_SO type

MT_MEMORY_SO is now defined in the kernel so replace the old
usage of the MT_DEVICE_STRONGLY_ORDERED type which is no
longer defined in the latest kernel revisions.

Change-Id: Ie942520b78b682f8006510f08892f161e6bc7812
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
msm: memory: Enable map_page_strongly_ordered API for 7627a

Enable map_page_strongly_ordered() API for 7627a, since it
is required for the memory barrier implementation, like 7627.
Use iotable_init API to initialize the strongly ordered page
mapping since create_mapping() used in the older implementation
is no longer available outside mm/mmu.c implementation.

Change-Id: Ib1a9a261186921a25be7ff8900109b3b1718dfba
Signed-off-by: Trilok Soni <tsoni@codeaurora.org>
arm/dt: mpq8092: Add device tree support for ION

Add ION support for mpq8092 by adding ION heaps sizes to
the device tree and include memory reservation using device
tree features in board files.

Change-Id: I0f2bd3f5cb87b67ad1c779ce20d411b7d0127b2b
Signed-off-by: Utsab Bose <ubose@codeaurora.org>
Signed-off-by: Ravi Kumar V <kumarrav@codeaurora.org>

Conflicts:
	arch/arm/boot/dts/msm9625.dts
	arch/arm/mach-msm/board-8092.c
msm: move memory reservation for 8974 into the device tree

Reserving memory through the memory-reserve mechanism provided by the
device tree is preferable to hard-coding the reservations into the
board files.

Change-Id: I7dd354a811836e7bbf9c646655a8ebc7e218b20e
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>

Conflicts:
	arch/arm/boot/dts/msm8974.dtsi
	arch/arm/mach-msm/board-8974.c
msm: 8974: Enable DONT_MAP_HOLE_AFTER_MEMBANK0

If this config option is enabled, the kernel does not map the
memory corresponding to the largest hole into the virtual
memory resulting in more lowmem. If multiple holes exist, the
largest hole in the first 256MB of the memory is not mapped.

In device tree based targets the kernel is no longer dependant
on the bootloader for the start and size of the memory holes.
Thus the meminfo is adjusted to reflect the memory hole, if it
is present, using the start and end of the memory hole, while
parsing the device tree.

For non-device tree based targets, the meminfo is used to find
the start and size of the memory hole. No adjustment is needed
to be made to the meminfo, as the hole is taken into account,
based on the memory information passed by the atags.

Change-Id: Ib2619f72ac2b4142330534c8bbe1c7d9f64ea38c
Signed-off-by: Neeti Desai <neetid@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/board-8974.c
msm: correctly handle multiple memory holes

The function adjust_meminfo() did not correctly set the
size of any meminfo which was beyond the second memory hole.

Change-Id: I5bf6c5b30f7657ce9b975c9b4afb8fb3b2ce343f
CRs-Fixed: 455187
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/memory.c
msm: remove obsolete DMM code and config options

DMM is no longer supported, but there were still fragments
of the DMM support dependent on the obsolete config options
CONFIG_ENABLE_DMM and CONFIG_FIX_MOVABLE_ZONE present.
Remove these config options and the associated code.

Change-Id: I01c715c8d9c65eebc7ff123a8a0878166b606e0c
CRs-fixed: 460735
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>

Conflicts:
	arch/arm/mach-msm/board-8064.c
msm: Remove alloc bootmem aligned

This function has no more callers and should never be used again.
Remove it.

Change-Id: I3006c03ba2294c7dfb49539dff92b21b6670b4be
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: Completely remove memory from the memblock allocator

memblock_remove may not be sufficient to prevent placing
regions on top of each other. Call memblock_reserve and
memblock_free as well to completely remove the memory
from the allocator.

Change-Id: Iec481d7ce7a51c243e43a2d9be2fbfbf7b2717ed
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: simplify placing memory pools

The algorithm for placing memory pools was manually inspecting
the memblock data structures and then doing a memblock_remove()
on the region it decided that the memory pool should be located at.

If other code already did a memblock_remove() it was possible
that the memblock data structures which this algorithm
was inspecting would not be correct and the memory pool might
be placed overlapping this previous allocation.

Instead use arm_memblock_steal() which will not have this
problem (and also lets the memblock subsystem do
the allocation without any manual inspection of memblocks).

Change-Id: I7db5cba0a8d5f222f9f2f131b4b42eb81171c45b
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
msm: memory: Use phys_addr_t for memory reservation code

When reserving memory, the reserved regions may be placed above
a 32-bit address on LPAE based systems. Adjust the reservation code to
account for this.

Change-Id: If7e1775352d2557106cca0b50caec3d5134e0174
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/board-8974.c
msm: memory: Use phys_addr_t as the return type for ebi functions

On LPAE systems, ebi allocations may be greater than 32-bits.
Use phys_addr_t as the return type for these allocations.

Change-Id: I35a4f66d2c322869f2619253f99f339b6de7464a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
msm: Update meminfo to reflect consecutive memory holes

The device tree now has a node for each of the memory regions
belonging to the subsystems. The meminfo blocks are updated to
reflect these memory holes in such a way that every meminfo block
is of a non-zero size. The start and end of the largest memory
hole is calculated using the meminfo.

Change-Id: I9eb9984f9d74cf2a493846cb2ae7f83db9f92719
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
msm: memory: Add memblock_reserve bindings to dt reserve code

Drivers may wish to just reserve a block of memory in addition to
removing it or adding a size to a general pool. Update the DT
scanning code to scan for these bindings and reserve the memory.

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