powerpc/mm: Align memory_limit value specified using mem= kernel parameter
authorAneesh Kumar K.V (IBM) <aneesh.kumar@kernel.org>
Wed, 3 Apr 2024 08:36:09 +0000 (14:06 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 19 Apr 2024 06:09:14 +0000 (16:09 +1000)
commit5ca096161cdccfa328acf6704a4615528471d309
treebc4128a37e62f302440fe3d7b802a45aac25aa40
parentf318c8be797f8572629d5386a88cde7d753457a8
powerpc/mm: Align memory_limit value specified using mem= kernel parameter

The value specified for the memory limit is used to set a restriction on
memory usage. It is important to ensure that this restriction is within
the linear map kernel address space range. The hash page table
translation uses a 16MB page size to map the kernel linear map address
space. htab_bolt_mapping() function aligns down the size of the range
while mapping kernel linear address space. Since the memblock limit is
enforced very early during boot, before we can detect the type of memory
translation (radix vs hash), we align the memory limit value specified
as a kernel parameter to 16MB. This alignment value will work for both
hash and radix translations.

Signed-off-by: Aneesh Kumar K.V (IBM) <aneesh.kumar@kernel.org>
Acked-by: Joel Savitz <jsavitz@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240403083611.172833-1-aneesh.kumar@kernel.org
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/prom_init.c