cma: add placement specifier for "cma=" kernel parameter
Currently, "cma=" kernel parameter is used to specify the size of CMA, but we can't specify where it is located. We want to locate CMA below 4GB for devices only supporting 32-bit addressing on 64-bit systems without iommu. This enables to specify the placement of CMA by extending "cma=" kernel parameter. Examples: 1. locate 64MB CMA below 4GB by "cma=64M@0-4G" 2. locate 64MB CMA exact at 512MB by "cma=64M@512M" Note that the DMA contiguous memory allocator on x86 assumes that page_address() works for the pages to allocate. So this change requires to limit end address of contiguous memory area upto max_pfn_mapped to prevent from locating it on highmem area by the argument of dma_contiguous_reserve(). Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Don Dutile <ddutile@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
2bfc2862c4
commit
5ea3b1b2f8
4 changed files with 44 additions and 16 deletions
|
|
@ -88,7 +88,8 @@ static inline void dma_contiguous_set_default(struct cma *cma)
|
|||
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);
|
||||
phys_addr_t limit, struct cma **res_cma,
|
||||
bool fixed);
|
||||
|
||||
/**
|
||||
* dma_declare_contiguous() - reserve area for contiguous memory handling
|
||||
|
|
@ -108,7 +109,7 @@ static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size,
|
|||
{
|
||||
struct cma *cma;
|
||||
int ret;
|
||||
ret = dma_contiguous_reserve_area(size, base, limit, &cma);
|
||||
ret = dma_contiguous_reserve_area(size, base, limit, &cma, true);
|
||||
if (ret == 0)
|
||||
dev_set_cma_area(dev, cma);
|
||||
|
||||
|
|
@ -136,7 +137,9 @@ static inline void dma_contiguous_set_default(struct cma *cma) { }
|
|||
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) {
|
||||
phys_addr_t limit, struct cma **res_cma,
|
||||
bool fixed)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue