]> git.proxmox.com Git - mirror_edk2.git/commit
ArmPkg: correct TTBR1_EL1 settings in TCR_EL1
authorMark Rutland <mark.rutland@arm.com>
Thu, 19 Nov 2015 14:14:25 +0000 (14:14 +0000)
committerabiesheuvel <abiesheuvel@Edk2>
Thu, 19 Nov 2015 14:14:25 +0000 (14:14 +0000)
commitfafb7e9c110eb89d1d1da18a822cae49758b76f6
tree868a86cd740cc3214399a6117201607b4e8c5feb
parent1a6f74d98887377bd5bb61484e54a3ac406f4a5d
ArmPkg: correct TTBR1_EL1 settings in TCR_EL1

As EDK2 runs in an idmap, we do not use TTBR1_EL1, nor do we configure
it. TTBR1_EL1 may contain UNKNOWN values if it is not programmed since
reset.

Prior to enabling the MMU, we do not set TCR_EL1.EPD1, and hence the CPU
may make page table walks via TTBR1_EL1 at any time, potentially using
UNKNOWN values. This can result in a number of potential problems (e.g.
the CPU may load from MMIO registers as part of a page table walk).

Additionally, in the presence of Cortex-A57 erratum #822227, we must
program TCR_EL1.TG1 == 0b1x (e.g. 4KB granule) regardless of the value
of TCR_EL1.EPD1, to ensure that EDK2 can make forward progress under a
hypervisor which makes use of PAR_EL1.

This patch ensures that we program TCR_EL1.EPD1 and TCR_EL1.TG1 as above
to avoid these issues. TCR_EL1.TG1 is set to 4K for all targets, as any
CPU capable of running EDK2 must support this granule, and given
TCR_EL1.EPD1, programming the field is not detrimental in the absence of
the erratum.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18903 6f19259b-4bc3-4df7-8a09-765794883524
ArmPkg/Include/Chipset/AArch64Mmu.h
ArmPkg/Library/ArmLib/AArch64/AArch64Mmu.c