Lines Matching full:vcpu
28 static bool kvmppc_check_fp_disabled(struct kvm_vcpu *vcpu) in kvmppc_check_fp_disabled() argument
30 if (!(kvmppc_get_msr(vcpu) & MSR_FP)) { in kvmppc_check_fp_disabled()
31 kvmppc_core_queue_fpunavail(vcpu, kvmppc_get_msr(vcpu) & SRR1_PREFIXED); in kvmppc_check_fp_disabled()
40 static bool kvmppc_check_vsx_disabled(struct kvm_vcpu *vcpu) in kvmppc_check_vsx_disabled() argument
42 if (!(kvmppc_get_msr(vcpu) & MSR_VSX)) { in kvmppc_check_vsx_disabled()
43 kvmppc_core_queue_vsx_unavail(vcpu, kvmppc_get_msr(vcpu) & SRR1_PREFIXED); in kvmppc_check_vsx_disabled()
52 static bool kvmppc_check_altivec_disabled(struct kvm_vcpu *vcpu) in kvmppc_check_altivec_disabled() argument
54 if (!(kvmppc_get_msr(vcpu) & MSR_VEC)) { in kvmppc_check_altivec_disabled()
55 kvmppc_core_queue_vec_unavail(vcpu, kvmppc_get_msr(vcpu) & SRR1_PREFIXED); in kvmppc_check_altivec_disabled()
72 int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu) in kvmppc_emulate_loadstore() argument
79 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS); in kvmppc_emulate_loadstore()
81 emulated = kvmppc_get_last_inst(vcpu, INST_GENERIC, &inst); in kvmppc_emulate_loadstore()
85 vcpu->arch.mmio_vsx_copy_nums = 0; in kvmppc_emulate_loadstore()
86 vcpu->arch.mmio_vsx_offset = 0; in kvmppc_emulate_loadstore()
87 vcpu->arch.mmio_copy_type = KVMPPC_VSX_COPY_NONE; in kvmppc_emulate_loadstore()
88 vcpu->arch.mmio_sp64_extend = 0; in kvmppc_emulate_loadstore()
89 vcpu->arch.mmio_sign_extend = 0; in kvmppc_emulate_loadstore()
90 vcpu->arch.mmio_vmx_copy_nums = 0; in kvmppc_emulate_loadstore()
91 vcpu->arch.mmio_vmx_offset = 0; in kvmppc_emulate_loadstore()
92 vcpu->arch.mmio_host_swabbed = 0; in kvmppc_emulate_loadstore()
95 vcpu->arch.regs.msr = kvmppc_get_msr(vcpu); in kvmppc_emulate_loadstore()
96 if (analyse_instr(&op, &vcpu->arch.regs, inst) == 0) { in kvmppc_emulate_loadstore()
100 vcpu->mmio_is_write = OP_IS_STORE(type); in kvmppc_emulate_loadstore()
107 emulated = kvmppc_handle_loads(vcpu, in kvmppc_emulate_loadstore()
110 emulated = kvmppc_handle_load(vcpu, in kvmppc_emulate_loadstore()
114 kvmppc_set_gpr(vcpu, op.update_reg, vcpu->arch.vaddr_accessed); in kvmppc_emulate_loadstore()
120 if (kvmppc_check_fp_disabled(vcpu)) in kvmppc_emulate_loadstore()
124 vcpu->arch.mmio_sp64_extend = 1; in kvmppc_emulate_loadstore()
127 emulated = kvmppc_handle_loads(vcpu, in kvmppc_emulate_loadstore()
130 emulated = kvmppc_handle_load(vcpu, in kvmppc_emulate_loadstore()
134 kvmppc_set_gpr(vcpu, op.update_reg, vcpu->arch.vaddr_accessed); in kvmppc_emulate_loadstore()
140 if (kvmppc_check_altivec_disabled(vcpu)) in kvmppc_emulate_loadstore()
144 vcpu->arch.vaddr_accessed &= ~((unsigned long)size - 1); in kvmppc_emulate_loadstore()
145 vcpu->arch.paddr_accessed &= ~((unsigned long)size - 1); in kvmppc_emulate_loadstore()
148 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
151 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
154 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
157 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
162 vcpu->arch.mmio_vmx_offset = in kvmppc_emulate_loadstore()
163 (vcpu->arch.vaddr_accessed & 0xf)/size; in kvmppc_emulate_loadstore()
166 vcpu->arch.mmio_vmx_copy_nums = 2; in kvmppc_emulate_loadstore()
167 emulated = kvmppc_handle_vmx_load(vcpu, in kvmppc_emulate_loadstore()
171 vcpu->arch.mmio_vmx_copy_nums = 1; in kvmppc_emulate_loadstore()
172 emulated = kvmppc_handle_vmx_load(vcpu, in kvmppc_emulate_loadstore()
183 if (kvmppc_check_altivec_disabled(vcpu)) in kvmppc_emulate_loadstore()
186 if (kvmppc_check_vsx_disabled(vcpu)) in kvmppc_emulate_loadstore()
191 vcpu->arch.mmio_sp64_extend = 1; in kvmppc_emulate_loadstore()
195 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
198 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
202 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
205 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
212 vcpu->arch.mmio_vsx_copy_nums = 1; in kvmppc_emulate_loadstore()
215 vcpu->arch.mmio_vsx_copy_nums = in kvmppc_emulate_loadstore()
220 emulated = kvmppc_handle_vsx_load(vcpu, in kvmppc_emulate_loadstore()
229 emulated = kvmppc_handle_store(vcpu, kvmppc_get_gpr(vcpu, op.reg), in kvmppc_emulate_loadstore()
233 kvmppc_set_gpr(vcpu, op.update_reg, vcpu->arch.vaddr_accessed); in kvmppc_emulate_loadstore()
239 if (kvmppc_check_fp_disabled(vcpu)) in kvmppc_emulate_loadstore()
244 * from vcpu->arch. in kvmppc_emulate_loadstore()
246 if (vcpu->kvm->arch.kvm_ops->giveup_ext) in kvmppc_emulate_loadstore()
247 vcpu->kvm->arch.kvm_ops->giveup_ext(vcpu, in kvmppc_emulate_loadstore()
251 vcpu->arch.mmio_sp64_extend = 1; in kvmppc_emulate_loadstore()
253 emulated = kvmppc_handle_store(vcpu, in kvmppc_emulate_loadstore()
254 kvmppc_get_fpr(vcpu, op.reg), size, 1); in kvmppc_emulate_loadstore()
257 kvmppc_set_gpr(vcpu, op.update_reg, vcpu->arch.vaddr_accessed); in kvmppc_emulate_loadstore()
263 if (kvmppc_check_altivec_disabled(vcpu)) in kvmppc_emulate_loadstore()
267 vcpu->arch.vaddr_accessed &= ~((unsigned long)size - 1); in kvmppc_emulate_loadstore()
268 vcpu->arch.paddr_accessed &= ~((unsigned long)size - 1); in kvmppc_emulate_loadstore()
270 if (vcpu->kvm->arch.kvm_ops->giveup_ext) in kvmppc_emulate_loadstore()
271 vcpu->kvm->arch.kvm_ops->giveup_ext(vcpu, in kvmppc_emulate_loadstore()
274 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
277 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
280 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
283 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
288 vcpu->arch.mmio_vmx_offset = in kvmppc_emulate_loadstore()
289 (vcpu->arch.vaddr_accessed & 0xf)/size; in kvmppc_emulate_loadstore()
292 vcpu->arch.mmio_vmx_copy_nums = 2; in kvmppc_emulate_loadstore()
293 emulated = kvmppc_handle_vmx_store(vcpu, in kvmppc_emulate_loadstore()
296 vcpu->arch.mmio_vmx_copy_nums = 1; in kvmppc_emulate_loadstore()
297 emulated = kvmppc_handle_vmx_store(vcpu, in kvmppc_emulate_loadstore()
308 if (kvmppc_check_altivec_disabled(vcpu)) in kvmppc_emulate_loadstore()
311 if (kvmppc_check_vsx_disabled(vcpu)) in kvmppc_emulate_loadstore()
315 if (vcpu->kvm->arch.kvm_ops->giveup_ext) in kvmppc_emulate_loadstore()
316 vcpu->kvm->arch.kvm_ops->giveup_ext(vcpu, in kvmppc_emulate_loadstore()
320 vcpu->arch.mmio_sp64_extend = 1; in kvmppc_emulate_loadstore()
323 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
326 vcpu->arch.mmio_copy_type = in kvmppc_emulate_loadstore()
333 vcpu->arch.mmio_vsx_copy_nums = 1; in kvmppc_emulate_loadstore()
336 vcpu->arch.mmio_vsx_copy_nums = in kvmppc_emulate_loadstore()
341 emulated = kvmppc_handle_vsx_store(vcpu, in kvmppc_emulate_loadstore()
360 trace_kvm_ppc_instr(ppc_inst_val(inst), kvmppc_get_pc(vcpu), emulated); in kvmppc_emulate_loadstore()
364 kvmppc_set_pc(vcpu, kvmppc_get_pc(vcpu) + ppc_inst_len(inst)); in kvmppc_emulate_loadstore()