feat(mm): fix FEAT_LPA workaround

In commit da72173c3721 ("feat(mm): handle 52-bit PA (FEAT_LPA/2) as
48-bit.") the PA size is downgraded to 48 bits if a 52-bit PA
configuration is found. However, this isn't enough, for complete
downgrade the tcr_el2.ps field must be updated accordingly. So fix this
by setting tcr_el2.ps to 0x5 when downgrading to 48-bit PA size.

Introduce arch_mm_get_pa_range which returns the pa range index as read
from the ID register and arch_mm_get_pa_bits converting the index to the
implemented physical address size in bits. The 48 bits restriction when
FEAT_LPA is implemented is localized to arch_mm_get_pa_range.

Fix an issue with TCR_EL2 when VHE is implemented, where the physical
address size is forced to 40 bits.

Fixes: da72173c3721 ("feat(mm): handle 52-bit PA (FEAT_LPA/2) as 48-bit.")
Reported-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
Change-Id: Ibd1a5fdf4f0d6d7b0b5e5b4ed588a12a1c97e76e
6 files changed
tree: bb5e1a11033e869d2d2d4fc72f03c08943a1fb3f
  1. .vscode/
  2. build/
  3. docs/
  4. driver/
  5. inc/
  6. kokoro/
  7. project/
  8. src/
  9. test/
  10. third_party/
  11. vmlib/
  12. .clang-format
  13. .clang-tidy
  14. .gitignore
  15. .gitmodules
  16. .gn
  17. AUTHORS
  18. BUILD.gn
  19. CONTRIBUTING.md
  20. dco.txt
  21. LICENSE
  22. Makefile
  23. navbar.md
  24. README.md
README.md

Hafnium

Hafnium is a hypervisor, initially supporting aarch64 (64-bit Armv8 CPUs).

Get in touch and keep up-to-date at hafnium@lists.trustedfirmware.org. See feature requests and bugs on our bug dashboard.

Getting started

To jump in and build Hafnium, follow the getting started instructions.

If you want to contribute to the project, see details of how we accept contributions.

Documentation

More documentation is available on: