Skip to content

Commit daa149d

Browse files
chenhuacaictmarinas
authored andcommitted
arm64: Use correct method to calculate nomap region boundaries
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> Link: https://lore.kernel.org/r/20211022070646.41923-1-chenhuacai@loongson.cn Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 89d30b1 commit daa149d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

arch/arm64/kernel/setup.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,14 @@ static void __init request_standard_resources(void)
237237
if (memblock_is_nomap(region)) {
238238
res->name = "reserved";
239239
res->flags = IORESOURCE_MEM;
240+
res->start = __pfn_to_phys(memblock_region_reserved_base_pfn(region));
241+
res->end = __pfn_to_phys(memblock_region_reserved_end_pfn(region)) - 1;
240242
} else {
241243
res->name = "System RAM";
242244
res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
245+
res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
246+
res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
243247
}
244-
res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
245-
res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
246248

247249
request_resource(&iomem_resource, res);
248250

0 commit comments

Comments
 (0)