All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] arm64: mm: reserve CMA and crashkernel in ZONE_DMA if enabled
@ 2020-12-30 10:23 ` Chen Zhou
  0 siblings, 0 replies; 8+ messages in thread
From: Chen Zhou @ 2020-12-30 10:23 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: ardb, akpm, nsaenzjulienne, rppt, linux-arm-kernel, linux-kernel,
	chenzhou10, guohanjun, huawei.libin

Currently, CMA and crashkernel are reserved in ZONE_DMA32, which
is OK for majority of devices. But the ones that need them in ZONE_DMA
need to configure it explicitly.

Since patchset "arm64: Default to 32-bit wide ZONE_DMA", ZONE_DMA's
size is fine-tuned. So we could directly reserve CMA and crashkernel
in ZONE_DMA if CONFIG_ZONE_DMA is enabled, otherwise, reserving in
ZONE_DMA32.

Patch 1 updates the comments about the ZONE_DMA.
Patch 2 move dma_contiguous_reserve() to bootmem_init()
Patch 3 reserve CMA and crashkernel in ZONE_DMA if enabled

Changes since v1:
- Add Reviewed-by for patch 1 from Nicolas.
- Suggested by Nicolas, also reserve CMA in ZONE_DMA if enabled.

Chen Zhou (3):
  arm64: mm: update the comments about ZONE_DMA
  arm64: mm: move dma_contiguous_reserve() to bootmem_init()
  arm64: mm: reserve CMA and crashkernel in ZONE_DMA if enabled

 arch/arm64/mm/init.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 0/3] arm64: mm: reserve CMA and crashkernel in ZONE_DMA if enabled
@ 2020-12-30 10:23 ` Chen Zhou
  0 siblings, 0 replies; 8+ messages in thread
From: Chen Zhou @ 2020-12-30 10:23 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: chenzhou10, linux-kernel, nsaenzjulienne, rppt, huawei.libin,
	guohanjun, akpm, ardb, linux-arm-kernel

Currently, CMA and crashkernel are reserved in ZONE_DMA32, which
is OK for majority of devices. But the ones that need them in ZONE_DMA
need to configure it explicitly.

Since patchset "arm64: Default to 32-bit wide ZONE_DMA", ZONE_DMA's
size is fine-tuned. So we could directly reserve CMA and crashkernel
in ZONE_DMA if CONFIG_ZONE_DMA is enabled, otherwise, reserving in
ZONE_DMA32.

Patch 1 updates the comments about the ZONE_DMA.
Patch 2 move dma_contiguous_reserve() to bootmem_init()
Patch 3 reserve CMA and crashkernel in ZONE_DMA if enabled

Changes since v1:
- Add Reviewed-by for patch 1 from Nicolas.
- Suggested by Nicolas, also reserve CMA in ZONE_DMA if enabled.

Chen Zhou (3):
  arm64: mm: update the comments about ZONE_DMA
  arm64: mm: move dma_contiguous_reserve() to bootmem_init()
  arm64: mm: reserve CMA and crashkernel in ZONE_DMA if enabled

 arch/arm64/mm/init.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] arm64: mm: update the comments about ZONE_DMA
  2020-12-30 10:23 ` Chen Zhou
@ 2020-12-30 10:23   ` Chen Zhou
  -1 siblings, 0 replies; 8+ messages in thread
From: Chen Zhou @ 2020-12-30 10:23 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: ardb, akpm, nsaenzjulienne, rppt, linux-arm-kernel, linux-kernel,
	chenzhou10, guohanjun, huawei.libin

Since patchset "arm64: Default to 32-bit wide ZONE_DMA", ZONE_DMA's
size is fine-tuned. In the absence of addressing limited masters,
ZONE_DMA will span the whole 32-bit address space, otherwise, in
the case of the Raspberry Pi 4, it'll only span the 30-bit address
space. Update the comments.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm64/mm/init.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 75addb36354a..7b9809e39927 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -53,10 +53,11 @@ s64 memstart_addr __ro_after_init = -1;
 EXPORT_SYMBOL(memstart_addr);
 
 /*
- * We create both ZONE_DMA and ZONE_DMA32. ZONE_DMA covers the first 1G of
- * memory as some devices, namely the Raspberry Pi 4, have peripherals with
- * this limited view of the memory. ZONE_DMA32 will cover the rest of the 32
- * bit addressable memory area.
+ * We create both ZONE_DMA and ZONE_DMA32. ZONE_DMA's size is fine-tuned.
+ * In the absence of addressing limited masters, ZONE_DMA will span the
+ * whole 32-bit address space, otherwise, in the case of the Raspberry Pi 4,
+ * it'll only span the 30-bit address space. ZONE_DMA32 will cover the rest
+ * of the 32 bit addressable memory area.
  */
 phys_addr_t arm64_dma_phys_limit __ro_after_init;
 static phys_addr_t arm64_dma32_phys_limit __ro_after_init;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 1/3] arm64: mm: update the comments about ZONE_DMA
@ 2020-12-30 10:23   ` Chen Zhou
  0 siblings, 0 replies; 8+ messages in thread
From: Chen Zhou @ 2020-12-30 10:23 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: chenzhou10, linux-kernel, nsaenzjulienne, rppt, huawei.libin,
	guohanjun, akpm, ardb, linux-arm-kernel

Since patchset "arm64: Default to 32-bit wide ZONE_DMA", ZONE_DMA's
size is fine-tuned. In the absence of addressing limited masters,
ZONE_DMA will span the whole 32-bit address space, otherwise, in
the case of the Raspberry Pi 4, it'll only span the 30-bit address
space. Update the comments.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm64/mm/init.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 75addb36354a..7b9809e39927 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -53,10 +53,11 @@ s64 memstart_addr __ro_after_init = -1;
 EXPORT_SYMBOL(memstart_addr);
 
 /*
- * We create both ZONE_DMA and ZONE_DMA32. ZONE_DMA covers the first 1G of
- * memory as some devices, namely the Raspberry Pi 4, have peripherals with
- * this limited view of the memory. ZONE_DMA32 will cover the rest of the 32
- * bit addressable memory area.
+ * We create both ZONE_DMA and ZONE_DMA32. ZONE_DMA's size is fine-tuned.
+ * In the absence of addressing limited masters, ZONE_DMA will span the
+ * whole 32-bit address space, otherwise, in the case of the Raspberry Pi 4,
+ * it'll only span the 30-bit address space. ZONE_DMA32 will cover the rest
+ * of the 32 bit addressable memory area.
  */
 phys_addr_t arm64_dma_phys_limit __ro_after_init;
 static phys_addr_t arm64_dma32_phys_limit __ro_after_init;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] arm64: mm: move dma_contiguous_reserve() to bootmem_init()
  2020-12-30 10:23 ` Chen Zhou
@ 2020-12-30 10:23   ` Chen Zhou
  -1 siblings, 0 replies; 8+ messages in thread
From: Chen Zhou @ 2020-12-30 10:23 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: ardb, akpm, nsaenzjulienne, rppt, linux-arm-kernel, linux-kernel,
	chenzhou10, guohanjun, huawei.libin

Like crashkernel, CMA might also reserve memory located in ZONE_DMA,
so move dma_contiguous_reserve() to bootmem_init() to make sure that
arm64_dma_phys_limit is populated.

Just place dma_contiguous_reserve() after reserve_crashkernel() as
before.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Suggested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm64/mm/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 7b9809e39927..64a0e8f551d6 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -403,8 +403,6 @@ void __init arm64_memblock_init(void)
 	reserve_elfcorehdr();
 
 	high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
-
-	dma_contiguous_reserve(arm64_dma32_phys_limit);
 }
 
 void __init bootmem_init(void)
@@ -445,6 +443,8 @@ void __init bootmem_init(void)
 	 */
 	reserve_crashkernel();
 
+	dma_contiguous_reserve(arm64_dma32_phys_limit);
+
 	memblock_dump_all();
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/3] arm64: mm: move dma_contiguous_reserve() to bootmem_init()
@ 2020-12-30 10:23   ` Chen Zhou
  0 siblings, 0 replies; 8+ messages in thread
From: Chen Zhou @ 2020-12-30 10:23 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: chenzhou10, linux-kernel, nsaenzjulienne, rppt, huawei.libin,
	guohanjun, akpm, ardb, linux-arm-kernel

Like crashkernel, CMA might also reserve memory located in ZONE_DMA,
so move dma_contiguous_reserve() to bootmem_init() to make sure that
arm64_dma_phys_limit is populated.

Just place dma_contiguous_reserve() after reserve_crashkernel() as
before.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Suggested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm64/mm/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 7b9809e39927..64a0e8f551d6 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -403,8 +403,6 @@ void __init arm64_memblock_init(void)
 	reserve_elfcorehdr();
 
 	high_memory = __va(memblock_end_of_DRAM() - 1) + 1;
-
-	dma_contiguous_reserve(arm64_dma32_phys_limit);
 }
 
 void __init bootmem_init(void)
@@ -445,6 +443,8 @@ void __init bootmem_init(void)
 	 */
 	reserve_crashkernel();
 
+	dma_contiguous_reserve(arm64_dma32_phys_limit);
+
 	memblock_dump_all();
 }
 
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] arm64: mm: reserve CMA and crashkernel in ZONE_DMA if enabled
  2020-12-30 10:23 ` Chen Zhou
@ 2020-12-30 10:23   ` Chen Zhou
  -1 siblings, 0 replies; 8+ messages in thread
From: Chen Zhou @ 2020-12-30 10:23 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: ardb, akpm, nsaenzjulienne, rppt, linux-arm-kernel, linux-kernel,
	chenzhou10, guohanjun, huawei.libin

Currently, CMA and crashkernel are reserved in ZONE_DMA32, which
is OK for majority of devices. But the ones that need them in ZONE_DMA
need to configure it explicitly.

Since patchset "arm64: Default to 32-bit wide ZONE_DMA", ZONE_DMA's
size is fine-tuned. So we could directly reserve CMA and crashkernel
in ZONE_DMA if CONFIG_ZONE_DMA is enabled, otherwise, reserving in
ZONE_DMA32.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Suggested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm64/mm/init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 64a0e8f551d6..26de149b21c7 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -85,7 +85,8 @@ static void __init reserve_crashkernel(void)
 
 	if (crash_base == 0) {
 		/* Current arm64 boot protocol requires 2MB alignment */
-		crash_base = memblock_find_in_range(0, arm64_dma32_phys_limit,
+		crash_base = memblock_find_in_range(0,
+				arm64_dma_phys_limit ? : arm64_dma32_phys_limit,
 				crash_size, SZ_2M);
 		if (crash_base == 0) {
 			pr_warn("cannot allocate crashkernel (size:0x%llx)\n",
@@ -443,7 +444,7 @@ void __init bootmem_init(void)
 	 */
 	reserve_crashkernel();
 
-	dma_contiguous_reserve(arm64_dma32_phys_limit);
+	dma_contiguous_reserve(arm64_dma_phys_limit ? : arm64_dma32_phys_limit);
 
 	memblock_dump_all();
 }
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/3] arm64: mm: reserve CMA and crashkernel in ZONE_DMA if enabled
@ 2020-12-30 10:23   ` Chen Zhou
  0 siblings, 0 replies; 8+ messages in thread
From: Chen Zhou @ 2020-12-30 10:23 UTC (permalink / raw)
  To: catalin.marinas, will
  Cc: chenzhou10, linux-kernel, nsaenzjulienne, rppt, huawei.libin,
	guohanjun, akpm, ardb, linux-arm-kernel

Currently, CMA and crashkernel are reserved in ZONE_DMA32, which
is OK for majority of devices. But the ones that need them in ZONE_DMA
need to configure it explicitly.

Since patchset "arm64: Default to 32-bit wide ZONE_DMA", ZONE_DMA's
size is fine-tuned. So we could directly reserve CMA and crashkernel
in ZONE_DMA if CONFIG_ZONE_DMA is enabled, otherwise, reserving in
ZONE_DMA32.

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
Suggested-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm64/mm/init.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 64a0e8f551d6..26de149b21c7 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -85,7 +85,8 @@ static void __init reserve_crashkernel(void)
 
 	if (crash_base == 0) {
 		/* Current arm64 boot protocol requires 2MB alignment */
-		crash_base = memblock_find_in_range(0, arm64_dma32_phys_limit,
+		crash_base = memblock_find_in_range(0,
+				arm64_dma_phys_limit ? : arm64_dma32_phys_limit,
 				crash_size, SZ_2M);
 		if (crash_base == 0) {
 			pr_warn("cannot allocate crashkernel (size:0x%llx)\n",
@@ -443,7 +444,7 @@ void __init bootmem_init(void)
 	 */
 	reserve_crashkernel();
 
-	dma_contiguous_reserve(arm64_dma32_phys_limit);
+	dma_contiguous_reserve(arm64_dma_phys_limit ? : arm64_dma32_phys_limit);
 
 	memblock_dump_all();
 }
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-30 10:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-30 10:23 [PATCH v2 0/3] arm64: mm: reserve CMA and crashkernel in ZONE_DMA if enabled Chen Zhou
2020-12-30 10:23 ` Chen Zhou
2020-12-30 10:23 ` [PATCH v2 1/3] arm64: mm: update the comments about ZONE_DMA Chen Zhou
2020-12-30 10:23   ` Chen Zhou
2020-12-30 10:23 ` [PATCH v2 2/3] arm64: mm: move dma_contiguous_reserve() to bootmem_init() Chen Zhou
2020-12-30 10:23   ` Chen Zhou
2020-12-30 10:23 ` [PATCH v2 3/3] arm64: mm: reserve CMA and crashkernel in ZONE_DMA if enabled Chen Zhou
2020-12-30 10:23   ` Chen Zhou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.