forked from luck/tmp_suning_uos_patched
dma-mapping: merge <linux/dma-contiguous.h> into <linux/dma-map-ops.h>
Merge dma-contiguous.h into dma-map-ops.h, after removing the comment describing the contiguous allocator into kernel/dma/contigous.c. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
580a0cc9c3
commit
0b1abd1fb7
|
@ -597,7 +597,7 @@
|
||||||
placement constraint by the physical address range of
|
placement constraint by the physical address range of
|
||||||
memory allocations. A value of 0 disables CMA
|
memory allocations. A value of 0 disables CMA
|
||||||
altogether. For more information, see
|
altogether. For more information, see
|
||||||
include/linux/dma-contiguous.h
|
kernel/dma/contiguous.c
|
||||||
|
|
||||||
cma_pernuma=nn[MG]
|
cma_pernuma=nn[MG]
|
||||||
[ARM64,KNL]
|
[ARM64,KNL]
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <linux/clk-provider.h>
|
#include <linux/clk-provider.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/clkdev.h>
|
#include <linux/clkdev.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dmaengine.h>
|
#include <linux/dmaengine.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
#include <linux/clocksource.h>
|
#include <linux/clocksource.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/dma-map-ops.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-noncoherent.h>
|
#include <linux/dma-noncoherent.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
#include <linux/stop_machine.h>
|
#include <linux/stop_machine.h>
|
||||||
#include <linux/swiotlb.h>
|
#include <linux/swiotlb.h>
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_fdt.h>
|
#include <linux/of_fdt.h>
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
#include <linux/swiotlb.h>
|
#include <linux/swiotlb.h>
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_fdt.h>
|
#include <linux/of_fdt.h>
|
||||||
#include <linux/start_kernel.h>
|
#include <linux/start_kernel.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/screen_info.h>
|
#include <linux/screen_info.h>
|
||||||
#include <asm/sections.h>
|
#include <asm/sections.h>
|
||||||
#include <asm/mmu_context.h>
|
#include <asm/mmu_context.h>
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
|
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
|
||||||
|
|
||||||
#include <linux/cache.h>
|
#include <linux/cache.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/dma-noncoherent.h>
|
#include <linux/dma-noncoherent.h>
|
||||||
#include <linux/genalloc.h>
|
#include <linux/genalloc.h>
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* for more details.
|
* for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <linux/kexec.h>
|
#include <linux/kexec.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/decompress/generic.h>
|
#include <linux/decompress/generic.h>
|
||||||
#include <linux/of_fdt.h>
|
#include <linux/of_fdt.h>
|
||||||
#include <linux/of_reserved_mem.h>
|
#include <linux/of_reserved_mem.h>
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/dma-map-ops.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-noncoherent.h>
|
#include <linux/dma-noncoherent.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
|
|
||||||
#include <asm/cache.h>
|
#include <asm/cache.h>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <linux/root_dev.h>
|
#include <linux/root_dev.h>
|
||||||
#include <linux/console.h>
|
#include <linux/console.h>
|
||||||
#include <linux/kernel_stat.h>
|
#include <linux/kernel_stat.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/notifier.h>
|
#include <linux/notifier.h>
|
||||||
#include <linux/pfn.h>
|
#include <linux/pfn.h>
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include <linux/dma-debug.h>
|
#include <linux/dma-debug.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/swiotlb.h>
|
#include <asm/swiotlb.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
|
|
||||||
extern int iommu_merge;
|
extern int iommu_merge;
|
||||||
extern int panic_on_overflow;
|
extern int panic_on_overflow;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
#include <linux/console.h>
|
#include <linux/console.h>
|
||||||
#include <linux/crash_dump.h>
|
#include <linux/crash_dump.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dmi.h>
|
#include <linux/dmi.h>
|
||||||
#include <linux/efi.h>
|
#include <linux/efi.h>
|
||||||
#include <linux/init_ohci1394_dma.h>
|
#include <linux/init_ohci1394_dma.h>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
|
* Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-noncoherent.h>
|
#include <linux/dma-noncoherent.h>
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <linux/nodemask.h>
|
#include <linux/nodemask.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/of_fdt.h>
|
#include <linux/of_fdt.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
|
|
||||||
#include <asm/bootparam.h>
|
#include <asm/bootparam.h>
|
||||||
#include <asm/page.h>
|
#include <asm/page.h>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/dma-buf.h>
|
#include <linux/dma-buf.h>
|
||||||
#include <linux/dma-heap.h>
|
#include <linux/dma-heap.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/scatterlist.h>
|
#include <linux/scatterlist.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/dma-iommu.h>
|
#include <linux/dma-iommu.h>
|
||||||
#include <linux/iommu-helper.h>
|
#include <linux/iommu-helper.h>
|
||||||
|
@ -28,7 +28,6 @@
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/msi.h>
|
#include <linux/msi.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/irqdomain.h>
|
#include <linux/irqdomain.h>
|
||||||
#include <linux/percpu.h>
|
#include <linux/percpu.h>
|
||||||
#include <linux/iova.h>
|
#include <linux/iova.h>
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include <linux/acpi_iort.h>
|
#include <linux/acpi_iort.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/dma-map-ops.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/dma-iommu.h>
|
#include <linux/dma-iommu.h>
|
||||||
#include <linux/dma-noncoherent.h>
|
#include <linux/dma-noncoherent.h>
|
||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include <linux/dmi.h>
|
#include <linux/dmi.h>
|
||||||
#include <linux/pci-ats.h>
|
#include <linux/pci-ats.h>
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/crash_dump.h>
|
#include <linux/crash_dump.h>
|
||||||
#include <linux/numa.h>
|
#include <linux/numa.h>
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
|
|
@ -1,135 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
||||||
#ifndef __LINUX_CMA_H
|
|
||||||
#define __LINUX_CMA_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Contiguous Memory Allocator for DMA mapping framework
|
|
||||||
* Copyright (c) 2010-2011 by Samsung Electronics.
|
|
||||||
* Written by:
|
|
||||||
* Marek Szyprowski <m.szyprowski@samsung.com>
|
|
||||||
* Michal Nazarewicz <mina86@mina86.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Contiguous Memory Allocator
|
|
||||||
*
|
|
||||||
* The Contiguous Memory Allocator (CMA) makes it possible to
|
|
||||||
* allocate big contiguous chunks of memory after the system has
|
|
||||||
* booted.
|
|
||||||
*
|
|
||||||
* Why is it needed?
|
|
||||||
*
|
|
||||||
* Various devices on embedded systems have no scatter-getter and/or
|
|
||||||
* IO map support and require contiguous blocks of memory to
|
|
||||||
* operate. They include devices such as cameras, hardware video
|
|
||||||
* coders, etc.
|
|
||||||
*
|
|
||||||
* Such devices often require big memory buffers (a full HD frame
|
|
||||||
* is, for instance, more then 2 mega pixels large, i.e. more than 6
|
|
||||||
* MB of memory), which makes mechanisms such as kmalloc() or
|
|
||||||
* alloc_page() ineffective.
|
|
||||||
*
|
|
||||||
* At the same time, a solution where a big memory region is
|
|
||||||
* reserved for a device is suboptimal since often more memory is
|
|
||||||
* reserved then strictly required and, moreover, the memory is
|
|
||||||
* inaccessible to page system even if device drivers don't use it.
|
|
||||||
*
|
|
||||||
* CMA tries to solve this issue by operating on memory regions
|
|
||||||
* where only movable pages can be allocated from. This way, kernel
|
|
||||||
* can use the memory for pagecache and when device driver requests
|
|
||||||
* it, allocated pages can be migrated.
|
|
||||||
*
|
|
||||||
* Driver usage
|
|
||||||
*
|
|
||||||
* CMA should not be used by the device drivers directly. It is
|
|
||||||
* only a helper framework for dma-mapping subsystem.
|
|
||||||
*
|
|
||||||
* For more information, see kernel-docs in kernel/dma/contiguous.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
|
|
||||||
#include <linux/device.h>
|
|
||||||
#include <linux/mm.h>
|
|
||||||
|
|
||||||
struct cma;
|
|
||||||
struct page;
|
|
||||||
|
|
||||||
#ifdef CONFIG_DMA_CMA
|
|
||||||
|
|
||||||
extern struct cma *dma_contiguous_default_area;
|
|
||||||
|
|
||||||
static inline struct cma *dev_get_cma_area(struct device *dev)
|
|
||||||
{
|
|
||||||
if (dev && dev->cma_area)
|
|
||||||
return dev->cma_area;
|
|
||||||
return dma_contiguous_default_area;
|
|
||||||
}
|
|
||||||
|
|
||||||
void dma_contiguous_reserve(phys_addr_t addr_limit);
|
|
||||||
|
|
||||||
int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
|
|
||||||
phys_addr_t limit, struct cma **res_cma,
|
|
||||||
bool fixed);
|
|
||||||
|
|
||||||
struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
|
|
||||||
unsigned int order, bool no_warn);
|
|
||||||
bool dma_release_from_contiguous(struct device *dev, struct page *pages,
|
|
||||||
int count);
|
|
||||||
struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp);
|
|
||||||
void dma_free_contiguous(struct device *dev, struct page *page, size_t size);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static inline struct cma *dev_get_cma_area(struct device *dev)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dma_contiguous_reserve(phys_addr_t limit) { }
|
|
||||||
|
|
||||||
static inline int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
|
|
||||||
phys_addr_t limit, struct cma **res_cma,
|
|
||||||
bool fixed)
|
|
||||||
{
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
|
|
||||||
unsigned int order, bool no_warn)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline
|
|
||||||
bool dma_release_from_contiguous(struct device *dev, struct page *pages,
|
|
||||||
int count)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Use fallback alloc() and free() when CONFIG_DMA_CMA=n */
|
|
||||||
static inline struct page *dma_alloc_contiguous(struct device *dev, size_t size,
|
|
||||||
gfp_t gfp)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void dma_free_contiguous(struct device *dev, struct page *page,
|
|
||||||
size_t size)
|
|
||||||
{
|
|
||||||
__free_pages(page, get_order(size));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_DMA_PERNUMA_CMA
|
|
||||||
void dma_pernuma_cma_reserve(void);
|
|
||||||
#else
|
|
||||||
static inline void dma_pernuma_cma_reserve(void) { }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
|
|
||||||
|
struct cma;
|
||||||
|
|
||||||
struct dma_map_ops {
|
struct dma_map_ops {
|
||||||
void *(*alloc)(struct device *dev, size_t size,
|
void *(*alloc)(struct device *dev, size_t size,
|
||||||
dma_addr_t *dma_handle, gfp_t gfp,
|
dma_addr_t *dma_handle, gfp_t gfp,
|
||||||
|
@ -94,6 +96,69 @@ static inline void set_dma_ops(struct device *dev,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_DMA_OPS */
|
#endif /* CONFIG_DMA_OPS */
|
||||||
|
|
||||||
|
#ifdef CONFIG_DMA_CMA
|
||||||
|
extern struct cma *dma_contiguous_default_area;
|
||||||
|
|
||||||
|
static inline struct cma *dev_get_cma_area(struct device *dev)
|
||||||
|
{
|
||||||
|
if (dev && dev->cma_area)
|
||||||
|
return dev->cma_area;
|
||||||
|
return dma_contiguous_default_area;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dma_contiguous_reserve(phys_addr_t addr_limit);
|
||||||
|
int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
|
||||||
|
phys_addr_t limit, struct cma **res_cma, bool fixed);
|
||||||
|
|
||||||
|
struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
|
||||||
|
unsigned int order, bool no_warn);
|
||||||
|
bool dma_release_from_contiguous(struct device *dev, struct page *pages,
|
||||||
|
int count);
|
||||||
|
struct page *dma_alloc_contiguous(struct device *dev, size_t size, gfp_t gfp);
|
||||||
|
void dma_free_contiguous(struct device *dev, struct page *page, size_t size);
|
||||||
|
#else /* CONFIG_DMA_CMA */
|
||||||
|
static inline struct cma *dev_get_cma_area(struct device *dev)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
static inline void dma_contiguous_reserve(phys_addr_t limit)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
static inline int dma_contiguous_reserve_area(phys_addr_t size,
|
||||||
|
phys_addr_t base, phys_addr_t limit, struct cma **res_cma,
|
||||||
|
bool fixed)
|
||||||
|
{
|
||||||
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
static inline struct page *dma_alloc_from_contiguous(struct device *dev,
|
||||||
|
size_t count, unsigned int order, bool no_warn)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
static inline bool dma_release_from_contiguous(struct device *dev,
|
||||||
|
struct page *pages, int count)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/* Use fallback alloc() and free() when CONFIG_DMA_CMA=n */
|
||||||
|
static inline struct page *dma_alloc_contiguous(struct device *dev, size_t size,
|
||||||
|
gfp_t gfp)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
static inline void dma_free_contiguous(struct device *dev, struct page *page,
|
||||||
|
size_t size)
|
||||||
|
{
|
||||||
|
__free_pages(page, get_order(size));
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_DMA_CMA*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_DMA_PERNUMA_CMA
|
||||||
|
void dma_pernuma_cma_reserve(void);
|
||||||
|
#else
|
||||||
|
static inline void dma_pernuma_cma_reserve(void) { }
|
||||||
|
#endif /* CONFIG_DMA_PERNUMA_CMA */
|
||||||
|
|
||||||
#ifdef CONFIG_DMA_DECLARE_COHERENT
|
#ifdef CONFIG_DMA_DECLARE_COHERENT
|
||||||
int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
|
int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
|
||||||
dma_addr_t device_addr, size_t size);
|
dma_addr_t device_addr, size_t size);
|
||||||
|
|
|
@ -118,7 +118,7 @@ config DMA_CMA
|
||||||
You can disable CMA by specifying "cma=0" on the kernel's command
|
You can disable CMA by specifying "cma=0" on the kernel's command
|
||||||
line.
|
line.
|
||||||
|
|
||||||
For more information see <include/linux/dma-contiguous.h>.
|
For more information see <kernel/dma/contiguous.c>.
|
||||||
If unsure, say "n".
|
If unsure, say "n".
|
||||||
|
|
||||||
if DMA_CMA
|
if DMA_CMA
|
||||||
|
|
|
@ -5,6 +5,34 @@
|
||||||
* Written by:
|
* Written by:
|
||||||
* Marek Szyprowski <m.szyprowski@samsung.com>
|
* Marek Szyprowski <m.szyprowski@samsung.com>
|
||||||
* Michal Nazarewicz <mina86@mina86.com>
|
* Michal Nazarewicz <mina86@mina86.com>
|
||||||
|
*
|
||||||
|
* Contiguous Memory Allocator
|
||||||
|
*
|
||||||
|
* The Contiguous Memory Allocator (CMA) makes it possible to
|
||||||
|
* allocate big contiguous chunks of memory after the system has
|
||||||
|
* booted.
|
||||||
|
*
|
||||||
|
* Why is it needed?
|
||||||
|
*
|
||||||
|
* Various devices on embedded systems have no scatter-getter and/or
|
||||||
|
* IO map support and require contiguous blocks of memory to
|
||||||
|
* operate. They include devices such as cameras, hardware video
|
||||||
|
* coders, etc.
|
||||||
|
*
|
||||||
|
* Such devices often require big memory buffers (a full HD frame
|
||||||
|
* is, for instance, more then 2 mega pixels large, i.e. more than 6
|
||||||
|
* MB of memory), which makes mechanisms such as kmalloc() or
|
||||||
|
* alloc_page() ineffective.
|
||||||
|
*
|
||||||
|
* At the same time, a solution where a big memory region is
|
||||||
|
* reserved for a device is suboptimal since often more memory is
|
||||||
|
* reserved then strictly required and, moreover, the memory is
|
||||||
|
* inaccessible to page system even if device drivers don't use it.
|
||||||
|
*
|
||||||
|
* CMA tries to solve this issue by operating on memory regions
|
||||||
|
* where only movable pages can be allocated from. This way, kernel
|
||||||
|
* can use the memory for pagecache and when device driver requests
|
||||||
|
* it, allocated pages can be migrated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define pr_fmt(fmt) "cma: " fmt
|
#define pr_fmt(fmt) "cma: " fmt
|
||||||
|
@ -21,7 +49,7 @@
|
||||||
#include <linux/memblock.h>
|
#include <linux/memblock.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/cma.h>
|
#include <linux/cma.h>
|
||||||
|
|
||||||
#ifdef CONFIG_CMA_SIZE_MBYTES
|
#ifdef CONFIG_CMA_SIZE_MBYTES
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/dma-map-ops.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/scatterlist.h>
|
#include <linux/scatterlist.h>
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/pfn.h>
|
#include <linux/pfn.h>
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
#include <linux/set_memory.h>
|
#include <linux/set_memory.h>
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
* Helpers for DMA ops implementations. These generally rely on the fact that
|
* Helpers for DMA ops implementations. These generally rely on the fact that
|
||||||
* the allocated memory contains normal pages in the direct kernel mapping.
|
* the allocated memory contains normal pages in the direct kernel mapping.
|
||||||
*/
|
*/
|
||||||
#include <linux/dma-contiguous.h>
|
|
||||||
#include <linux/dma-map-ops.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-noncoherent.h>
|
#include <linux/dma-noncoherent.h>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
#include <linux/cma.h>
|
#include <linux/cma.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/dma-contiguous.h>
|
#include <linux/dma-map-ops.h>
|
||||||
#include <linux/dma-direct.h>
|
#include <linux/dma-direct.h>
|
||||||
#include <linux/dma-noncoherent.h>
|
#include <linux/dma-noncoherent.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user