Lines Matching refs:t

25 				     struct kvm_vcpu_timer *t)  in kvm_riscv_delta_cycles2ns()  argument
45 struct kvm_vcpu_timer *t = container_of(h, struct kvm_vcpu_timer, hrt); in kvm_riscv_vcpu_hrtimer_expired() local
46 struct kvm_vcpu *vcpu = container_of(t, struct kvm_vcpu, arch.timer); in kvm_riscv_vcpu_hrtimer_expired()
49 if (kvm_riscv_current_cycles(gt) < t->next_cycles) { in kvm_riscv_vcpu_hrtimer_expired()
50 delta_ns = kvm_riscv_delta_cycles2ns(t->next_cycles, gt, t); in kvm_riscv_vcpu_hrtimer_expired()
51 hrtimer_forward_now(&t->hrt, ktime_set(0, delta_ns)); in kvm_riscv_vcpu_hrtimer_expired()
55 t->next_set = false; in kvm_riscv_vcpu_hrtimer_expired()
61 static int kvm_riscv_vcpu_timer_cancel(struct kvm_vcpu_timer *t) in kvm_riscv_vcpu_timer_cancel() argument
63 if (!t->init_done || !t->next_set) in kvm_riscv_vcpu_timer_cancel()
66 hrtimer_cancel(&t->hrt); in kvm_riscv_vcpu_timer_cancel()
67 t->next_set = false; in kvm_riscv_vcpu_timer_cancel()
85 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_update_hrtimer() local
89 if (!t->init_done) in kvm_riscv_vcpu_update_hrtimer()
94 delta_ns = kvm_riscv_delta_cycles2ns(ncycles, gt, t); in kvm_riscv_vcpu_update_hrtimer()
95 t->next_cycles = ncycles; in kvm_riscv_vcpu_update_hrtimer()
96 hrtimer_start(&t->hrt, ktime_set(0, delta_ns), HRTIMER_MODE_REL); in kvm_riscv_vcpu_update_hrtimer()
97 t->next_set = true; in kvm_riscv_vcpu_update_hrtimer()
104 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_timer_next_event() local
106 return t->timer_next_event(vcpu, ncycles); in kvm_riscv_vcpu_timer_next_event()
112 struct kvm_vcpu_timer *t = container_of(h, struct kvm_vcpu_timer, hrt); in kvm_riscv_vcpu_vstimer_expired() local
113 struct kvm_vcpu *vcpu = container_of(t, struct kvm_vcpu, arch.timer); in kvm_riscv_vcpu_vstimer_expired()
116 if (kvm_riscv_current_cycles(gt) < t->next_cycles) { in kvm_riscv_vcpu_vstimer_expired()
117 delta_ns = kvm_riscv_delta_cycles2ns(t->next_cycles, gt, t); in kvm_riscv_vcpu_vstimer_expired()
118 hrtimer_forward_now(&t->hrt, ktime_set(0, delta_ns)); in kvm_riscv_vcpu_vstimer_expired()
122 t->next_set = false; in kvm_riscv_vcpu_vstimer_expired()
130 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_timer_pending() local
133 if (!kvm_riscv_delta_cycles2ns(t->next_cycles, gt, t) || in kvm_riscv_vcpu_timer_pending()
142 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_timer_blocking() local
146 if (!t->init_done) in kvm_riscv_vcpu_timer_blocking()
149 delta_ns = kvm_riscv_delta_cycles2ns(t->next_cycles, gt, t); in kvm_riscv_vcpu_timer_blocking()
151 hrtimer_start(&t->hrt, ktime_set(0, delta_ns), HRTIMER_MODE_REL); in kvm_riscv_vcpu_timer_blocking()
152 t->next_set = true; in kvm_riscv_vcpu_timer_blocking()
164 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_get_reg_timer() local
185 reg_val = t->next_cycles; in kvm_riscv_vcpu_get_reg_timer()
188 reg_val = (t->next_set) ? KVM_RISCV_TIMER_STATE_ON : in kvm_riscv_vcpu_get_reg_timer()
204 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_set_reg_timer() local
229 t->next_cycles = reg_val; in kvm_riscv_vcpu_set_reg_timer()
235 ret = kvm_riscv_vcpu_timer_cancel(t); in kvm_riscv_vcpu_set_reg_timer()
247 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_timer_init() local
249 if (t->init_done) in kvm_riscv_vcpu_timer_init()
252 hrtimer_init(&t->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in kvm_riscv_vcpu_timer_init()
253 t->init_done = true; in kvm_riscv_vcpu_timer_init()
254 t->next_set = false; in kvm_riscv_vcpu_timer_init()
258 t->sstc_enabled = true; in kvm_riscv_vcpu_timer_init()
259 t->hrt.function = kvm_riscv_vcpu_vstimer_expired; in kvm_riscv_vcpu_timer_init()
260 t->timer_next_event = kvm_riscv_vcpu_update_vstimecmp; in kvm_riscv_vcpu_timer_init()
262 t->sstc_enabled = false; in kvm_riscv_vcpu_timer_init()
263 t->hrt.function = kvm_riscv_vcpu_hrtimer_expired; in kvm_riscv_vcpu_timer_init()
264 t->timer_next_event = kvm_riscv_vcpu_update_hrtimer; in kvm_riscv_vcpu_timer_init()
282 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_timer_reset() local
284 t->next_cycles = -1ULL; in kvm_riscv_vcpu_timer_reset()
302 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_timer_restore() local
306 if (!t->sstc_enabled) in kvm_riscv_vcpu_timer_restore()
310 csr_write(CSR_VSTIMECMP, (u32)t->next_cycles); in kvm_riscv_vcpu_timer_restore()
311 csr_write(CSR_VSTIMECMPH, (u32)(t->next_cycles >> 32)); in kvm_riscv_vcpu_timer_restore()
313 csr_write(CSR_VSTIMECMP, t->next_cycles); in kvm_riscv_vcpu_timer_restore()
317 if (unlikely(!t->init_done)) in kvm_riscv_vcpu_timer_restore()
325 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_timer_sync() local
327 if (!t->sstc_enabled) in kvm_riscv_vcpu_timer_sync()
331 t->next_cycles = csr_read(CSR_VSTIMECMP); in kvm_riscv_vcpu_timer_sync()
332 t->next_cycles |= (u64)csr_read(CSR_VSTIMECMPH) << 32; in kvm_riscv_vcpu_timer_sync()
334 t->next_cycles = csr_read(CSR_VSTIMECMP); in kvm_riscv_vcpu_timer_sync()
340 struct kvm_vcpu_timer *t = &vcpu->arch.timer; in kvm_riscv_vcpu_timer_save() local
342 if (!t->sstc_enabled) in kvm_riscv_vcpu_timer_save()
351 if (unlikely(!t->init_done)) in kvm_riscv_vcpu_timer_save()