Oliver, My understanding is that AArch64 (ARMv8) supports 3 page table granules: 4KB, 16KB, and 64KB [1]. These granules represent the smallest range for a page table, and this granule changes which bits of the VA index into what level of paging. On x86 this indexing was fixed an a 2 MiB page table just liveds higher up in the same hierarchy. While AArch64 supports all 3 granule sizes, how many granule sizes are supported by a given CPU is implementation defined. So it is legal for an AArch64 CPU to only support 64KB pages. You can always do 4K pages on Intel, so that is the difference. [1] https://developer.arm.com/documentation/101811/0103/Translation-granule Thanks, Andrew Fish > On Aug 9, 2023, at 5:35 PM, Oliver Smith-Denny wrote: > > Hi Ard, > > I just sent out a patch (MdeModulePkg: HeapGuard: Don't Assume Pool Head > Allocated In First Page) to fix HeapGuard GuardAlignedToTail behavior on > ARM64. However, this raised a question of why ARM64 sets > RUNTIME_PAGE_ALLOCATION_GRANULARITY to 64k when X64 does not. You added > this in ProcessorBind.h for ARM64, so I am hoping to get some additional > context from you (or anyone on the mailing list who has insight). > > I understand that on ARM64 we can have 64k pages in the OS, but what I > do not understand is why we need to map in 64k chunks in UEFI. I see the > UEFI spec says that ARM allows for 64K pages and that if runtime code > or data is within a 64KB page then all 4k pages within that 64K page > need the same memory attributes, which makes sense. > > Is this runtime granularity just to satisfy that requirement that the > memory attributes are the same or is there an additional reason that > we need to use the 64k granularity on ARM64? > > In any case, I am confused why this is not an issue on X64 or if we > have 2MB pages in the OS? I'm not as familiar with the mechanisms an > OS will use to map runtime services within its space, but they will be > virtualized and the OS will have its own page tables, so it doesn't > quite follow to me why the OS cares all that much what UEFI has done. > > Any light you can shed here would be greatly appreciated. > > Thanks, > Oliver > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107660): https://edk2.groups.io/g/devel/message/107660 Mute This Topic: https://groups.io/mt/100652665/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-