File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed
Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -1025,7 +1025,7 @@ int kvm_arm_pvtime_has_attr(struct kvm_vcpu *vcpu,
10251025extern unsigned int __ro_after_init kvm_arm_vmid_bits ;
10261026int __init kvm_arm_vmid_alloc_init (void );
10271027void __init kvm_arm_vmid_alloc_free (void );
1028- void kvm_arm_vmid_update (struct kvm_vmid * kvm_vmid );
1028+ bool kvm_arm_vmid_update (struct kvm_vmid * kvm_vmid );
10291029void kvm_arm_vmid_clear_active (void );
10301030
10311031static inline void kvm_arm_pvtime_vcpu_init (struct kvm_vcpu_arch * vcpu_arch )
Original file line number Diff line number Diff line change @@ -950,7 +950,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
950950 * making a thread's VMID inactive. So we need to call
951951 * kvm_arm_vmid_update() in non-premptible context.
952952 */
953- kvm_arm_vmid_update (& vcpu -> arch .hw_mmu -> vmid );
953+ if (kvm_arm_vmid_update (& vcpu -> arch .hw_mmu -> vmid ) &&
954+ has_vhe ())
955+ __load_stage2 (vcpu -> arch .hw_mmu ,
956+ vcpu -> arch .hw_mmu -> arch );
954957
955958 kvm_pmu_flush_hwstate (vcpu );
956959
Original file line number Diff line number Diff line change @@ -135,10 +135,11 @@ void kvm_arm_vmid_clear_active(void)
135135 atomic64_set (this_cpu_ptr (& active_vmids ), VMID_ACTIVE_INVALID );
136136}
137137
138- void kvm_arm_vmid_update (struct kvm_vmid * kvm_vmid )
138+ bool kvm_arm_vmid_update (struct kvm_vmid * kvm_vmid )
139139{
140140 unsigned long flags ;
141141 u64 vmid , old_active_vmid ;
142+ bool updated = false;
142143
143144 vmid = atomic64_read (& kvm_vmid -> id );
144145
@@ -156,17 +157,21 @@ void kvm_arm_vmid_update(struct kvm_vmid *kvm_vmid)
156157 if (old_active_vmid != 0 && vmid_gen_match (vmid ) &&
157158 0 != atomic64_cmpxchg_relaxed (this_cpu_ptr (& active_vmids ),
158159 old_active_vmid , vmid ))
159- return ;
160+ return false ;
160161
161162 raw_spin_lock_irqsave (& cpu_vmid_lock , flags );
162163
163164 /* Check that our VMID belongs to the current generation. */
164165 vmid = atomic64_read (& kvm_vmid -> id );
165- if (!vmid_gen_match (vmid ))
166+ if (!vmid_gen_match (vmid )) {
166167 vmid = new_vmid (kvm_vmid );
168+ updated = true;
169+ }
167170
168171 atomic64_set (this_cpu_ptr (& active_vmids ), vmid );
169172 raw_spin_unlock_irqrestore (& cpu_vmid_lock , flags );
173+
174+ return updated ;
170175}
171176
172177/*
You can’t perform that action at this time.
0 commit comments