Skip to content

Commit 42ce432

Browse files
mrutland-armMarc Zyngier
authored andcommitted
KVM: arm64: Remove kvm_arch_vcpu_run_map_fp()
Historically KVM hyp code saved the host's FPSIMD state into the hosts's fpsimd_state memory, and so it was necessary to map this into the hyp Stage-1 mappings before running a vCPU. This is no longer necessary as of commits: * fbc7e61 ("KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state") * 8eca7f6 ("KVM: arm64: Remove host FPSIMD saving for non-protected KVM") Since those commits, we eagerly save the host's FPSIMD state before calling into hyp to run a vCPU, and hyp code never reads nor writes the host's fpsimd_state memory. There's no longer any need to map the host's fpsimd_state memory into the hyp Stage-1, and kvm_arch_vcpu_run_map_fp() is unnecessary but benign. Remove kvm_arch_vcpu_run_map_fp(). Currently there is no code to perform a corresponding unmap, and we never mapped the host's SVE or SME state into the hyp Stage-1, so no other code needs to be removed. Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Fuad Tabba <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Mark Brown <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Reviewed-by: Mark Brown <[email protected]> Tested-by: Fuad Tabba <[email protected]> Reviewed-by: Fuad Tabba <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 105485a commit 42ce432

File tree

3 files changed

+0
-31
lines changed

3 files changed

+0
-31
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,6 @@ int kvm_vm_ioctl_get_reg_writable_masks(struct kvm *kvm,
14801480
struct reg_mask_range *range);
14811481

14821482
/* Guest/host FPSIMD coordination helpers */
1483-
int kvm_arch_vcpu_run_map_fp(struct kvm_vcpu *vcpu);
14841483
void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu);
14851484
void kvm_arch_vcpu_ctxflush_fp(struct kvm_vcpu *vcpu);
14861485
void kvm_arch_vcpu_ctxsync_fp(struct kvm_vcpu *vcpu);

arch/arm64/kvm/arm.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,10 +825,6 @@ int kvm_arch_vcpu_run_pid_change(struct kvm_vcpu *vcpu)
825825
if (!kvm_arm_vcpu_is_finalized(vcpu))
826826
return -EPERM;
827827

828-
ret = kvm_arch_vcpu_run_map_fp(vcpu);
829-
if (ret)
830-
return ret;
831-
832828
if (likely(vcpu_has_run_once(vcpu)))
833829
return 0;
834830

arch/arm64/kvm/fpsimd.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,6 @@
1414
#include <asm/kvm_mmu.h>
1515
#include <asm/sysreg.h>
1616

17-
/*
18-
* Called on entry to KVM_RUN unless this vcpu previously ran at least
19-
* once and the most recent prior KVM_RUN for this vcpu was called from
20-
* the same task as current (highly likely).
21-
*
22-
* This is guaranteed to execute before kvm_arch_vcpu_load_fp(vcpu),
23-
* such that on entering hyp the relevant parts of current are already
24-
* mapped.
25-
*/
26-
int kvm_arch_vcpu_run_map_fp(struct kvm_vcpu *vcpu)
27-
{
28-
struct user_fpsimd_state *fpsimd = &current->thread.uw.fpsimd_state;
29-
int ret;
30-
31-
/* pKVM has its own tracking of the host fpsimd state. */
32-
if (is_protected_kvm_enabled())
33-
return 0;
34-
35-
/* Make sure the host task fpsimd state is visible to hyp: */
36-
ret = kvm_share_hyp(fpsimd, fpsimd + 1);
37-
if (ret)
38-
return ret;
39-
40-
return 0;
41-
}
42-
4317
/*
4418
* Prepare vcpu for saving the host's FPSIMD state and loading the guest's.
4519
* The actual loading is done by the FPSIMD access trap taken to hyp.

0 commit comments

Comments
 (0)