Lines Matching full:vcpu

42 #define IS_TE_ENABLED(vcpu)	((vcpu->arch.sie_block->ecb & ECB_TE))  argument
44 #define IS_ITDB_VALID(vcpu) \ argument
45 ((*(char *)phys_to_virt((vcpu)->arch.sie_block->itdba) == TDB_FORMAT1))
79 static inline void kvm_s390_set_cpuflags(struct kvm_vcpu *vcpu, u32 flags) in kvm_s390_set_cpuflags() argument
81 atomic_or(flags, &vcpu->arch.sie_block->cpuflags); in kvm_s390_set_cpuflags()
84 static inline void kvm_s390_clear_cpuflags(struct kvm_vcpu *vcpu, u32 flags) in kvm_s390_clear_cpuflags() argument
86 atomic_andnot(flags, &vcpu->arch.sie_block->cpuflags); in kvm_s390_clear_cpuflags()
89 static inline bool kvm_s390_test_cpuflags(struct kvm_vcpu *vcpu, u32 flags) in kvm_s390_test_cpuflags() argument
91 return (atomic_read(&vcpu->arch.sie_block->cpuflags) & flags) == flags; in kvm_s390_test_cpuflags()
94 static inline int is_vcpu_stopped(struct kvm_vcpu *vcpu) in is_vcpu_stopped() argument
96 return kvm_s390_test_cpuflags(vcpu, CPUSTAT_STOPPED); in is_vcpu_stopped()
99 static inline int is_vcpu_idle(struct kvm_vcpu *vcpu) in is_vcpu_idle() argument
101 return test_bit(vcpu->vcpu_idx, vcpu->kvm->arch.idle_mask); in is_vcpu_idle()
116 static inline u32 kvm_s390_get_prefix(struct kvm_vcpu *vcpu) in kvm_s390_get_prefix() argument
118 return vcpu->arch.sie_block->prefix << GUEST_PREFIX_SHIFT; in kvm_s390_get_prefix()
121 static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix) in kvm_s390_set_prefix() argument
123 VCPU_EVENT(vcpu, 3, "set prefix of cpu %03u to 0x%x", vcpu->vcpu_id, in kvm_s390_set_prefix()
125 vcpu->arch.sie_block->prefix = prefix >> GUEST_PREFIX_SHIFT; in kvm_s390_set_prefix()
126 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); in kvm_s390_set_prefix()
127 kvm_make_request(KVM_REQ_REFRESH_GUEST_PREFIX, vcpu); in kvm_s390_set_prefix()
130 static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu, u8 *ar) in kvm_s390_get_base_disp_s() argument
132 u32 base2 = vcpu->arch.sie_block->ipb >> 28; in kvm_s390_get_base_disp_s()
133 u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16); in kvm_s390_get_base_disp_s()
138 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; in kvm_s390_get_base_disp_s()
141 static inline u64 kvm_s390_get_base_disp_siy(struct kvm_vcpu *vcpu, u8 *ar) in kvm_s390_get_base_disp_siy() argument
143 u32 base1 = vcpu->arch.sie_block->ipb >> 28; in kvm_s390_get_base_disp_siy()
147 disp1 = sign_extend64(((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) + in kvm_s390_get_base_disp_siy()
148 ((vcpu->arch.sie_block->ipb & 0xff00) << 4), 19); in kvm_s390_get_base_disp_siy()
153 return (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + disp1; in kvm_s390_get_base_disp_siy()
156 static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu, in kvm_s390_get_base_disp_sse() argument
160 u32 base1 = (vcpu->arch.sie_block->ipb & 0xf0000000) >> 28; in kvm_s390_get_base_disp_sse()
161 u32 disp1 = (vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16; in kvm_s390_get_base_disp_sse()
162 u32 base2 = (vcpu->arch.sie_block->ipb & 0xf000) >> 12; in kvm_s390_get_base_disp_sse()
163 u32 disp2 = vcpu->arch.sie_block->ipb & 0x0fff; in kvm_s390_get_base_disp_sse()
165 *address1 = (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + disp1; in kvm_s390_get_base_disp_sse()
166 *address2 = (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; in kvm_s390_get_base_disp_sse()
174 static inline void kvm_s390_get_regs_rre(struct kvm_vcpu *vcpu, int *r1, int *r2) in kvm_s390_get_regs_rre() argument
177 *r1 = (vcpu->arch.sie_block->ipb & 0x00f00000) >> 20; in kvm_s390_get_regs_rre()
179 *r2 = (vcpu->arch.sie_block->ipb & 0x000f0000) >> 16; in kvm_s390_get_regs_rre()
182 static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu, u8 *ar) in kvm_s390_get_base_disp_rsy() argument
184 u32 base2 = vcpu->arch.sie_block->ipb >> 28; in kvm_s390_get_base_disp_rsy()
185 u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) + in kvm_s390_get_base_disp_rsy()
186 ((vcpu->arch.sie_block->ipb & 0xff00) << 4); in kvm_s390_get_base_disp_rsy()
194 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + (long)(int)disp2; in kvm_s390_get_base_disp_rsy()
197 static inline u64 kvm_s390_get_base_disp_rs(struct kvm_vcpu *vcpu, u8 *ar) in kvm_s390_get_base_disp_rs() argument
199 u32 base2 = vcpu->arch.sie_block->ipb >> 28; in kvm_s390_get_base_disp_rs()
200 u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16); in kvm_s390_get_base_disp_rs()
205 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; in kvm_s390_get_base_disp_rs()
209 static inline void kvm_s390_set_psw_cc(struct kvm_vcpu *vcpu, unsigned long cc) in kvm_s390_set_psw_cc() argument
211 vcpu->arch.sie_block->gpsw.mask &= ~(3UL << 44); in kvm_s390_set_psw_cc()
212 vcpu->arch.sie_block->gpsw.mask |= cc << 44; in kvm_s390_set_psw_cc()
283 int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc);
284 int kvm_s390_pv_create_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc);
294 int kvm_s390_pv_set_cpu_state(struct kvm_vcpu *vcpu, u8 state);
295 int kvm_s390_pv_dump_cpu(struct kvm_vcpu *vcpu, void *buff, u16 *rc, u16 *rrc);
306 static inline u64 kvm_s390_pv_cpu_get_handle(struct kvm_vcpu *vcpu) in kvm_s390_pv_cpu_get_handle() argument
308 return vcpu->arch.pv.handle; in kvm_s390_pv_cpu_get_handle()
312 int kvm_s390_handle_wait(struct kvm_vcpu *vcpu);
313 void kvm_s390_vcpu_wakeup(struct kvm_vcpu *vcpu);
315 int __must_check kvm_s390_deliver_pending_interrupts(struct kvm_vcpu *vcpu);
316 void kvm_s390_clear_local_irqs(struct kvm_vcpu *vcpu);
320 int __must_check kvm_s390_inject_vcpu(struct kvm_vcpu *vcpu,
322 static inline int kvm_s390_inject_prog_irq(struct kvm_vcpu *vcpu, in kvm_s390_inject_prog_irq() argument
330 return kvm_s390_inject_vcpu(vcpu, &irq); in kvm_s390_inject_prog_irq()
332 static inline int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code) in kvm_s390_inject_program_int() argument
339 return kvm_s390_inject_vcpu(vcpu, &irq); in kvm_s390_inject_program_int()
348 u8 kvm_s390_get_ilen(struct kvm_vcpu *vcpu);
349 int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu);
350 static inline void kvm_s390_rewind_psw(struct kvm_vcpu *vcpu, int ilen) in kvm_s390_rewind_psw() argument
352 struct kvm_s390_sie_block *sie_block = vcpu->arch.sie_block; in kvm_s390_rewind_psw()
356 static inline void kvm_s390_forward_psw(struct kvm_vcpu *vcpu, int ilen) in kvm_s390_forward_psw() argument
358 kvm_s390_rewind_psw(vcpu, -ilen); in kvm_s390_forward_psw()
360 static inline void kvm_s390_retry_instr(struct kvm_vcpu *vcpu) in kvm_s390_retry_instr() argument
363 vcpu->arch.sie_block->icptstatus &= ~0x02; in kvm_s390_retry_instr()
364 kvm_s390_rewind_psw(vcpu, kvm_s390_get_ilen(vcpu)); in kvm_s390_retry_instr()
367 int handle_sthyi(struct kvm_vcpu *vcpu);
371 int kvm_s390_handle_aa(struct kvm_vcpu *vcpu);
372 int kvm_s390_handle_b2(struct kvm_vcpu *vcpu);
373 int kvm_s390_handle_e3(struct kvm_vcpu *vcpu);
374 int kvm_s390_handle_e5(struct kvm_vcpu *vcpu);
375 int kvm_s390_handle_01(struct kvm_vcpu *vcpu);
376 int kvm_s390_handle_b9(struct kvm_vcpu *vcpu);
377 int kvm_s390_handle_lpsw(struct kvm_vcpu *vcpu);
378 int kvm_s390_handle_stctl(struct kvm_vcpu *vcpu);
379 int kvm_s390_handle_lctl(struct kvm_vcpu *vcpu);
380 int kvm_s390_handle_eb(struct kvm_vcpu *vcpu);
381 int kvm_s390_skey_check_enable(struct kvm_vcpu *vcpu);
384 int kvm_s390_handle_vsie(struct kvm_vcpu *vcpu);
385 void kvm_s390_vsie_kick(struct kvm_vcpu *vcpu);
392 int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu);
393 int kvm_s390_handle_sigp_pei(struct kvm_vcpu *vcpu);
397 int kvm_s390_store_status_unloaded(struct kvm_vcpu *vcpu, unsigned long addr);
398 int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr);
399 int kvm_s390_vcpu_start(struct kvm_vcpu *vcpu);
400 int kvm_s390_vcpu_stop(struct kvm_vcpu *vcpu);
401 void kvm_s390_vcpu_block(struct kvm_vcpu *vcpu);
402 void kvm_s390_vcpu_unblock(struct kvm_vcpu *vcpu);
403 bool kvm_s390_vcpu_sie_inhibited(struct kvm_vcpu *vcpu);
404 void exit_sie(struct kvm_vcpu *vcpu);
405 void kvm_s390_sync_request(int req, struct kvm_vcpu *vcpu);
406 int kvm_s390_vcpu_setup_cmma(struct kvm_vcpu *vcpu);
407 void kvm_s390_vcpu_unsetup_cmma(struct kvm_vcpu *vcpu);
408 void kvm_s390_set_cpu_timer(struct kvm_vcpu *vcpu, __u64 cputm);
409 __u64 kvm_s390_get_cpu_timer(struct kvm_vcpu *vcpu);
413 int kvm_s390_handle_diag(struct kvm_vcpu *vcpu);
418 struct kvm_vcpu *vcpu; in kvm_s390_vcpu_block_all() local
421 kvm_for_each_vcpu(i, vcpu, kvm) in kvm_s390_vcpu_block_all()
422 kvm_s390_vcpu_block(vcpu); in kvm_s390_vcpu_block_all()
428 struct kvm_vcpu *vcpu; in kvm_s390_vcpu_unblock_all() local
430 kvm_for_each_vcpu(i, vcpu, kvm) in kvm_s390_vcpu_unblock_all()
431 kvm_s390_vcpu_unblock(vcpu); in kvm_s390_vcpu_unblock_all()
446 * @vcpu: virtual cpu
450 * failed, to conditionally inject a program check to a vcpu. The typical
453 * rc = write_guest(vcpu, addr, data, len);
455 * return kvm_s390_inject_prog_cond(vcpu, rc);
462 * has been stored in vcpu->arch.pgm and can be injected with
468 * (program check injected to @vcpu)
470 static inline int kvm_s390_inject_prog_cond(struct kvm_vcpu *vcpu, int rc) in kvm_s390_inject_prog_cond() argument
474 return kvm_s390_inject_prog_irq(vcpu, &vcpu->arch.pgm); in kvm_s390_inject_prog_cond()
481 int kvm_s390_vcpu_has_irq(struct kvm_vcpu *vcpu, int exclude_stop);
482 int psw_extint_disabled(struct kvm_vcpu *vcpu);
484 int kvm_s390_ext_call_pending(struct kvm_vcpu *vcpu);
486 int kvm_s390_is_stop_irq_pending(struct kvm_vcpu *vcpu);
487 int kvm_s390_is_restart_irq_pending(struct kvm_vcpu *vcpu);
488 void kvm_s390_clear_stop_irq(struct kvm_vcpu *vcpu);
489 int kvm_s390_set_irq_state(struct kvm_vcpu *vcpu,
491 int kvm_s390_get_irq_state(struct kvm_vcpu *vcpu,
502 void kvm_s390_backup_guest_per_regs(struct kvm_vcpu *vcpu);
503 void kvm_s390_restore_guest_per_regs(struct kvm_vcpu *vcpu);
504 void kvm_s390_patch_guest_per_regs(struct kvm_vcpu *vcpu);
505 int kvm_s390_import_bp_data(struct kvm_vcpu *vcpu,
507 void kvm_s390_clear_bp_data(struct kvm_vcpu *vcpu);
508 void kvm_s390_prepare_debug_exit(struct kvm_vcpu *vcpu);
509 int kvm_s390_handle_per_ifetch_icpt(struct kvm_vcpu *vcpu);
510 int kvm_s390_handle_per_event(struct kvm_vcpu *vcpu);
528 void kvm_s390_reinject_machine_check(struct kvm_vcpu *vcpu,
541 * Reset the crypto attributes for each vcpu. This can be done while the vcpus
542 * are running as each vcpu will be removed from SIE before resetting the crypt
554 * Set the associated PCI attributes for each vcpu to allow for zPCI Load/Store