All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: Use correct method to calculate nomap region boundaries
@ 2021-10-22  7:06 Huacai Chen
  2021-10-27  8:35 ` Huacai Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Huacai Chen @ 2021-10-22  7:06 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon, Arnd Bergmann
  Cc: linux-arm-kernel, Huacai Chen, Jiaxun Yang, Huacai Chen

Nomap regions are treated as "reserved". When region boundaries are not
page aligned, we usually increase the "reserved" regions rather than
decrease them. So, we should use memblock_region_reserved_base_pfn()/
memblock_region_reserved_end_pfn() instead of memblock_region_memory_
base_pfn()/memblock_region_memory_base_pfn() to calculate boundaries.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 arch/arm64/kernel/setup.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index be5f85b0a24d..1e86d4c5ef8c 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -232,12 +232,14 @@ static void __init request_standard_resources(void)
 		if (memblock_is_nomap(region)) {
 			res->name  = "reserved";
 			res->flags = IORESOURCE_MEM;
+			res->start = __pfn_to_phys(memblock_region_reserved_base_pfn(region));
+			res->end = __pfn_to_phys(memblock_region_reserved_end_pfn(region)) - 1;
 		} else {
 			res->name  = "System RAM";
 			res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
+			res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
+			res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
 		}
-		res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
-		res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
 
 		request_resource(&iomem_resource, res);
 
-- 
2.27.0


_______________________________________________
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] 11+ messages in thread

end of thread, other threads:[~2022-01-05 18:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-22  7:06 [PATCH] arm64: Use correct method to calculate nomap region boundaries Huacai Chen
2021-10-27  8:35 ` Huacai Chen
2021-11-01  1:53   ` Guo Ren
2021-11-07 10:10     ` Huacai Chen
2021-12-02 10:08 ` Will Deacon
2021-12-06  4:46   ` Huacai Chen
2021-12-13 19:07     ` Will Deacon
2021-12-14  0:50       ` Huacai Chen
2021-12-14 14:11         ` Will Deacon
2021-12-15  0:31           ` Huacai Chen
2022-01-05 18:20 ` Catalin Marinas

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.