fmem: add fmem API header file

Change-Id: Iea942e84106512ba4c1418fe10bd7f53e635451e
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
fmem: Add function stubs

Add function stubs for when qcache is not enabled

Change-Id: I7eade250bee42316074fc790204154cd8f0af840
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
staging: zcache: misc build/config

[PATCH V2 3/3] drivers/staging: zcache: misc build/config

Makefiles and Kconfigs to build zcache in drivers/staging

There is a dependency on xvmalloc.* which in 2.6.37 resides
in drivers/staging/zram.  Should this move or disappear,
some Makefile/Kconfig changes will be required.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
Staging: zram: make ZRAM depends on SYSFS

We can not configure zram device without sysfs anyway, so make zram
depends on it.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
zram/xvmalloc: create CONFIG_ZRAM_DEBUG for debug code

Add a debug config flag to enable debug printk output and future
debug code.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
staging: Allow sharing xvmalloc for zram and zcache

Both zram and zcache use xvmalloc allocator. If xvmalloc
is compiled separately for both of them, we will get linker
error if they are both selected as "built-in". We can also
get linker error regarding missing xvmalloc symbols if zram
is not built.

So, we now compile xvmalloc separately and export its symbols
which are then used by both of zram and zcache.

Signed-off-by: Nitin Gupta <ngupta@vflare.org>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
fmem: add qcache implementation

Part of this code is originally from the 3.1 version of the
tmem backend zcache.

The zcache code was copied to the qcache directory and
modifications were made, notably to the memory allocation
(from a block of pre-reserved contiguous memory rather
than from system memory), and to allow tmem and qcache to
be turned on and off either from a /sys file or using
an exported API.

A higher level driver (fmem) is provided that is
the interface to other (PMEM, ION, tmem/qcache) drivers.

Change-Id: Ieda939ed1ba7c5337dd4338b9d9caffde883e82b
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
fmem: Add support for reusable virtual mappings

Instead of just keeping the entire heap mapped all the
time, reserve the virtual area and map as needed.

Change-Id: Id9a253541f1462379f3f81611aec92cd760e71c8
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: Remove msm specific implementation of io_remap_pfn_range.

The msm specific implementation of io_remap_pfn_range is no
longer applicable to current generation of msm targets.

Remove the implementation to avoid any potential remapping
to a wrong memory type.

Change-Id: I5cd5e0459c594e240f138dcdb37aef7c4698bea1
Signed-off-by: Naveen Ramaraj <nramaraj@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: Build the memory topology by parsing smem.

The kernel needs a view of system memory topology for memory
hotplug. Add support to parse this information available in
shared memory to determine the memory banks and their sizes.

Signed-off-by: Naveen Ramaraj <nramaraj@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
fmem: reserve memory for fmem

Fmem will use a block of contiguous memory at the
end of the memory bank with the greatest physical address.

Change-Id: I74d93f356e1e24b76e7b8f3432c3b021503fd387
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
msm: memory: Store TTBR0 for post-mortem debugging.

It is useful to know where the most-recently-running
process's page tables are located in memory in the event
that a crash occurs and memory dumps are available.

Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
pmem: Add fmem call backs

Add callbacks for request/release region to be used with fmem.
These files can be referenced in any board file for use with
any pmem device.

Change-Id: I1a1791bbf8fc00d3e324600aedb5361aa899bc4f
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>
fmem: Add reserved_size to fmem

Due to a limitation in how the video hardware is able
to access memory, fmem needs to be able to allocate a
physically contiguous block of memory that can be split into
two pieces. One piece will be managed by fmem
while the other piece (reserved) will not be handled by fmem.
The hardware limitation requires the reserved part to be at
a lower address than the other piece managed by fmem.

Add a new parameter to fmem that allows platform
data to specify the size of the piece that should not
be managed by fmem.

Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit cf10e5846db9a5727da5bad2d4b45f64dca20588)

Change-Id: Ibfdde3d6b1294400d67a854d4ba51fa3cc71221e
Signed-off-by: Yen-Pin Hsiao <yphsiao@codeaurora.org>
Signed-off-by: Ronny Schmatzler <schmatzler@googlemail.com>