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,
1025
1025
extern unsigned int __ro_after_init kvm_arm_vmid_bits ;
1026
1026
int __init kvm_arm_vmid_alloc_init (void );
1027
1027
void __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 );
1029
1029
void kvm_arm_vmid_clear_active (void );
1030
1030
1031
1031
static 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)
950
950
* making a thread's VMID inactive. So we need to call
951
951
* kvm_arm_vmid_update() in non-premptible context.
952
952
*/
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 );
954
957
955
958
kvm_pmu_flush_hwstate (vcpu );
956
959
Original file line number Diff line number Diff line change @@ -135,10 +135,11 @@ void kvm_arm_vmid_clear_active(void)
135
135
atomic64_set (this_cpu_ptr (& active_vmids ), VMID_ACTIVE_INVALID );
136
136
}
137
137
138
- void kvm_arm_vmid_update (struct kvm_vmid * kvm_vmid )
138
+ bool kvm_arm_vmid_update (struct kvm_vmid * kvm_vmid )
139
139
{
140
140
unsigned long flags ;
141
141
u64 vmid , old_active_vmid ;
142
+ bool updated = false;
142
143
143
144
vmid = atomic64_read (& kvm_vmid -> id );
144
145
@@ -156,17 +157,21 @@ void kvm_arm_vmid_update(struct kvm_vmid *kvm_vmid)
156
157
if (old_active_vmid != 0 && vmid_gen_match (vmid ) &&
157
158
0 != atomic64_cmpxchg_relaxed (this_cpu_ptr (& active_vmids ),
158
159
old_active_vmid , vmid ))
159
- return ;
160
+ return false ;
160
161
161
162
raw_spin_lock_irqsave (& cpu_vmid_lock , flags );
162
163
163
164
/* Check that our VMID belongs to the current generation. */
164
165
vmid = atomic64_read (& kvm_vmid -> id );
165
- if (!vmid_gen_match (vmid ))
166
+ if (!vmid_gen_match (vmid )) {
166
167
vmid = new_vmid (kvm_vmid );
168
+ updated = true;
169
+ }
167
170
168
171
atomic64_set (this_cpu_ptr (& active_vmids ), vmid );
169
172
raw_spin_unlock_irqrestore (& cpu_vmid_lock , flags );
173
+
174
+ return updated ;
170
175
}
171
176
172
177
/*
You can’t perform that action at this time.
0 commit comments