KVM: arm64: Prevent guests from enabling HA/HD on Ampere1
authorOliver Upton <oliver.upton@linux.dev>
Fri, 9 Jun 2023 22:01:04 +0000 (22:01 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Fri, 16 Jun 2023 00:31:44 +0000 (00:31 +0000)
commit082fdfd13841fa4e38a8b073561d182e195d528c
treeeb41f37941bd994fcc7edd5d6c350ef680601824
parentce4a36225753a1a5f3641bff47ecd32fb394dd22
KVM: arm64: Prevent guests from enabling HA/HD on Ampere1

An erratum in the HAFDBS implementation in AmpereOne was addressed by
clearing the feature in the ID register, with the expectation that
software would not attempt to use the corresponding controls in TCR_EL1.
The architecture, on the other hand, takes a much more pedantic stance
on the subject, requiring the TCR bits behave as RES0.

Take an extremely conservative stance on the issue and leverage the
precise write trap afforded by FGT. Handle guest writes by clearing HA
and HD before writing the intended value to the EL1 register alias.

Link: https://lore.kernel.org/r/20230609220104.1836988-4-oliver.upton@linux.dev
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/kvm/hyp/include/hyp/switch.h