sunxi: mali: Drop SUNXI_MALI_RESERVED_MEM option

This option was only providing a 64MB boot time memory
reservation for Mali GPU. That's a mostly useless waste
of memory on the devices with only 512MB of RAM (such
as A10-OLinuXino-LIME).

Moreover, the "sunxi_no_mali_mem_reserve" kernel cmdline
option (implemented as part of this code) was unsafe and
allowed the unsuspecting users to cause memory corruption
and take down the system by just modprobing the mali kernel
module.

Because the Mali400 GPU has MMU, it does not strictly need
boot time memory reservation and can work just fine with
just dynamic memory allocation. There have been no evidences
presented in favour of keeping this boot time memory
reservation. Also the Mali400 MP2 GPU on sun7i hardware
does not currently use this boot time memory reservation
at all.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
sunxi: cedar: Fix oops on loading/unloading the cedar module

If we try to repeatedly load and unload the sunxi cedar module, we get
the following problem on the second round:

[   29.470000] [cedar dev]: install start!!!
[   29.470000] Unable to handle kernel paging request at virtual address bf0b138c
[   29.480000] pgd = df060000
[   29.480000] [bf0b138c] *pgd=5e69c811, *pte=00000000, *ppte=00000000
[   29.480000] Internal error: Oops: 7 [#1] PREEMPT ARM

Adding the missing del_timer() and platform_device_unregister() calls
to cedarv_exit() resolves this.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
sunxi: cedar: Allow to use CMA for cedar memory allocation

In the case if the kernel supports CMA and has it enabled, now
the cedar module tries to allocate the 80MB memory buffer from CMA.
This memory block is kept in use as long as the cedar module is
loaded. When the module is unloaded, the allocated memory gets
released.

It is preferable to allocate cedar memory buffer from the first
256MB of physical memory to avoid bugs even though in theory
higher addresses might be supported:
    http://irclog.whitequark.org/linux-sunxi/2013-07-17#4409315;
In practice, both VLC (using the proprietary libve library) and
libvdpau-sunxi fail for the buffers allocated from above 256MB
(or partially crossing this boundary).

For the kernels without CMA, the old behaviour is preserved.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Add to W1_SUNX1 depends from W1_MASTER_GPIO

Signed-off-by: Gerardo Di Iorio <arete74@gmail.com>
arm:configs:sunxi: W1_SUNXI=m

Signed-off-by: Alejandro Mery <amery@geeks.cl>
sunxi: Enable ZONE_DMA for sun4i and sun5i (dma_zone_size=256MB)

Previously only sun7i had ZONE_DMA enabled, which is originating
from the Allwinner linux-3.3 code drop. But there should be no
reason to have it different for sun4i and sun5i.

The practical effect of setting the dma_zone_size is that it
affects the placement of the CMA area in physical RAM (if CMA
is enabled in the kernel). And we want to have it placed in the
first 256MB of physical RAM because the Cedar VPU is going to
be unhappy otherwise. For example, the encoding of the address
in MACC_MPEG_VLD_ADDR register is a bit tricky for anything that
needs more than 28 bits:
    http://linux-sunxi.org/VE_Register_guide#MACC_MPEG_VLD_ADDR
The low 4 bits might be supposed to store the high part of the
address, but in practice the video playback is currently broken
(in the proprietary libve and in the open source libvdpau-sunxi)
if Cedar memory buffer is allocated at a physical address
above 256MB.

TL;DR this workarounds Cedar VPU issues in the case if CMA is
enabled.

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Squashed arm/CMA support

commit ee1e5e7eda9d875967cd668acd8e24c68b4266ba
Merge: 2bbc8e6 2aee149
Author: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Date:   Wed Dec 25 03:22:16 2013 +0200

    Merge branch 'v3.4.46-ltsi-cma' into stage/sunxi-3.4

    This is a merge of CMA patches from LTSI:
        http://ltsi.linuxfoundation.org/releases/ltsi-tree/3.4.46-ltsi/stable-release

    Conflicts:
    	arch/arm/mm/mmu.c
    	drivers/base/Kconfig
    	mm/page_alloc.c

commit 2aee14906cf931ca542fff2157107d1a7621f20c
Author: Sachin Kamat <sachin.kamat@linaro.org>
Date:   Mon Oct 29 16:51:15 2012 +0900

    ARM: dma-mapping: Fix potential memory leak in atomic_pool_init()

    When either of __alloc_from_contiguous or __alloc_remap_buffer fails
    to provide a valid pointer, allocated memory is freed up and an error
    is returned. 'pages' was however not freed before returning error.

    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit ec10665cbf271fb1f60daeb194ad4f2cdcdc59d9)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit e7086478542d07eda0017258eb5137a050f15b08
Author: Hiroshi Doyu <hdoyu@nvidia.com>
Date:   Mon Oct 29 16:51:14 2012 +0900

    ARM: dma-mapping: atomic_pool with struct page **pages

    struct page **pages is necessary to align with non atomic path in
    __iommu_get_pages(). atomic_pool() has the intialized **pages instead
    of just *page.

    Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 6b3fe47264262fa082897ebe8ae01041eae65e14)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit e4a9d193c2501ecc66307eae49e2f8826556e712
Author: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date:   Mon Oct 29 16:51:13 2012 +0900

    arm: mm: fix DMA pool affiliation check

    The __free_from_pool() function was changed in
    e9da6e9905e639b0f842a244bc770b48ad0523e9. Unfortunately, the test that
    checks whether the provided (start,size) is within the DMA pool has
    been improperly modified. It used to be:

      if (start < coherent_head.vm_start || end > coherent_head.vm_end)

    Where coherent_head.vm_end was non-inclusive (i.e, it did not include
    the first byte after the pool). The test has been changed to:

      if (start < pool->vaddr || start > pool->vaddr + pool->size)

    So now pool->vaddr + pool->size is inclusive (i.e, it includes the
    first byte after the pool), so the test should be >= instead of >.

    This bug causes the following message when freeing the *first* DMA
    coherent buffer that has been allocated, because its virtual address
    is exactly equal to pool->vaddr + pool->size :

    WARNING: at /home/thomas/projets/linux-2.6/arch/arm/mm/dma-mapping.c:463 __free_from_pool+0xa4/0xc0()
    freeing wrong coherent size from pool

    Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
    Cc: Marek Szyprowski <m.szyprowski@samsung.com>
    Cc: Russell King <linux@arm.linux.org.uk>
    Cc: Lior Amsalem <alior@marvell.com>
    Cc: Maen Suleiman <maen@marvell.com>
    Cc: Tawfik Bayouk <tawfik@marvell.com>
    Cc: Shadi Ammouri <shadi@marvell.com>
    Cc: Eran Ben-Avi <benavi@marvell.com>
    Cc: Yehuda Yitschak <yehuday@marvell.com>
    Cc: Nadav Haklai <nadavh@marvell.com>
    [m.szyprowski: rebased onto v3.6-rc5 and resolved conflict]
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit f3d87524975f01b885fc3d009c6ab6afd0d00746)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 00d276cb10360235df524a3573ccf09b8810dbc1
Author: Hiroshi Doyu <hdoyu@nvidia.com>
Date:   Mon Oct 29 16:51:12 2012 +0900

    ARM: dma-mapping: Refactor out to introduce __in_atomic_pool

    Check the given range("start", "size") is included in "atomic_pool" or not.

    Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 21d0a75951ccf71f671eb24b61a8ad2b497be4b4)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 9c0f200b6f590fc4d998bc224714ed21d73b68c3
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:51:11 2012 +0900

    ARM: DMA-Mapping: print warning when atomic coherent allocation fails

    Print a loud warning when system runs out of memory from atomic DMA
    coherent pool to let users notice the potential problem.

    Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit fb71285f0c1633a85544784aae7577502274b77a)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 6aa629fe5cec4b2bf7735c7340e7c3ae11083b02
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:51:10 2012 +0900

    ARM: DMA-Mapping: add function for setting coherent pool size from platform code

    Some platforms might require to increase atomic coherent pool to make
    sure that their device will be able to allocate all their buffers from
    atomic context. This function can be also used to decrease atomic
    coherent pool size if coherent allocations are not used for the given
    sub-platform.

    Suggested-by: Josh Coombs <josh.coombs@gmail.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 6e5267aa543817015edb4a65c66e15f9809f92bd)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit c3389701658cbc49db34efb345dc3361cf09e0b3
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:51:09 2012 +0900

    mm: cma: fix alignment requirements for contiguous regions

    Contiguous Memory Allocator requires each of its regions to be aligned
    in such a way that it is possible to change migration type for all
    pageblocks holding it and then isolate page of largest possible order from
    the buddy allocator (which is MAX_ORDER-1). This patch relaxes alignment
    requirements by one order, because MAX_ORDER alignment is not really
    needed.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    CC: Michal Nazarewicz <mina86@mina86.com>
    Acked-by: Michal Nazarewicz <mina86@mina86.com>
    (cherry picked from commit 7ce9bf1f4785dab0598a19a7fcb0733a18193e4e)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 82fe63726f86dede0037e5c2d188930128ede637
Author: Aaro Koskinen <aaro.koskinen@iki.fi>
Date:   Mon Oct 29 16:51:08 2012 +0900

    ARM: dma-mapping: fix incorrect freeing of atomic allocations

    Commit e9da6e9905e639b0f842a244bc770b48ad0523e9 (ARM: dma-mapping:
    remove custom consistent dma region) changed the way atomic allocations
    are handled. However, arm_dma_free() was not modified accordingly, and
    as a result freeing of atomic allocations does not work correctly when
    CMA is disabled. Memory is leaked and following WARNINGs are seen:

    [   57.698911] ------------[ cut here ]------------
    [   57.753518] WARNING: at arch/arm/mm/dma-mapping.c:263 arm_dma_free+0x88/0xe4()
    [   57.811473] trying to free invalid coherent area: e0848000
    [   57.867398] Modules linked in: sata_mv(-)
    [   57.921373] [<c000d270>] (unwind_backtrace+0x0/0xf0) from [<c0015430>] (warn_slowpath_common+0x50/0x68)
    [   58.033924] [<c0015430>] (warn_slowpath_common+0x50/0x68) from [<c00154dc>] (warn_slowpath_fmt+0x30/0x40)
    [   58.152024] [<c00154dc>] (warn_slowpath_fmt+0x30/0x40) from [<c000dc18>] (arm_dma_free+0x88/0xe4)
    [   58.219592] [<c000dc18>] (arm_dma_free+0x88/0xe4) from [<c008fa30>] (dma_pool_destroy+0x100/0x148)
    [   58.345526] [<c008fa30>] (dma_pool_destroy+0x100/0x148) from [<c019a64c>] (release_nodes+0x144/0x218)
    [   58.475782] [<c019a64c>] (release_nodes+0x144/0x218) from [<c0197e10>] (__device_release_driver+0x60/0xb8)
    [   58.614260] [<c0197e10>] (__device_release_driver+0x60/0xb8) from [<c0198608>] (driver_detach+0xd8/0xec)
    [   58.756527] [<c0198608>] (driver_detach+0xd8/0xec) from [<c0197c54>] (bus_remove_driver+0x7c/0xc4)
    [   58.901648] [<c0197c54>] (bus_remove_driver+0x7c/0xc4) from [<c004bfac>] (sys_delete_module+0x19c/0x220)
    [   59.051447] [<c004bfac>] (sys_delete_module+0x19c/0x220) from [<c0009140>] (ret_fast_syscall+0x0/0x2c)
    [   59.207996] ---[ end trace 0745420412c0325a ]---
    [   59.287110] ------------[ cut here ]------------
    [   59.366324] WARNING: at arch/arm/mm/dma-mapping.c:263 arm_dma_free+0x88/0xe4()
    [   59.450511] trying to free invalid coherent area: e0847000
    [   59.534357] Modules linked in: sata_mv(-)
    [   59.616785] [<c000d270>] (unwind_backtrace+0x0/0xf0) from [<c0015430>] (warn_slowpath_common+0x50/0x68)
    [   59.790030] [<c0015430>] (warn_slowpath_common+0x50/0x68) from [<c00154dc>] (warn_slowpath_fmt+0x30/0x40)
    [   59.972322] [<c00154dc>] (warn_slowpath_fmt+0x30/0x40) from [<c000dc18>] (arm_dma_free+0x88/0xe4)
    [   60.070701] [<c000dc18>] (arm_dma_free+0x88/0xe4) from [<c008fa30>] (dma_pool_destroy+0x100/0x148)
    [   60.256817] [<c008fa30>] (dma_pool_destroy+0x100/0x148) from [<c019a64c>] (release_nodes+0x144/0x218)
    [   60.445201] [<c019a64c>] (release_nodes+0x144/0x218) from [<c0197e10>] (__device_release_driver+0x60/0xb8)
    [   60.634148] [<c0197e10>] (__device_release_driver+0x60/0xb8) from [<c0198608>] (driver_detach+0xd8/0xec)
    [   60.823623] [<c0198608>] (driver_detach+0xd8/0xec) from [<c0197c54>] (bus_remove_driver+0x7c/0xc4)
    [   61.013268] [<c0197c54>] (bus_remove_driver+0x7c/0xc4) from [<c004bfac>] (sys_delete_module+0x19c/0x220)
    [   61.203472] [<c004bfac>] (sys_delete_module+0x19c/0x220) from [<c0009140>] (ret_fast_syscall+0x0/0x2c)
    [   61.393390] ---[ end trace 0745420412c0325b ]---

    The patch fixes this.

    Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit d9e0d149b5dcc2ef4688afc572b9906bcda941ef)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit bb2718c695c0aa15cd0fd9a4847ff67937cd4c56
Author: Aaro Koskinen <aaro.koskinen@iki.fi>
Date:   Mon Oct 29 16:51:07 2012 +0900

    ARM: dma-mapping: fix atomic allocation alignment

    The alignment mask is calculated incorrectly. Fixing the calculation
    makes strange hangs/lockups disappear during the boot with Amstrad E3
    and 3.6-rc1 kernel.

    Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit e4ea6918c93b9f59d34e8ca2124b2b64b1afe73b)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 57861a305627c98801780014e4f7782dee3c5714
Author: Russell King <rmk+kernel@arm.linux.org.uk>
Date:   Mon Oct 29 16:51:06 2012 +0900

    ARM: fix warning caused by wrongly typed arm_dma_limit

    arch/arm/mm/init.c: In function 'arm_memblock_init':
    arch/arm/mm/init.c:380: warning: comparison of distinct pointer types lacks a cast

    by fixing the typecast in its definition when DMA_ZONE is disabled.
    This was missed in 4986e5c7c (ARM: mm: fix type of the arm_dma_limit
    global variable).

    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
    (cherry picked from commit 09b2ad13da3ac7c717dd86bfca7072d9b36f7449)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit e7fc0512ee0dc45d8df8a59f5a9b54169596db7f
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:51:05 2012 +0900

    ARM: dma-mapping: fix buffer chunk allocation order

    IOMMU-aware dma_alloc_attrs() implementation allocates buffers in
    power-of-two chunks to improve performance and take advantage of large
    page mappings provided by some IOMMU hardware. However current code, due
    to a subtle bug, allocated those chunks in the smallest-to-largest
    order, what completely killed all the advantages of using larger than
    page chunks. If a 4KiB chunk has been mapped as a first chunk, the
    consecutive chunks are not aligned correctly to the power-of-two which
    match their size and IOMMU drivers were not able to use internal
    mappings of size other than the 4KiB (largest common denominator of
    alignment and chunk size).

    This patch fixes this issue by changing to the correct largest-to-smallest
    chunk size allocation sequence.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 593f47355467b9ef44293698817e2bdb347e2d11)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit ec7459b02995094ef0d01037b80b0ba7c9fbb7c6
Author: Randy Dunlap <rdunlap@xenotime.net>
Date:   Mon Oct 29 16:51:04 2012 +0900

    driver core: fix some kernel-doc warnings in dma*.c

    Fix kernel-doc warnings in drivers/base/dma*.c:

    Warning(drivers/base/dma-buf.c:498): No description found for parameter 'vaddr'
    Warning(drivers/base/dma-coherent.c:199): No description found for parameter 'ret'

    Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    (cherry picked from commit 6e7b4a59b3d7bb2dcd11c019354bf0c91037dadd)

    Conflicts:

    	drivers/base/dma-buf.c

    Backported patch only addresses dma-coherent.c warning, as dma-buf.c warning is
    not present in 3.4 kernel.

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 4f02add73d3ec9e814cc53b10fea42513ab71f22
Author: Minchan Kim <minchan@kernel.org>
Date:   Mon Oct 29 16:51:03 2012 +0900

    mm: factor out memory isolate functions

    mm/page_alloc.c has some memory isolation functions but they are used only
    when we enable CONFIG_{CMA|MEMORY_HOTPLUG|MEMORY_FAILURE}.  So let's make
    it configurable by new CONFIG_MEMORY_ISOLATION so that it can reduce
    binary size and we can check it simple by CONFIG_MEMORY_ISOLATION, not if
    defined CONFIG_{CMA|MEMORY_HOTPLUG|MEMORY_FAILURE}.

    Signed-off-by: Minchan Kim <minchan@kernel.org>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Michal Hocko <mhocko@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    (cherry picked from commit ee6f509c3274014d1f52e7a7a10aee9f85393c5e)

    Conflicts:

    	mm/Makefile

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 63d767819e6fcf472f9535d1b4628913ddcc5d64
Author: Minchan Kim <minchan@kernel.org>
Date:   Mon Oct 29 16:51:02 2012 +0900

    mm: clean up __count_immobile_pages()

    The __count_immobile_pages() naming is rather awkward.  Choose a more
    clear name and add a comment.

    Signed-off-by: Minchan Kim <minchan@kernel.org>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Cc: Michal Hocko <mhocko@suse.cz>
    Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    (cherry picked from commit 80934513b230bfcf70265f2ef0fdae89fb391633)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 21086e13604d5a72a8cd75a6062b55762317b748
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:51:01 2012 +0900

    common: dma-mapping: add support for generic dma_mmap_* calls

    Commit 9adc5374 ('common: dma-mapping: introduce mmap method') added a
    generic method for implementing mmap user call to dma_map_ops structure.

    This patch converts ARM and PowerPC architectures (the only providers of
    dma_mmap_coherent/dma_mmap_writecombine calls) to use this generic
    dma_map_ops based call and adds a generic cross architecture
    definition for dma_mmap_attrs, dma_mmap_coherent, dma_mmap_writecombine
    functions.

    The generic mmap virt_to_page-based fallback implementation is provided for
    architectures which don't provide their own implementation for mmap method.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
    (cherry picked from commit 64ccc9c033c6089b2d426dad3c56477ab066c999)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit e6877b7aaa30541e2f2601032f48c8216076eac6
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:51:00 2012 +0900

    ARM: dma-mapping: fix error path for memory allocation failure

    This patch fixes incorrect check in error path. When the allocation of
    first page fails, the kernel ops appears due to accessing -1 element of
    the pages array.

    Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 9fa8af91f0679f2abbebe1382b937264f3a8b981)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit e49dcb5b0ae74c85aca81d33aad8f3b8e8bcdad1
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:59 2012 +0900

    ARM: dma-mapping: add more sanity checks in arm_dma_mmap()

    Add some sanity checks and forbid mmaping of buffers into vma areas larger
    than allocated dma buffer.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 50262a4bf38dd70486e9fce2b8235d5ae3e0f627)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit a683c6762033c9c40292fc00813e8f51d0630945
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:58 2012 +0900

    ARM: dma-mapping: remove custom consistent dma region

    This patch changes dma-mapping subsystem to use generic vmalloc areas
    for all consistent dma allocations. This increases the total size limit
    of the consistent allocations and removes platform hacks and a lot of
    duplicated code.

    Atomic allocations are served from special pool preallocated on boot,
    because vmalloc areas cannot be reliably created in atomic context.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
    Reviewed-by: Minchan Kim <minchan@kernel.org>
    (cherry picked from commit e9da6e9905e639b0f842a244bc770b48ad0523e9)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit 8a7d1dd986d8a25885b8d50b53f1c71d2d6130b3
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:57 2012 +0900

    mm: vmalloc: use const void * for caller argument

    'const void *' is a safer type for caller function type. This patch
    updates all references to caller function type.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
    Reviewed-by: Minchan Kim <minchan@kernel.org>
    (cherry picked from commit 5e6cafc83e30f0f70c79a2b7aef237dc57e29f02)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>

commit f056881b91c8b256cc9d2e16b99ba520782ec0bc
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:56 2012 +0900

    ARM: relax conditions required for enabling Contiguous Memory Allocator

    Contiguous Memory Allocator requires only paging and MMU enabled not
    particular CPU architectures, so there is no need for strict dependency
    on CPU type. This enables to use CMA on some older ARM v5 systems which
    also might need large contiguous blocks for the multimedia processing hw
    modules.

    Reported-by: Prabhakar Lad <prabhakar.lad@ti.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Tested-by: Prabhakar Lad <prabhakar.lad@ti.com>
    (cherry picked from commit e092705bcd53de3bafc3053b0b55bf83e5d6711f)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 65ffaed254e6c2d6d37a99313b06b3dcdc8de611
Author: Chris Brand <cbrand@broadcom.com>
Date:   Mon Oct 29 16:50:55 2012 +0900

    ARM: mm: fix MMU mapping of CMA regions

    Fix dma_contiguous_remap() so that it continues through all the
    regions, even after encountering one that is outside lowmem.
    Without this change, if you have two CMA regions, the first outside
    lowmem and the seocnd inside lowmem, only the second one will get
    set up in the MMU. Data written to that region then doesn't get
    automatically flushed from the cache into memory.

    Signed-off-by: Chris Brand <cbrand@broadcom.com>
    [extended patch subject with 'fix' word]
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 39f78e70567a07a6fc0d7a4ca9e3331e44dd400d)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 0399c3b81c049913debe2bef12b53b961a6e46a9
Author: Prathyush K <prathyush.k@samsung.com>
Date:   Mon Oct 29 16:50:54 2012 +0900

    ARM: dma-mapping: modify condition check while freeing pages

    WARNING: at mm/vmalloc.c:1471 __iommu_free_buffer+0xcc/0xd0()
    Trying to vfree() nonexistent vm area (ef095000)
    Modules linked in:
    [<c0015a18>] (unwind_backtrace+0x0/0xfc) from [<c0025a94>] (warn_slowpath_common+0x54/0x64)
    [<c0025a94>] (warn_slowpath_common+0x54/0x64) from [<c0025b38>] (warn_slowpath_fmt+0x30/0x40)
    [<c0025b38>] (warn_slowpath_fmt+0x30/0x40) from [<c0016de0>] (__iommu_free_buffer+0xcc/0xd0)
    [<c0016de0>] (__iommu_free_buffer+0xcc/0xd0) from [<c0229a5c>] (exynos_drm_free_buf+0xe4/0x138)
    [<c0229a5c>] (exynos_drm_free_buf+0xe4/0x138) from [<c022b358>] (exynos_drm_gem_destroy+0x80/0xfc)
    [<c022b358>] (exynos_drm_gem_destroy+0x80/0xfc) from [<c0211230>] (drm_gem_object_free+0x28/0x34)
    [<c0211230>] (drm_gem_object_free+0x28/0x34) from [<c0211bd0>] (drm_gem_object_release_handle+0xcc/0xd8)
    [<c0211bd0>] (drm_gem_object_release_handle+0xcc/0xd8) from [<c01abe10>] (idr_for_each+0x74/0xb8)
    [<c01abe10>] (idr_for_each+0x74/0xb8) from [<c02114e4>] (drm_gem_release+0x1c/0x30)
    [<c02114e4>] (drm_gem_release+0x1c/0x30) from [<c0210ae8>] (drm_release+0x608/0x694)
    [<c0210ae8>] (drm_release+0x608/0x694) from [<c00b75a0>] (fput+0xb8/0x228)
    [<c00b75a0>] (fput+0xb8/0x228) from [<c00b40c4>] (filp_close+0x64/0x84)
    [<c00b40c4>] (filp_close+0x64/0x84) from [<c0029d54>] (put_files_struct+0xe8/0x104)
    [<c0029d54>] (put_files_struct+0xe8/0x104) from [<c002b930>] (do_exit+0x608/0x774)
    [<c002b930>] (do_exit+0x608/0x774) from [<c002bae4>] (do_group_exit+0x48/0xb4)
    [<c002bae4>] (do_group_exit+0x48/0xb4) from [<c002bb60>] (sys_exit_group+0x10/0x18)
    [<c002bb60>] (sys_exit_group+0x10/0x18) from [<c000ee80>] (ret_fast_syscall+0x0/0x30)

    This patch modifies the condition while freeing to match the condition
    used while allocation. This fixes the above warning which arises when
    array size is equal to PAGE_SIZE where allocation is done using kzalloc
    but free is done using vfree.

    Signed-off-by: Prathyush K <prathyush.k@samsung.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 46c87852e99cf8ce97e207b11cde19085837e39c)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit e26a2e078e5483a54b9531868c1d18177b6382b8
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:53 2012 +0900

    mm: cma: fix condition check when setting global cma area

    dev_set_cma_area incorrectly assigned cma to global area on first call
    due to incorrect check. This patch fixes this issue.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit cc2caea5b6152b8ce66dc2bbe83dc72b60612da8)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 037af057ec4b8dc147ecce464e6cbb3be92510fd
Author: Rabin Vincent <rabin@rab.in>
Date:   Mon Oct 29 16:50:52 2012 +0900

    mm: cma: don't replace lowmem pages with highmem

    The filesystem layer expects pages in the block device's mapping to not
    be in highmem (the mapping's gfp mask is set in bdget()), but CMA can
    currently replace lowmem pages with highmem pages, leading to crashes in
    filesystem code such as the one below:

      Unable to handle kernel NULL pointer dereference at virtual address 00000400
      pgd = c0c98000
      [00000400] *pgd=00c91831, *pte=00000000, *ppte=00000000
      Internal error: Oops: 817 [#1] PREEMPT SMP ARM
      CPU: 0    Not tainted  (3.5.0-rc5+ #80)
      PC is at __memzero+0x24/0x80
      ...
      Process fsstress (pid: 323, stack limit = 0xc0cbc2f0)
      Backtrace:
      [<c010e3f0>] (ext4_getblk+0x0/0x180) from [<c010e58c>] (ext4_bread+0x1c/0x98)
      [<c010e570>] (ext4_bread+0x0/0x98) from [<c0117944>] (ext4_mkdir+0x160/0x3bc)
       r4:c15337f0
      [<c01177e4>] (ext4_mkdir+0x0/0x3bc) from [<c00c29e0>] (vfs_mkdir+0x8c/0x98)
      [<c00c2954>] (vfs_mkdir+0x0/0x98) from [<c00c2a60>] (sys_mkdirat+0x74/0xac)
       r6:00000000 r5:c152eb40 r4:000001ff r3:c14b43f0
      [<c00c29ec>] (sys_mkdirat+0x0/0xac) from [<c00c2ab8>] (sys_mkdir+0x20/0x24)
       r6:beccdcf0 r5:00074000 r4:beccdbbc
      [<c00c2a98>] (sys_mkdir+0x0/0x24) from [<c000e3c0>] (ret_fast_syscall+0x0/0x30)

    Fix this by replacing only highmem pages with highmem.

    Reported-by: Laura Abbott <lauraa@codeaurora.org>
    Signed-off-by: Rabin Vincent <rabin@rab.in>
    Acked-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 6a6dccba2fdc2a69f1f36b8f1c0acc8598e7221b)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 56792e85bc2f8c14c4f64f46fde3afb4fd10cd61
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:51 2012 +0900

    x86: dma-mapping: fix broken allocation when dma_mask has been provided

    Commit 0a2b9a6ea93 ("X86: integrate CMA with DMA-mapping subsystem")
    broke memory allocation with dma_mask. This patch fixes possible kernel
    ops caused by lack of resetting page variable when jumping to 'again' label.

    Reported-by: Konrad Rzeszutek Wilk <konrad@darnok.org>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Michal Nazarewicz <mina86@mina86.com>
    (cherry picked from commit c080e26edc3a2a3cdfa4c430c663ee1c3bbd8fae)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 136dac72225ac4399522b8a42b29bb39c2e94b97
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:50 2012 +0900

    ARM: dma-mapping: fix debug messages in dmabounce code

    This patch fixes the usage of uninitialized variables in dmabounce code
    intoduced by commit a227fb92 ('ARM: dma-mapping: remove offset parameter
    to prepare for generic dma_ops'):
    arch/arm/common/dmabounce.c: In function ‘dmabounce_sync_for_device’:
    arch/arm/common/dmabounce.c:409: warning: ‘off’ may be used uninitialized in this function
    arch/arm/common/dmabounce.c:407: note: ‘off’ was declared here
    arch/arm/common/dmabounce.c: In function ‘dmabounce_sync_for_cpu’:
    arch/arm/common/dmabounce.c:369: warning: ‘off’ may be used uninitialized in this function
    arch/arm/common/dmabounce.c:367: note: ‘off’ was declared here

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit fdb1117325ad719dc39e81209bc622d511db70e0)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 825d00daacd8c2ee76e297c9ce0dfc17d8a2bb85
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:49 2012 +0900

    ARM: mm: fix type of the arm_dma_limit global variable

    arm_dma_limit stores physical address of maximal address accessible by DMA,
    so the phys_addr_t type makes much more sense for it instead of u32. This
    patch fixes the following build warning:

    arch/arm/mm/init.c:380: warning: comparison of distinct pointer types lacks a cast

    Reported-by: Russell King <linux@arm.linux.org.uk>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 4986e5c7cd91817d0f58dd15073c9080d47980cf)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 5d6075133b365ae6a34dba6c0a108445d99e4a3c
Author: Sachin Kamat <sachin.kamat@linaro.org>
Date:   Mon Oct 29 16:50:48 2012 +0900

    ARM: dma-mapping: Add missing static storage class specifier

    Fixes the following sparse warnings:
    arch/arm/mm/dma-mapping.c:231:15: warning: symbol 'consistent_base' was not
    declared. Should it be static?
    arch/arm/mm/dma-mapping.c:326:8: warning: symbol 'coherent_pool_size' was not
    declared. Should it be static?

    Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit e53f517ff236a0ec5413ff3935c53406b69bc1e2)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit b53b5181a0d2683f2f5de207136410e785eff85c
Author: Ohad Ben-Cohen <ohad@wizery.com>
Date:   Mon Oct 29 16:50:47 2012 +0900

    iommu/core: pass a user-provided token to fault handlers

    Sometimes a single IOMMU user may have to deal with several
    different IOMMU devices (e.g. remoteproc).

    When an IOMMU fault happens, such users have to regain their
    context in order to deal with the fault.

    Users can't use the private fields of neither the iommu_domain nor
    the IOMMU device, because those are already used by the IOMMU core
    and low level driver (respectively).

    This patch just simply allows users to pass a private token (most
    notably their own context pointer) to iommu_set_fault_handler(),
    and then makes sure it is provided back to the users whenever
    an IOMMU fault happens.

    The patch also adopts remoteproc to the new fault handling
    interface, but the real functionality using this (recovery of
    remote processors) will only be added later in a subsequent patch
    set.

    Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
    Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
    Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
    (cherry picked from commit 77ca23323594589ac8cba1c8d59bfe7e85d3cb8b)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 95f907b4158975160624b86ea7575298148c51db
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:46 2012 +0900

    ARM: dma-mapping: remove unconditional dependency on CMA

    CMA has been enabled unconditionally on all ARMv6+ systems to solve the
    long standing issue of double kernel mappings for all dma coherent
    buffers. This however created a dependency on CONFIG_EXPERIMENTAL for
    the whole ARM architecture what should be really avoided. This patch
    removes this dependency and lets one use old, well-tested dma-mapping
    implementation also on ARMv6+ systems without the need to use
    EXPERIMENTAL stuff.

    Reported-by: Russell King <linux@arm.linux.org.uk>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit f1ae98da8525c6b8b1c301c3a2b0bd2b6515cca2)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 53195e721e0e6106325417acd91d274095d210b1
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:45 2012 +0900

    ARM: dma-mapping: add support for IOMMU mapper

    This patch add a complete implementation of DMA-mapping API for
    devices which have IOMMU support.

    This implementation tries to optimize dma address space usage by remapping
    all possible physical memory chunks into a single dma address space chunk.

    DMA address space is managed on top of the bitmap stored in the
    dma_iommu_mapping structure stored in device->archdata. Platform setup
    code has to initialize parameters of the dma address space (base address,
    size, allocation precision order) with arm_iommu_create_mapping() function.
    To reduce the size of the bitmap, all allocations are aligned to the
    specified order of base 4 KiB pages.

    dma_alloc_* functions allocate physical memory in chunks, each with
    alloc_pages() function to avoid failing if the physical memory gets
    fragmented. In worst case the allocated buffer is composed of 4 KiB page
    chunks.

    dma_map_sg() function minimizes the total number of dma address space
    chunks by merging of physical memory chunks into one larger dma address
    space chunk. If requested chunk (scatter list entry) boundaries
    match physical page boundaries, most calls to dma_map_sg() requests will
    result in creating only one chunk in dma address space.

    dma_map_page() simply creates a mapping for the given page(s) in the dma
    address space.

    All dma functions also perform required cache operation like their
    counterparts from the arm linear physical memory mapping version.

    This patch contains code and fixes kindly provided by:
    - Krishna Reddy <vdumpa@nvidia.com>,
    - Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
    - Hiroshi DOYU <hdoyu@nvidia.com>

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit 4ce63fcd919c32d22528e54dcd89506962933719)

    Conflicts:

            arch/arm/mm/dma-mapping.c

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit dba04c0f43513f07d3d4e7f5869111e92e885c37
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:44 2012 +0900

    ARM: dma-mapping: use alloc, mmap, free from dma_ops

    This patch converts dma_alloc/free/mmap_{coherent,writecombine}
    functions to use generic alloc/free/mmap methods from dma_map_ops
    structure. A new DMA_ATTR_WRITE_COMBINE DMA attribute have been
    introduced to implement writecombine methods.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit f99d60341238fe73fc514129cd9ae4e44e1b2c47)

    Conflicts:

    	arch/arm/mm/dma-mapping.c

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 242efb8681142625d1776c0d2a8d257e98b10eee
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:43 2012 +0900

    ARM: dma-mapping: remove redundant code and do the cleanup

    This patch just performs a global cleanup in DMA mapping implementation
    for ARM architecture. Some of the tiny helper functions have been moved
    to the caller code, some have been merged together.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit 51fde3499b531d4cf278f4d2eaa6c45b2865b16b)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 099faed3a8826eb7d3b7adc795cdcc19b52e9c70
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:42 2012 +0900

    ARM: dma-mapping: move all dma bounce code to separate dma ops structure

    This patch removes dma bounce hooks from the common dma mapping
    implementation on ARM architecture and creates a separate set of
    dma_map_ops for dma bounce devices.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit 15237e1f505b3e5c2276f240b01cd2133e110cbc)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit ae47af4cf52b478f5e37d4aa4ed0bd7ff50f8a07
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:41 2012 +0900

    ARM: dma-mapping: implement dma sg methods on top of any generic dma ops

    This patch converts all dma_sg methods to be generic (independent of the
    current DMA mapping implementation for ARM architecture). All dma sg
    operations are now implemented on top of respective
    dma_map_page/dma_sync_single_for* operations from dma_map_ops structure.

    Before this patch there were custom methods for all scatter/gather
    related operations. They iterated over the whole scatter list and called
    cache related operations directly (which in turn checked if we use dma
    bounce code or not and called respective version). This patch changes
    them not to use such shortcut. Instead it provides similar loop over
    scatter list and calls methods from the device's dma_map_ops structure.
    This enables us to use device dependent implementations of cache related
    operations (direct linear or dma bounce) depending on the provided
    dma_map_ops structure.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit 2a550e73d3e5f040a3e8eb733c942ab352eafb36)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 3eda90191d76d3fe2cb2a09bb8ce03b686b61d38
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:40 2012 +0900

    ARM: dma-mapping: use asm-generic/dma-mapping-common.h

    This patch modifies dma-mapping implementation on ARM architecture to
    use common dma_map_ops structure and asm-generic/dma-mapping-common.h
    helpers.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit 2dc6a016bbedf18f18ad73997e5338307d6dbde9)

    Conflicts:

    	arch/arm/Kconfig

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 93bb1a72f475b0cd7422fcfd9a130210ab32a6a5
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:39 2012 +0900

    ARM: dma-mapping: remove offset parameter to prepare for generic dma_ops

    This patch removes the need for the offset parameter in dma bounce
    functions. This is required to let dma-mapping framework on ARM
    architecture to use common, generic dma_map_ops based dma-mapping
    helpers.

    Background and more detailed explaination:

    dma_*_range_* functions are available from the early days of the dma
    mapping api. They are the correct way of doing a partial syncs on the
    buffer (usually used by the network device drivers). This patch changes
    only the internal implementation of the dma bounce functions to let
    them tunnel through dma_map_ops structure. The driver api stays
    unchanged, so driver are obliged to call dma_*_range_* functions to
    keep code clean and easy to understand.

    The only drawback from this patch is reduced detection of the dma api
    abuse. Let us consider the following code:

    dma_addr = dma_map_single(dev, ptr, 64, DMA_TO_DEVICE);
    dma_sync_single_range_for_cpu(dev, dma_addr+16, 0, 32, DMA_TO_DEVICE);

    Without the patch such code fails, because dma bounce code is unable
    to find the bounce buffer for the given dma_address. After the patch
    the above sync call will be equivalent to:

    dma_sync_single_range_for_cpu(dev, dma_addr, 16, 32, DMA_TO_DEVICE);

    which succeeds.

    I don't consider this as a real problem, because DMA API abuse should be
    caught by debug_dma_* function family. This patch lets us to simplify
    the internal low-level implementation without chaning the driver visible
    API.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit a227fb92a0f5f0dd8282719386e9b3a29f0d16b2)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 79a80f4e467558717c6ac76302a31e0c69af738a
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:38 2012 +0900

    ARM: dma-mapping: introduce DMA_ERROR_CODE constant

    Replace all uses of ~0 with DMA_ERROR_CODE, what should make the code
    easier to read.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit 553ac78877242b6d8b591323731df304140d0f99)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit b8aca1f7638ae019015546e91b0a741200cd0236
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:37 2012 +0900

    ARM: dma-mapping: use pr_* instread of printk

    Replace all calls to printk with pr_* functions family.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit 6b6f770b573903f8a7d1cfab1fc662685653f413)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 6632fab348a3322f9324b41d0733272eb5d39f16
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:36 2012 +0900

    ARM: dma-mapping: use dma_mmap_from_coherent()

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 47142f07eea32e9c108f548a4b06c28bec7df6e4)

    Conflicts:

    	arch/arm/mm/dma-mapping.c

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 67527009619d1015b075a53502cb184db483c655
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:35 2012 +0900

    common: add dma_mmap_from_coherent() function

    Add a common helper for dma-mapping core for mapping a coherent buffer
    to userspace.

    Reported-by: Subash Patel <subashrp@gmail.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
    Tested-By: Subash Patel <subash.ramaswamy@linaro.org>
    (cherry picked from commit bca0fa5f12a6744a2b2e53154af65a51402b3426)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 5428b0199de7881667896f6ef126c4887af4a2c3
Author: Vitaly Andrianov <vitalya@ti.com>
Date:   Mon Oct 29 16:50:34 2012 +0900

    ARM: dma-mapping: use PMD size for section unmap

    The dma_contiguous_remap() function clears existing section maps using
    the wrong size (PGDIR_SIZE instead of PMD_SIZE).  This is a bug which
    does not affect non-LPAE systems, where PGDIR_SIZE and PMD_SIZE are the same.
    On LPAE systems, however, this bug causes the kernel to hang at this point.

    This fix has been tested on both LPAE and non-LPAE kernel builds.

    Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    (cherry picked from commit 61f6c7a47a2f84b7ba4b65240ffe9247df772b06)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 0245439393f82996f3cf4b8271cb1939fd8df951
Author: Minchan Kim <minchan.kim@gmail.com>
Date:   Mon Oct 29 16:50:33 2012 +0900

    cma: fix migration mode

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

    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>
    (cherry picked from commit 58f42fd54144346898e6dc6d6ae3acd4c591b42f)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit f3655d25bcd287bfb62a1b202b1019c321900335
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:32 2012 +0900

    ARM: integrate CMA with DMA-mapping subsystem

    This patch adds support for CMA to dma-mapping subsystem for ARM
    architecture. By default a global CMA area is used, but specific devices
    are allowed to have their private memory areas if required (they can be
    created with dma_declare_contiguous() function during board
    initialisation).

    Contiguous memory areas reserved for DMA are remapped with 2-level page
    tables on boot. Once a buffer is requested, a low memory kernel mapping
    is updated to to match requested memory access type.

    GFP_ATOMIC allocations are performed from special pool which is created
    early during boot. This way remapping page attributes is not needed on
    allocation time.

    CMA has been enabled unconditionally for ARMv6+ systems.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
    CC: Michal Nazarewicz <mina86@mina86.com>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit c79095092834a18ae74cfc08def1a5a101dc106c)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 0c66ce4969334b97079c4de068e7d2d812081681
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:31 2012 +0900

    X86: integrate CMA with DMA-mapping subsystem

    This patch adds support for CMA to dma-mapping subsystem for x86
    architecture that uses common pci-dma/pci-nommu implementation. This
    allows to test CMA on KVM/QEMU and a lot of common x86 boxes.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
    CC: Michal Nazarewicz <mina86@mina86.com>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    (cherry picked from commit 0a2b9a6ea93650b8a00f9fd5ee8fdd25671e2df6)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 18c54c03865092e597897815ee0aadd69b8b3754
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:30 2012 +0900

    drivers: add Contiguous Memory Allocator

    The Contiguous Memory Allocator is a set of helper functions for DMA
    mapping framework that improves allocations of contiguous memory chunks.

    CMA grabs memory on system boot, marks it with MIGRATE_CMA migrate type
    and gives back to the system. Kernel is allowed to allocate only movable
    pages within CMA's managed memory so that it can be used for example for
    page cache when DMA mapping do not use it. On
    dma_alloc_from_contiguous() request such pages are migrated out of CMA
    area to free required contiguous block and fulfill the request. This
    allows to allocate large contiguous chunks of memory at any time
    assuming that there is enough free memory available in the system.

    This code is heavily based on earlier works by Michal Nazarewicz.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Acked-by: Arnd Bergmann <arnd@arndb.de>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit c64be2bb1c6eb43c838b2c6d57b074078be208dd)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 92b0e095dc5a0367c6be5e24842ce670d10367fa
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:29 2012 +0900

    mm: trigger page reclaim in alloc_contig_range() to stabilise watermarks

    alloc_contig_range() performs memory allocation so it also should keep
    track on keeping the correct level of memory watermarks. This commit adds
    a call to *_slowpath style reclaim to grab enough pages to make sure that
    the final collection of contiguous pages from freelists will not starve
    the system.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
    CC: Michal Nazarewicz <mina86@mina86.com>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit 49f223a9cd96c7293d7258ff88c2bdf83065f69c)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 130d5a94aa9a38cb0c389a7b16614e31d6e91373
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Mon Oct 29 16:50:28 2012 +0900

    mm: extract reclaim code from __alloc_pages_direct_reclaim()

    This patch extracts common reclaim code from __alloc_pages_direct_reclaim()
    function to separate function: __perform_reclaim() which can be later used
    by alloc_contig_range().

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
    Cc: Michal Nazarewicz <mina86@mina86.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit bba9071087108d3de70bea274e35064cc480487b)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 6f59300ba9e7e4dd1b46767ba8d705227a0e3df5
Author: Mel Gorman <mgorman@suse.de>
Date:   Mon Oct 29 16:50:27 2012 +0900

    mm: Serialize access to min_free_kbytes

    There is a race between the min_free_kbytes sysctl, memory hotplug
    and transparent hugepage support enablement.  Memory hotplug uses a
    zonelists_mutex to avoid a race when building zonelists. Reuse it to
    serialise watermark updates.

    [a.p.zijlstra@chello.nl: Older patch fixed the race with spinlock]
    Signed-off-by: Mel Gorman <mgorman@suse.de>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit cfd3da1e49bb95c355c01c0f502d657deb3d34a4)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 297403e910814abed263194dc6bce58a0bedb300
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:26 2012 +0900

    mm: page_isolation: MIGRATE_CMA isolation functions added

    This commit changes various functions that change pages and
    pageblocks migrate type between MIGRATE_ISOLATE and
    MIGRATE_MOVABLE in such a way as to allow to work with
    MIGRATE_CMA migrate type.

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit 0815f3d81d76dfbf2abcfd93a85ff0a6008fe4c0)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 4b1c9f454608e87e1924226913b284dfd8cbffce
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:25 2012 +0900

    mm: mmzone: MIGRATE_CMA migration type added

    The MIGRATE_CMA migration type has two main characteristics:
    (i) only movable pages can be allocated from MIGRATE_CMA
    pageblocks and (ii) page allocator will never change migration
    type of MIGRATE_CMA pageblocks.

    This guarantees (to some degree) that page in a MIGRATE_CMA page
    block can always be migrated somewhere else (unless there's no
    memory left in the system).

    It is designed to be used for allocating big chunks (eg. 10MiB)
    of physically contiguous memory.  Once driver requests
    contiguous memory, pages from MIGRATE_CMA pageblocks may be
    migrated away to create a contiguous block.

    To minimise number of migrations, MIGRATE_CMA migration type
    is the last type tried when page allocator falls back to other
    migration types when requested.

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit 47118af076f64844b4f423bc2f545b2da9dab50d)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit e3148a6a302d737cb0a469984a959d6e6432b8d1
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:24 2012 +0900

    mm: page_alloc: change fallbacks array handling

    This commit adds a row for MIGRATE_ISOLATE type to the fallbacks array
    which was missing from it.  It also, changes the array traversal logic
    a little making MIGRATE_RESERVE an end marker.  The letter change,
    removes the implicit MIGRATE_UNMOVABLE from the end of each row which
    was read by __rmqueue_fallback() function.

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit 6d4a49160de2c684fb59fa627bce80e200224331)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 3254c033faf3461b6292463e31f852379da1f662
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:23 2012 +0900

    mm: page_alloc: introduce alloc_contig_range()

    This commit adds the alloc_contig_range() function which tries
    to allocate given range of pages.  It tries to migrate all
    already allocated pages that fall in the range thus freeing them.
    Once all pages in the range are freed they are removed from the
    buddy system thus allocated for the caller to use.

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit 041d3a8cdc18dc375a128d90bbb753949a81b1fb)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 64dc481111efa88074521b73399c7aea1da58b0c
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:22 2012 +0900

    mm: compaction: export some of the functions

    This commit exports some of the functions from compaction.c file
    outside of it adding their declaration into internal.h header
    file so that other mm related code can use them.

    This forced compaction.c to always be compiled (as opposed to being
    compiled only if CONFIG_COMPACTION is defined) but as to avoid
    introducing code that user did not ask for, part of the compaction.c
    is now wrapped in on #ifdef.

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit ff9543fd32060917beb080b1eb2d1d41ec7f39e0)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 4a9146950d6c41d522b06d9134d55ff06ea5a4c6
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:21 2012 +0900

    mm: compaction: introduce isolate_freepages_range()

    This commit introduces isolate_freepages_range() function which
    generalises isolate_freepages_block() so that it can be used on
    arbitrary PFN ranges.

    isolate_freepages_block() is left with only minor changes.

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit 85aa125f001f87f96a72e9e6ee515490843b1202)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 200926c2bd77f1e240f648a28bb8cbc794c04d9e
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:20 2012 +0900

    mm: compaction: introduce map_pages()

    This commit creates a map_pages() function which map pages freed
    using split_free_pages().  This merely moves some code from
    isolate_freepages() so that it can be reused in other places.

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit 03d44192f69a45d780ba124f691e76020a44ebae)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 7500c34c9b094308107176ccbc79e2104a972eb3
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:19 2012 +0900

    mm: compaction: introduce isolate_migratepages_range()

    This commit introduces isolate_migratepages_range() function which
    extracts functionality from isolate_migratepages() so that it can be
    used on arbitrary PFN ranges.

    isolate_migratepages() function is implemented as a simple wrapper
    around isolate_migratepages_range().

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Tested-by: Rob Clark <rob.clark@linaro.org>
    Tested-by: Ohad Ben-Cohen <ohad@wizery.com>
    Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
    Tested-by: Robert Nelson <robertcnelson@gmail.com>
    Tested-by: Barry Song <Baohua.Song@csr.com>
    (cherry picked from commit 2fe86e0004076128f05d5a774b5c9c03d9dc3de2)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

commit 936e23ee1a0cf7323f5f9d20d6f885eacb2008a7
Author: Michal Nazarewicz <mina86@mina86.com>
Date:   Mon Oct 29 16:50:18 2012 +0900

    mm: page_alloc: remove trailing whitespace

    Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Acked-by: Mel Gorman <mel@csn.ul.ie>
    (cherry picked from commit 5f63b720b62925ef3c6a85473dcd547b0fd90616)

    Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
arm:sunxi:configs: enable CMA by default

Signed-off-by: Alejandro Mery <amery@geeks.cl>
sunxi: disp: Fix VGA DAC mode

Currently the DAC is set to 35.7 Ohm mode for VGA output. This results
in a too bright screen image with lighter greys indistinguishable
from white.

Setting it to 75 Ohm fixes this, which is obvious as VGA lines are
75 Ohm terminated.

Signed-off-by: Jens Kuske <jenskuske@gmail.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
gpio: sunxi: Add interrupt (eint) definitions for A10s SoC

Interrupt definitions are taken from the A10s datasheet. Tested on
A10s-OLinuXino-MICRO.

Signed-off-by: Tomas Novotny <novotny@rehivetech.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
arm:sunxi:configs: set CMA size to 192MB, as recommended by ssvb

Signed-off-by: Alejandro Mery <amery@geeks.cl>