From 1b160e2a0e902442d856cd6295960f1f0c1f3e19 Mon Sep 17 00:00:00 2001 From: Will McVicker Date: Tue, 16 May 2023 15:21:37 -0700 Subject: [PATCH] ANDROID: Partially Revert "ANDROID: KVM: arm64: Allow tweaking HFGWTR_EL2 from modules" This is a partial revert of commit 444b34b83a07 in order to fix booting this kernel on devices that don't support FEAT_FGT due to direct accesses of HFGWTR_EL2 being UNDEFINED. We are retaining the KMI part of the commit until the next KMI breakage window. Bug: 282917063 Change-Id: I6c156ef40a5584dc41e4d9d09c80736e30348802 Signed-off-by: Will McVicker --- arch/arm64/kvm/hyp/nvhe/hyp-init.S | 3 --- arch/arm64/kvm/hyp/nvhe/modules.c | 9 +++------ 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-init.S b/arch/arm64/kvm/hyp/nvhe/hyp-init.S index e7b375ec6460..a6d67c2bb5ae 100644 --- a/arch/arm64/kvm/hyp/nvhe/hyp-init.S +++ b/arch/arm64/kvm/hyp/nvhe/hyp-init.S @@ -95,9 +95,6 @@ SYM_CODE_START_LOCAL(___kvm_hyp_init) ldr x1, [x0, #NVHE_INIT_HCR_EL2] msr hcr_el2, x1 - ldr x1, [x0, #NVHE_INIT_HFGWTR_EL2] - msr_s SYS_HFGWTR_EL2, x1 - ldr x1, [x0, #NVHE_INIT_VTTBR] msr vttbr_el2, x1 diff --git a/arch/arm64/kvm/hyp/nvhe/modules.c b/arch/arm64/kvm/hyp/nvhe/modules.c index 138e0d68e95a..257a43a0b2f7 100644 --- a/arch/arm64/kvm/hyp/nvhe/modules.c +++ b/arch/arm64/kvm/hyp/nvhe/modules.c @@ -29,12 +29,9 @@ static void __update_hcr_el2(unsigned long set_mask, unsigned long clear_mask) static void __update_hfgwtr_el2(unsigned long set_mask, unsigned long clear_mask) { - struct kvm_nvhe_init_params *params = this_cpu_ptr(&kvm_init_params); - - params->hfgwtr_el2 |= set_mask; - params->hfgwtr_el2 &= ~clear_mask; - __kvm_flush_dcache_to_poc(params, sizeof(*params)); - write_sysreg_s(params->hfgwtr_el2, SYS_HFGWTR_EL2); + /* TODO (b/282917063): need to check whether FEAT_FGT is supported + * before we can access HFGWTR_EL2. */ + return; } static atomic_t early_lm_pages;