ANDROID: KVM: arm64: Handle AIDR_EL1 and REVIDR_EL1 in host for protected VMs
A guest kernel running as a protected VM will fail to boot because it
attempts to access the AIDR_EL1 register. Since commit 17efc1acee62
("arm64: Expose AIDR_EL1 via sysfs"), upstream kernels read this
register during early boot.
Similar to MIDR_EL1, which is handled by the host for protected VMs, let
the host handle AIDR_EL1 as well as REVIDR_EL1. However, unlike
MIDR_EL1, AIDR_EL1 and REVIDR_EL1 are trapped by HCR_EL2.TID1.
Therefore, we need to explicitly mark them as handled by the host in hyp
for protected VMs, since pKVM always sets TID1, because it still need to
trap access to SMIDR_EL1.
Bug: 435160610
Bug: 357781595
Signed-off-by: Fuad Tabba <tabba@google.com>
Change-Id: If162571e53ea4f0d68376e887436e2acbe7c3d25
diff --git a/arch/arm64/kvm/hyp/nvhe/sys_regs.c b/arch/arm64/kvm/hyp/nvhe/sys_regs.c
index 363d3f3..d7b3104 100644
--- a/arch/arm64/kvm/hyp/nvhe/sys_regs.c
+++ b/arch/arm64/kvm/hyp/nvhe/sys_regs.c
@@ -435,7 +435,7 @@ static const struct sys_reg_desc pvm_sys_reg_descs[] = {
RAZ_WI(SYS_OSDLR_EL1),
/* Group 1 ID registers */
- RAZ_WI(SYS_REVIDR_EL1),
+ HOST_HANDLED(SYS_REVIDR_EL1),
/* AArch64 mappings of the AArch32 ID registers */
/* CRm=1 */
@@ -523,6 +523,7 @@ static const struct sys_reg_desc pvm_sys_reg_descs[] = {
HOST_HANDLED(SYS_CCSIDR_EL1),
HOST_HANDLED(SYS_CLIDR_EL1),
+ HOST_HANDLED(SYS_AIDR_EL1),
HOST_HANDLED(SYS_CSSELR_EL1),
HOST_HANDLED(SYS_CTR_EL0),