Revert "ANDROID: KVM: arm64: Use enum instead of helper for fp state"

This reverts commit 26d24625b3, which
didn't introduce any functional change. This is reverted because
backported commits rely on the helpers that the commit has removed.
Reverting it makes it easier and cleaner to apply the backports.

No functional change intended.

Bug: 411040189
Change-Id: Ie29ece274cfc970cf116f8781b841b9ac2c5aa56
Signed-off-by: Fuad Tabba <tabba@google.com>
This commit is contained in:
Fuad Tabba
2025-05-12 15:57:22 +01:00
committed by Will Deacon
parent b07be5e511
commit d653b32842
3 changed files with 8 additions and 2 deletions

View File

@@ -37,6 +37,12 @@ struct kvm_exception_table_entry {
extern struct kvm_exception_table_entry __start___kvm_ex_table;
extern struct kvm_exception_table_entry __stop___kvm_ex_table;
/* Check whether the FP regs are owned by the guest */
static inline bool guest_owns_fp_regs(struct kvm_vcpu *vcpu)
{
return vcpu->arch.fp_state == FP_STATE_GUEST_OWNED;
}
/* Save the 32-bit only FPSIMD system register state */
static inline void __fpsimd_save_fpexc32(struct kvm_vcpu *vcpu)
{

View File

@@ -45,7 +45,7 @@ static void __activate_traps(struct kvm_vcpu *vcpu)
val = vcpu->arch.cptr_el2;
val |= CPTR_EL2_TTA | CPTR_EL2_TAM;
if (vcpu->arch.fp_state != FP_STATE_GUEST_OWNED) {
if (!guest_owns_fp_regs(vcpu)) {
val |= CPTR_EL2_TFP | CPTR_EL2_TZ;
__activate_traps_fpsimd32(vcpu);
}

View File

@@ -55,7 +55,7 @@ static void __activate_traps(struct kvm_vcpu *vcpu)
val |= CPTR_EL2_TAM;
if (vcpu->arch.fp_state == FP_STATE_GUEST_OWNED) {
if (guest_owns_fp_regs(vcpu)) {
if (vcpu_has_sve(vcpu))
val |= CPACR_EL1_ZEN_EL0EN | CPACR_EL1_ZEN_EL1EN;
} else {