Re: [RFC PATCH v4 12/16] powerpc/e500: Encode hugepage size in PTE bits

From: Oscar Salvador
Date: Wed May 29 2024 - 06:10:11 EST


On Wed, May 29, 2024 at 09:49:48AM +0000, Christophe Leroy wrote:
> Doesn't really matter if it's PUD or PMD at this point. On a 32 bits
> kernel it will be all PMD while on a 64 bits kernel it is both PMD and PUD.
>
> At the time being (as implemented with hugepd), Linux support 4M, 16M,
> 64M, 256M and 1G (Shifts 22, 24, 26, 28, 30)
>
> The hardware supports the following page sizes, and encodes them on 4
> bits allthough it is not directly a shift. Maybe it would be better to
> use that encoding after all:

I think so.

>
> 0001 4 Kbytes (Shift 12)
> 0010 16 Kbytes (Shift 14)
> 0011 64 Kbytes (Shift 16)
> 0100 256 Kbytes (Shift 18)
> 0101 1 Mbyte (Shift 20)
> 0110 4 Mbytes (Shift 22)
> 0111 16 Mbytes (Shift 24)
> 1000 64 Mbytes (Shift 26)
> 1001 256 Mbytes (Shift 28)
> 1010 1 Gbyte (e500v2 only) (Shift 30)
> 1011 4 Gbytes (e500v2 only) (Shift 32)

You say hugehages start at 2MB (shift 21), but you say that the smallest hugepage
Linux support is 4MB (shift 22).?


--
Oscar Salvador
SUSE Labs