ANDROID: arm64: Check FGT cap before touching HFGWTR_EL2

Writing to HFGWTR_EL2 is undefined on CPUs without the capability,
so make sure not to touch the register when that is the case.

Bug: 282917063
Bug: 282993310
Change-Id: I85211105d6b1fbee854b4f13f037b8573c5a211c
Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
Quentin Perret
2023-05-17 14:20:57 +00:00
committed by Will Deacon
parent 71b068b4bb
commit 7590636e68

View File

@@ -95,9 +95,13 @@ SYM_CODE_START_LOCAL(___kvm_hyp_init)
ldr x1, [x0, #NVHE_INIT_HCR_EL2]
msr hcr_el2, x1
mrs x1, ID_AA64MMFR0_EL1
and x1, x1, #(0xf << ID_AA64MMFR0_EL1_FGT_SHIFT)
cbz x1, 1f
ldr x1, [x0, #NVHE_INIT_HFGWTR_EL2]
msr_s SYS_HFGWTR_EL2, x1
1:
ldr x1, [x0, #NVHE_INIT_VTTBR]
msr vttbr_el2, x1