Skip to content

Commit c16c113

Browse files
chazyMarc Zyngier
authored andcommitted
KVM: arm64: Directly call VHE and non-VHE FPSIMD enabled functions
There is no longer a need for an alternative to choose the right function to tell us whether or not FPSIMD was enabled for the VM, because we can simply can the appropriate functions directly from within the _vhe and _nvhe run functions. Reviewed-by: Marc Zyngier <marc.zyngier@arm.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
1 parent d5a21bc commit c16c113

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

‎arch/arm64/kvm/hyp/switch.c‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,11 @@ static bool __hyp_text __fpsimd_enabled_nvhe(void)
3333
return !(read_sysreg(cptr_el2) & CPTR_EL2_TFP);
3434
}
3535

36-
static bool __hyp_text __fpsimd_enabled_vhe(void)
36+
static bool fpsimd_enabled_vhe(void)
3737
{
3838
return !!(read_sysreg(cpacr_el1) & CPACR_EL1_FPEN);
3939
}
4040

41-
static hyp_alternate_select(__fpsimd_is_enabled,
42-
__fpsimd_enabled_nvhe, __fpsimd_enabled_vhe,
43-
ARM64_HAS_VIRT_HOST_EXTN);
44-
45-
bool __hyp_text __fpsimd_enabled(void)
46-
{
47-
return __fpsimd_is_enabled()();
48-
}
49-
5041
/* Save the 32-bit only FPSIMD system register state */
5142
static void __hyp_text __fpsimd_save_fpexc32(struct kvm_vcpu *vcpu)
5243
{
@@ -414,7 +405,7 @@ int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu)
414405
/* And we're baaack! */
415406
} while (fixup_guest_exit(vcpu, &exit_code));
416407

417-
fp_enabled = __fpsimd_enabled();
408+
fp_enabled = fpsimd_enabled_vhe();
418409

419410
sysreg_save_guest_state_vhe(guest_ctxt);
420411
__vgic_save_state(vcpu);
@@ -481,7 +472,7 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu)
481472
}
482473
}
483474

484-
fp_enabled = __fpsimd_enabled();
475+
fp_enabled = __fpsimd_enabled_nvhe();
485476

486477
__sysreg_save_state_nvhe(guest_ctxt);
487478
__sysreg32_save_state(vcpu);

0 commit comments

Comments
 (0)