File tree Expand file tree Collapse file tree 6 files changed +11
-19
lines changed Expand file tree Collapse file tree 6 files changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -284,9 +284,6 @@ struct kvm_vcpu_arch {
284
284
struct kvm_guest_debug_arch vcpu_debug_state ;
285
285
struct kvm_guest_debug_arch external_debug_state ;
286
286
287
- /* Pointer to host CPU context */
288
- struct kvm_cpu_context * host_cpu_context ;
289
-
290
287
struct thread_info * host_thread_info ; /* hyp VA */
291
288
struct user_fpsimd_state * host_fpsimd_state ; /* hyp VA */
292
289
Original file line number Diff line number Diff line change @@ -340,10 +340,8 @@ void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu)
340
340
void kvm_arch_vcpu_load (struct kvm_vcpu * vcpu , int cpu )
341
341
{
342
342
int * last_ran ;
343
- kvm_host_data_t * cpu_data ;
344
343
345
344
last_ran = this_cpu_ptr (vcpu -> kvm -> arch .last_vcpu_ran );
346
- cpu_data = this_cpu_ptr (& kvm_host_data );
347
345
348
346
/*
349
347
* We might get preempted before the vCPU actually runs, but
@@ -355,7 +353,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
355
353
}
356
354
357
355
vcpu -> cpu = cpu ;
358
- vcpu -> arch .host_cpu_context = & cpu_data -> host_ctxt ;
359
356
360
357
kvm_vgic_load (vcpu );
361
358
kvm_timer_vcpu_load (vcpu );
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ void __hyp_text __debug_switch_to_guest(struct kvm_vcpu *vcpu)
185
185
if (!(vcpu -> arch .flags & KVM_ARM64_DEBUG_DIRTY ))
186
186
return ;
187
187
188
- host_ctxt = kern_hyp_va ( vcpu -> arch . host_cpu_context ) ;
188
+ host_ctxt = & __hyp_this_cpu_ptr ( kvm_host_data ) -> host_ctxt ;
189
189
guest_ctxt = & vcpu -> arch .ctxt ;
190
190
host_dbg = & vcpu -> arch .host_debug_state .regs ;
191
191
guest_dbg = kern_hyp_va (vcpu -> arch .debug_ptr );
@@ -207,7 +207,7 @@ void __hyp_text __debug_switch_to_host(struct kvm_vcpu *vcpu)
207
207
if (!(vcpu -> arch .flags & KVM_ARM64_DEBUG_DIRTY ))
208
208
return ;
209
209
210
- host_ctxt = kern_hyp_va ( vcpu -> arch . host_cpu_context ) ;
210
+ host_ctxt = & __hyp_this_cpu_ptr ( kvm_host_data ) -> host_ctxt ;
211
211
guest_ctxt = & vcpu -> arch .ctxt ;
212
212
host_dbg = & vcpu -> arch .host_debug_state .regs ;
213
213
guest_dbg = kern_hyp_va (vcpu -> arch .debug_ptr );
Original file line number Diff line number Diff line change @@ -532,7 +532,7 @@ static bool __hyp_text __hyp_handle_ptrauth(struct kvm_vcpu *vcpu)
532
532
!esr_is_ptrauth_trap (kvm_vcpu_get_hsr (vcpu )))
533
533
return false;
534
534
535
- ctxt = kern_hyp_va ( vcpu -> arch . host_cpu_context ) ;
535
+ ctxt = & __hyp_this_cpu_ptr ( kvm_host_data ) -> host_ctxt ;
536
536
__ptrauth_save_key (ctxt -> sys_regs , APIA );
537
537
__ptrauth_save_key (ctxt -> sys_regs , APIB );
538
538
__ptrauth_save_key (ctxt -> sys_regs , APDA );
@@ -703,7 +703,7 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu)
703
703
struct kvm_cpu_context * guest_ctxt ;
704
704
u64 exit_code ;
705
705
706
- host_ctxt = vcpu -> arch . host_cpu_context ;
706
+ host_ctxt = & __hyp_this_cpu_ptr ( kvm_host_data ) -> host_ctxt ;
707
707
host_ctxt -> __hyp_running_vcpu = vcpu ;
708
708
guest_ctxt = & vcpu -> arch .ctxt ;
709
709
@@ -808,7 +808,7 @@ int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu)
808
808
809
809
vcpu = kern_hyp_va (vcpu );
810
810
811
- host_ctxt = kern_hyp_va ( vcpu -> arch . host_cpu_context ) ;
811
+ host_ctxt = & __hyp_this_cpu_ptr ( kvm_host_data ) -> host_ctxt ;
812
812
host_ctxt -> __hyp_running_vcpu = vcpu ;
813
813
guest_ctxt = & vcpu -> arch .ctxt ;
814
814
Original file line number Diff line number Diff line change @@ -265,12 +265,13 @@ void __hyp_text __sysreg32_restore_state(struct kvm_vcpu *vcpu)
265
265
*/
266
266
void kvm_vcpu_load_sysregs (struct kvm_vcpu * vcpu )
267
267
{
268
- struct kvm_cpu_context * host_ctxt = vcpu -> arch .host_cpu_context ;
269
268
struct kvm_cpu_context * guest_ctxt = & vcpu -> arch .ctxt ;
269
+ struct kvm_cpu_context * host_ctxt ;
270
270
271
271
if (!has_vhe ())
272
272
return ;
273
273
274
+ host_ctxt = & __hyp_this_cpu_ptr (kvm_host_data )-> host_ctxt ;
274
275
__sysreg_save_user_state (host_ctxt );
275
276
276
277
/*
@@ -301,12 +302,13 @@ void kvm_vcpu_load_sysregs(struct kvm_vcpu *vcpu)
301
302
*/
302
303
void kvm_vcpu_put_sysregs (struct kvm_vcpu * vcpu )
303
304
{
304
- struct kvm_cpu_context * host_ctxt = vcpu -> arch .host_cpu_context ;
305
305
struct kvm_cpu_context * guest_ctxt = & vcpu -> arch .ctxt ;
306
+ struct kvm_cpu_context * host_ctxt ;
306
307
307
308
if (!has_vhe ())
308
309
return ;
309
310
311
+ host_ctxt = & __hyp_this_cpu_ptr (kvm_host_data )-> host_ctxt ;
310
312
deactivate_traps_vhe_put ();
311
313
312
314
__sysreg_save_el1_state (guest_ctxt );
Original file line number Diff line number Diff line change @@ -163,15 +163,13 @@ static void kvm_vcpu_pmu_disable_el0(unsigned long events)
163
163
*/
164
164
void kvm_vcpu_pmu_restore_guest (struct kvm_vcpu * vcpu )
165
165
{
166
- struct kvm_cpu_context * host_ctxt ;
167
166
struct kvm_host_data * host ;
168
167
u32 events_guest , events_host ;
169
168
170
169
if (!has_vhe ())
171
170
return ;
172
171
173
- host_ctxt = vcpu -> arch .host_cpu_context ;
174
- host = container_of (host_ctxt , struct kvm_host_data , host_ctxt );
172
+ host = this_cpu_ptr (& kvm_host_data );
175
173
events_guest = host -> pmu_events .events_guest ;
176
174
events_host = host -> pmu_events .events_host ;
177
175
@@ -184,15 +182,13 @@ void kvm_vcpu_pmu_restore_guest(struct kvm_vcpu *vcpu)
184
182
*/
185
183
void kvm_vcpu_pmu_restore_host (struct kvm_vcpu * vcpu )
186
184
{
187
- struct kvm_cpu_context * host_ctxt ;
188
185
struct kvm_host_data * host ;
189
186
u32 events_guest , events_host ;
190
187
191
188
if (!has_vhe ())
192
189
return ;
193
190
194
- host_ctxt = vcpu -> arch .host_cpu_context ;
195
- host = container_of (host_ctxt , struct kvm_host_data , host_ctxt );
191
+ host = this_cpu_ptr (& kvm_host_data );
196
192
events_guest = host -> pmu_events .events_guest ;
197
193
events_host = host -> pmu_events .events_host ;
198
194
You can’t perform that action at this time.
0 commit comments