Lines Matching refs:timer
40 struct stimer timer[HV_SYNIC_STIMER_COUNT]; member
62 static void stimer_init(struct stimer *timer, int index) in stimer_init() argument
64 memset(timer, 0, sizeof(*timer)); in stimer_init()
65 timer->index = index; in stimer_init()
76 for (i = 0; i < ARRAY_SIZE(svcpu->timer); i++) { in synic_enable()
77 stimer_init(&svcpu->timer[i], i); in synic_enable()
84 static void stimer_shutdown(struct stimer *timer) in stimer_shutdown() argument
86 wrmsr(HV_X64_MSR_STIMER0_CONFIG + 2*timer->index, 0); in stimer_shutdown()
89 static void process_stimer_expired(struct stimer *timer) in process_stimer_expired() argument
91 atomic_inc(&timer->fire_count); in process_stimer_expired()
99 struct stimer *timer; in process_stimer_msg() local
120 if (payload->timer_index >= ARRAY_SIZE(svcpu->timer)) { in process_stimer_msg()
125 timer = &svcpu->timer[payload->timer_index]; in process_stimer_msg()
127 if (timer->direct) { in process_stimer_msg()
133 process_stimer_expired(timer); in process_stimer_msg()
175 struct stimer *timer = &svcpu->timer[timer_index]; in __stimer_isr_direct() local
177 process_stimer_expired(timer); in __stimer_isr_direct()
198 static void stimer_start(struct stimer *timer, in stimer_start() argument
205 atomic_set(&timer->fire_count, 0); in stimer_start()
210 if (!timer->direct) { in stimer_start()
211 config.sintx = timer->sint; in stimer_start()
214 config.apic_vector = timer->apic_vec; in stimer_start()
224 wrmsr(HV_X64_MSR_STIMER0_COUNT + timer->index*2, count); in stimer_start()
225 wrmsr(HV_X64_MSR_STIMER0_CONFIG + timer->index*2, config.as_uint64); in stimer_start()
227 wrmsr(HV_X64_MSR_STIMER0_CONFIG + timer->index*2, config.as_uint64); in stimer_start()
228 wrmsr(HV_X64_MSR_STIMER0_COUNT + timer->index*2, count); in stimer_start()
237 for (i = 0; i < ARRAY_SIZE(svcpu->timer); i++) { in stimers_shutdown()
238 stimer_shutdown(&svcpu->timer[i]); in stimers_shutdown()
266 timer1 = &svcpu->timer[0]; in stimer_test_prepare()
267 timer2 = &svcpu->timer[1]; in stimer_test_prepare()
281 timer1 = &svcpu->timer[0]; in stimer_test_prepare_direct()
282 timer2 = &svcpu->timer[1]; in stimer_test_prepare_direct()
310 static void stimer_test_one_shot(int vcpu, struct stimer *timer) in stimer_test_one_shot() argument
313 stimer_start(timer, false, false, ONE_MS_IN_100NS); in stimer_test_one_shot()
314 while (atomic_read(&timer->fire_count) < 1) { in stimer_test_one_shot()
318 stimer_shutdown(timer); in stimer_test_one_shot()
321 static void stimer_test_auto_enable_one_shot(int vcpu, struct stimer *timer) in stimer_test_auto_enable_one_shot() argument
324 stimer_start(timer, true, false, ONE_MS_IN_100NS); in stimer_test_auto_enable_one_shot()
325 while (atomic_read(&timer->fire_count) < 1) { in stimer_test_auto_enable_one_shot()
329 stimer_shutdown(timer); in stimer_test_auto_enable_one_shot()
332 static void stimer_test_auto_enable_periodic(int vcpu, struct stimer *timer) in stimer_test_auto_enable_periodic() argument
335 stimer_start(timer, true, true, ONE_MS_IN_100NS); in stimer_test_auto_enable_periodic()
336 while (atomic_read(&timer->fire_count) < 1000) { in stimer_test_auto_enable_periodic()
340 stimer_shutdown(timer); in stimer_test_auto_enable_periodic()
343 static void stimer_test_one_shot_busy(int vcpu, struct stimer *timer) in stimer_test_one_shot_busy() argument
349 if (timer->direct) in stimer_test_one_shot_busy()
353 msg = &msg_page->sint_message[timer->sint]; in stimer_test_one_shot_busy()
358 stimer_start(timer, false, false, ONE_MS_IN_100NS); in stimer_test_one_shot_busy()
364 report(!atomic_read(&timer->fire_count), in stimer_test_one_shot_busy()
371 while (atomic_read(&timer->fire_count) < 1) { in stimer_test_one_shot_busy()
376 stimer_shutdown(timer); in stimer_test_one_shot_busy()
387 timer1 = &svcpu->timer[0]; in stimer_test()
388 timer2 = &svcpu->timer[1]; in stimer_test()