Skip to content

Commit 4d2e469

Browse files
ouptonMarc Zyngier
authored andcommitted
KVM: arm64: pkvm: Drop unnecessary FP/SIMD trap handler
The pVM-specific FP/SIMD trap handler just calls straight into the generic trap handler. Avoid the indirection and just call the hyp handler directly. Note that the BUILD_BUG_ON() pattern is repeated in pvm_init_traps_aa64pfr0(), which is likely a better home for it. No functional change intended. Signed-off-by: Oliver Upton <oupton@google.com> Reviewed-by: Fuad Tabba <tabba@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220509162559.2387784-2-oupton@google.com
1 parent bd61395 commit 4d2e469

1 file changed

Lines changed: 1 addition & 18 deletions

File tree

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

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,23 +175,6 @@ static bool kvm_handle_pvm_sys64(struct kvm_vcpu *vcpu, u64 *exit_code)
175175
kvm_handle_pvm_sysreg(vcpu, exit_code));
176176
}
177177

178-
/*
179-
* Handler for protected floating-point and Advanced SIMD accesses.
180-
*
181-
* Returns true if the hypervisor has handled the exit, and control should go
182-
* back to the guest, or false if it hasn't.
183-
*/
184-
static bool kvm_handle_pvm_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)
185-
{
186-
/* Linux guests assume support for floating-point and Advanced SIMD. */
187-
BUILD_BUG_ON(!FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_FP),
188-
PVM_ID_AA64PFR0_ALLOW));
189-
BUILD_BUG_ON(!FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_ASIMD),
190-
PVM_ID_AA64PFR0_ALLOW));
191-
192-
return kvm_hyp_handle_fpsimd(vcpu, exit_code);
193-
}
194-
195178
static const exit_handler_fn hyp_exit_handlers[] = {
196179
[0 ... ESR_ELx_EC_MAX] = NULL,
197180
[ESR_ELx_EC_CP15_32] = kvm_hyp_handle_cp15_32,
@@ -207,7 +190,7 @@ static const exit_handler_fn pvm_exit_handlers[] = {
207190
[0 ... ESR_ELx_EC_MAX] = NULL,
208191
[ESR_ELx_EC_SYS64] = kvm_handle_pvm_sys64,
209192
[ESR_ELx_EC_SVE] = kvm_handle_pvm_restricted,
210-
[ESR_ELx_EC_FP_ASIMD] = kvm_handle_pvm_fpsimd,
193+
[ESR_ELx_EC_FP_ASIMD] = kvm_hyp_handle_fpsimd,
211194
[ESR_ELx_EC_IABT_LOW] = kvm_hyp_handle_iabt_low,
212195
[ESR_ELx_EC_DABT_LOW] = kvm_hyp_handle_dabt_low,
213196
[ESR_ELx_EC_PAC] = kvm_hyp_handle_ptrauth,

0 commit comments

Comments
 (0)