Skip to contentSkip to conversation

+ cma-add-placement-specifier-for-cma=-kernel-parameter.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Apr 16, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Subject: + cma-add-placement-specifier-for-cma=-kernel-parameter.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Wed, 16 Apr 2014 12:44:50 -0700

The patch titled
Subject: cma: add placement specifier for "cma=" kernel parameter
has been added to the -mm tree. Its filename is
cma-add-placement-specifier-for-cma=-kernel-parameter.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/cma-add-placement-specifier-for-cma=-kernel-parameter.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/cma-add-placement-specifier-for-cma=-kernel-parameter.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Akinobu Mita <[email protected]>
Subject: 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().

Cc Marek Szyprowski <[email protected]>
Cc Konrad Rzeszutek Wilk <[email protected]>
Cc David Woodhouse <[email protected]>
Cc Don Dutile <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Andi Kleen <[email protected]>
Cc Yinghai Lu <[email protected]>

---

 Documentation/kernel-parameters.txt |    7 +++-
 arch/x86/kernel/setup.c             |    2 -
 drivers/base/dma-contiguous.c       |   42 +++++++++++++++++++-------
 include/linux/dma-contiguous.h      |    9 +++--
 4 files changed, 44 insertions(+), 16 deletions(-)
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cma-add-placement-specifier-for-cma=-kernel-parameter +5 -2
diff -puN Documentation/kernel-parameters.txt~cma-add-placement-specifier-for-cma=-kernel-parameter Documentation/kernel-parameters.txt
@@ -617,8 +617,11 @@ bytes respectively. Such letter suffixes
 			Also note the kernel might malfunction if you disable
 			some critical bits.
 
-	cma=nn[MG]	[ARM,KNL]
-			Sets the size of kernel global memory area for contiguous
+	cma=nn[MG]@[start[MG][-end[MG]]]
+			[ARM,X86,KNL]
+			Sets the size of kernel global memory area for
+			contiguous memory allocations and optionally the
+			placement constraint by the physical address range of
 			memory allocations. For more information, see
 			include/linux/dma-contiguous.h
 
arch/x86/kernel/setup.c renamed from arch/x86/kernel/setup.c~cma-add-placement-specifier-for-cma=-kernel-parameter +1 -1
diff -puN arch/x86/kernel/setup.c~cma-add-placement-specifier-for-cma=-kernel-parameter arch/x86/kernel/setup.c
@@ -1119,7 +1119,7 @@ void __init setup_arch(char **cmdline_p)
 	setup_real_mode();
 
 	memblock_set_current_limit(get_max_mapped());
-	dma_contiguous_reserve(0);
+	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
 
 	/*
 	 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
drivers/base/dma-contiguous.c renamed from drivers/base/dma-contiguous.c~cma-add-placement-specifier-for-cma=-kernel-parameter +32 -10

97 lines not on this page · raw message

include/linux/dma-contiguous.h renamed from include/linux/dma-contiguous.h~cma-add-placement-specifier-for-cma=-kernel-parameter +6 -3
diff -puN include/linux/dma-contiguous.h~cma-add-placement-specifier-for-cma=-kernel-parameter include/linux/dma-contiguous.h
@@ -88,7 +88,8 @@ static inline void dma_contiguous_set_de
 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 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_de
 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;
 }
 

_

Patches currently in -mm which might be from [email protected] are

x86-make-dma_alloc_coherent-return-zeroed-memory-if-cma-is-enabled.patch x86-enable-dma-cma-with-swiotlb.patch intel-iommu-integrate-dma-cma.patch memblock-introduce-memblock_alloc_range.patch cma-add-placement-specifier-for-cma=-kernel-parameter.patch