Lines Matching full:vcpu

23 static unsigned long get_pteg_addr(struct kvm_vcpu *vcpu, long pte_index)  in get_pteg_addr()  argument
25 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu); in get_pteg_addr()
36 static int kvmppc_h_pr_enter(struct kvm_vcpu *vcpu) in kvmppc_h_pr_enter() argument
38 long flags = kvmppc_get_gpr(vcpu, 4); in kvmppc_h_pr_enter()
39 long pte_index = kvmppc_get_gpr(vcpu, 5); in kvmppc_h_pr_enter()
47 pteg_addr = get_pteg_addr(vcpu, pte_index); in kvmppc_h_pr_enter()
49 mutex_lock(&vcpu->kvm->arch.hpt_mutex); in kvmppc_h_pr_enter()
70 hpte[0] = cpu_to_be64(kvmppc_get_gpr(vcpu, 6)); in kvmppc_h_pr_enter()
71 hpte[1] = cpu_to_be64(kvmppc_get_gpr(vcpu, 7)); in kvmppc_h_pr_enter()
76 kvmppc_set_gpr(vcpu, 4, pte_index | i); in kvmppc_h_pr_enter()
80 mutex_unlock(&vcpu->kvm->arch.hpt_mutex); in kvmppc_h_pr_enter()
81 kvmppc_set_gpr(vcpu, 3, ret); in kvmppc_h_pr_enter()
86 static int kvmppc_h_pr_remove(struct kvm_vcpu *vcpu) in kvmppc_h_pr_remove() argument
88 unsigned long flags= kvmppc_get_gpr(vcpu, 4); in kvmppc_h_pr_remove()
89 unsigned long pte_index = kvmppc_get_gpr(vcpu, 5); in kvmppc_h_pr_remove()
90 unsigned long avpn = kvmppc_get_gpr(vcpu, 6); in kvmppc_h_pr_remove()
95 pteg = get_pteg_addr(vcpu, pte_index); in kvmppc_h_pr_remove()
96 mutex_lock(&vcpu->kvm->arch.hpt_mutex); in kvmppc_h_pr_remove()
114 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); in kvmppc_h_pr_remove()
117 kvmppc_set_gpr(vcpu, 4, pte[0]); in kvmppc_h_pr_remove()
118 kvmppc_set_gpr(vcpu, 5, pte[1]); in kvmppc_h_pr_remove()
121 mutex_unlock(&vcpu->kvm->arch.hpt_mutex); in kvmppc_h_pr_remove()
122 kvmppc_set_gpr(vcpu, 3, ret); in kvmppc_h_pr_remove()
145 static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu) in kvmppc_h_pr_bulk_remove() argument
151 mutex_lock(&vcpu->kvm->arch.hpt_mutex); in kvmppc_h_pr_bulk_remove()
153 unsigned long tsh = kvmppc_get_gpr(vcpu, paramnr+(2*i)); in kvmppc_h_pr_bulk_remove()
154 unsigned long tsl = kvmppc_get_gpr(vcpu, paramnr+(2*i)+1); in kvmppc_h_pr_bulk_remove()
173 kvmppc_set_gpr(vcpu, paramnr+(2*i), tsh); in kvmppc_h_pr_bulk_remove()
178 pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX); in kvmppc_h_pr_bulk_remove()
202 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); in kvmppc_h_pr_bulk_remove()
206 kvmppc_set_gpr(vcpu, paramnr+(2*i), tsh); in kvmppc_h_pr_bulk_remove()
208 mutex_unlock(&vcpu->kvm->arch.hpt_mutex); in kvmppc_h_pr_bulk_remove()
209 kvmppc_set_gpr(vcpu, 3, ret); in kvmppc_h_pr_bulk_remove()
214 static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu) in kvmppc_h_pr_protect() argument
216 unsigned long flags = kvmppc_get_gpr(vcpu, 4); in kvmppc_h_pr_protect()
217 unsigned long pte_index = kvmppc_get_gpr(vcpu, 5); in kvmppc_h_pr_protect()
218 unsigned long avpn = kvmppc_get_gpr(vcpu, 6); in kvmppc_h_pr_protect()
223 pteg = get_pteg_addr(vcpu, pte_index); in kvmppc_h_pr_protect()
224 mutex_lock(&vcpu->kvm->arch.hpt_mutex); in kvmppc_h_pr_protect()
247 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); in kvmppc_h_pr_protect()
256 mutex_unlock(&vcpu->kvm->arch.hpt_mutex); in kvmppc_h_pr_protect()
257 kvmppc_set_gpr(vcpu, 3, ret); in kvmppc_h_pr_protect()
262 static int kvmppc_h_pr_logical_ci_load(struct kvm_vcpu *vcpu) in kvmppc_h_pr_logical_ci_load() argument
266 rc = kvmppc_h_logical_ci_load(vcpu); in kvmppc_h_pr_logical_ci_load()
269 kvmppc_set_gpr(vcpu, 3, rc); in kvmppc_h_pr_logical_ci_load()
273 static int kvmppc_h_pr_logical_ci_store(struct kvm_vcpu *vcpu) in kvmppc_h_pr_logical_ci_store() argument
277 rc = kvmppc_h_logical_ci_store(vcpu); in kvmppc_h_pr_logical_ci_store()
280 kvmppc_set_gpr(vcpu, 3, rc); in kvmppc_h_pr_logical_ci_store()
284 static int kvmppc_h_pr_set_mode(struct kvm_vcpu *vcpu) in kvmppc_h_pr_set_mode() argument
286 unsigned long mflags = kvmppc_get_gpr(vcpu, 4); in kvmppc_h_pr_set_mode()
287 unsigned long resource = kvmppc_get_gpr(vcpu, 5); in kvmppc_h_pr_set_mode()
292 kvmppc_set_gpr(vcpu, 3, H_SUCCESS); in kvmppc_h_pr_set_mode()
294 kvmppc_set_gpr(vcpu, 3, H_UNSUPPORTED_FLAG_START - 63); in kvmppc_h_pr_set_mode()
301 static int kvmppc_h_pr_put_tce(struct kvm_vcpu *vcpu) in kvmppc_h_pr_put_tce() argument
303 unsigned long liobn = kvmppc_get_gpr(vcpu, 4); in kvmppc_h_pr_put_tce()
304 unsigned long ioba = kvmppc_get_gpr(vcpu, 5); in kvmppc_h_pr_put_tce()
305 unsigned long tce = kvmppc_get_gpr(vcpu, 6); in kvmppc_h_pr_put_tce()
308 rc = kvmppc_h_put_tce(vcpu, liobn, ioba, tce); in kvmppc_h_pr_put_tce()
311 kvmppc_set_gpr(vcpu, 3, rc); in kvmppc_h_pr_put_tce()
315 static int kvmppc_h_pr_put_tce_indirect(struct kvm_vcpu *vcpu) in kvmppc_h_pr_put_tce_indirect() argument
317 unsigned long liobn = kvmppc_get_gpr(vcpu, 4); in kvmppc_h_pr_put_tce_indirect()
318 unsigned long ioba = kvmppc_get_gpr(vcpu, 5); in kvmppc_h_pr_put_tce_indirect()
319 unsigned long tce = kvmppc_get_gpr(vcpu, 6); in kvmppc_h_pr_put_tce_indirect()
320 unsigned long npages = kvmppc_get_gpr(vcpu, 7); in kvmppc_h_pr_put_tce_indirect()
323 rc = kvmppc_h_put_tce_indirect(vcpu, liobn, ioba, in kvmppc_h_pr_put_tce_indirect()
327 kvmppc_set_gpr(vcpu, 3, rc); in kvmppc_h_pr_put_tce_indirect()
331 static int kvmppc_h_pr_stuff_tce(struct kvm_vcpu *vcpu) in kvmppc_h_pr_stuff_tce() argument
333 unsigned long liobn = kvmppc_get_gpr(vcpu, 4); in kvmppc_h_pr_stuff_tce()
334 unsigned long ioba = kvmppc_get_gpr(vcpu, 5); in kvmppc_h_pr_stuff_tce()
335 unsigned long tce_value = kvmppc_get_gpr(vcpu, 6); in kvmppc_h_pr_stuff_tce()
336 unsigned long npages = kvmppc_get_gpr(vcpu, 7); in kvmppc_h_pr_stuff_tce()
339 rc = kvmppc_h_stuff_tce(vcpu, liobn, ioba, tce_value, npages); in kvmppc_h_pr_stuff_tce()
342 kvmppc_set_gpr(vcpu, 3, rc); in kvmppc_h_pr_stuff_tce()
347 static int kvmppc_h_pr_put_tce(struct kvm_vcpu *vcpu) in kvmppc_h_pr_put_tce() argument
352 static int kvmppc_h_pr_put_tce_indirect(struct kvm_vcpu *vcpu) in kvmppc_h_pr_put_tce_indirect() argument
357 static int kvmppc_h_pr_stuff_tce(struct kvm_vcpu *vcpu) in kvmppc_h_pr_stuff_tce() argument
363 static int kvmppc_h_pr_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd) in kvmppc_h_pr_xics_hcall() argument
365 long rc = kvmppc_xics_hcall(vcpu, cmd); in kvmppc_h_pr_xics_hcall()
366 kvmppc_set_gpr(vcpu, 3, rc); in kvmppc_h_pr_xics_hcall()
370 int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd) in kvmppc_h_pr() argument
375 !test_bit(cmd/4, vcpu->kvm->arch.enabled_hcalls)) in kvmppc_h_pr()
380 return kvmppc_h_pr_enter(vcpu); in kvmppc_h_pr()
382 return kvmppc_h_pr_remove(vcpu); in kvmppc_h_pr()
384 return kvmppc_h_pr_protect(vcpu); in kvmppc_h_pr()
386 return kvmppc_h_pr_bulk_remove(vcpu); in kvmppc_h_pr()
388 return kvmppc_h_pr_put_tce(vcpu); in kvmppc_h_pr()
390 return kvmppc_h_pr_put_tce_indirect(vcpu); in kvmppc_h_pr()
392 return kvmppc_h_pr_stuff_tce(vcpu); in kvmppc_h_pr()
394 kvmppc_set_msr_fast(vcpu, kvmppc_get_msr(vcpu) | MSR_EE); in kvmppc_h_pr()
395 kvm_vcpu_halt(vcpu); in kvmppc_h_pr()
396 vcpu->stat.generic.halt_wakeup++; in kvmppc_h_pr()
399 return kvmppc_h_pr_logical_ci_load(vcpu); in kvmppc_h_pr()
401 return kvmppc_h_pr_logical_ci_store(vcpu); in kvmppc_h_pr()
403 return kvmppc_h_pr_set_mode(vcpu); in kvmppc_h_pr()
410 if (kvmppc_xics_enabled(vcpu)) in kvmppc_h_pr()
411 return kvmppc_h_pr_xics_hcall(vcpu, cmd); in kvmppc_h_pr()
414 if (list_empty(&vcpu->kvm->arch.rtas_tokens)) in kvmppc_h_pr()
416 idx = srcu_read_lock(&vcpu->kvm->srcu); in kvmppc_h_pr()
417 rc = kvmppc_rtas_hcall(vcpu); in kvmppc_h_pr()
418 srcu_read_unlock(&vcpu->kvm->srcu, idx); in kvmppc_h_pr()
421 kvmppc_set_gpr(vcpu, 3, 0); in kvmppc_h_pr()