Lines Matching +full:t +full:- +full:head
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (c) 2009-2013 Silicon Graphics, Inc. All Rights Reserved.
38 .irq = -1,
92 /* Setup interrupt and return non-zero if early expiration occurred. */
101 uv_write_global_mmr64(pnode, UVH_INT_CMPB, -1L); in uv_setup_intr()
121 * Per-cpu timer tracking routines
134 /* Allocate per-node list of cpu timer expiration times. */
141 return -ENOMEM; in uv_rtc_allocate_timers()
147 struct uv_rtc_timer_head *head = blade_info[bid]; in uv_rtc_allocate_timers() local
149 if (!head) { in uv_rtc_allocate_timers()
150 head = kmalloc_node(struct_size(head, cpu, in uv_rtc_allocate_timers()
153 if (!head) { in uv_rtc_allocate_timers()
155 return -ENOMEM; in uv_rtc_allocate_timers()
157 spin_lock_init(&head->lock); in uv_rtc_allocate_timers()
158 head->ncpus = uv_blade_nr_possible_cpus(bid); in uv_rtc_allocate_timers()
159 head->next_cpu = -1; in uv_rtc_allocate_timers()
160 blade_info[bid] = head; in uv_rtc_allocate_timers()
163 head->cpu[bcpu].lcpu = cpu; in uv_rtc_allocate_timers()
164 head->cpu[bcpu].expires = ULLONG_MAX; in uv_rtc_allocate_timers()
171 static void uv_rtc_find_next_timer(struct uv_rtc_timer_head *head, int pnode) in uv_rtc_find_next_timer() argument
174 int c, bcpu = -1; in uv_rtc_find_next_timer()
176 head->next_cpu = -1; in uv_rtc_find_next_timer()
177 for (c = 0; c < head->ncpus; c++) { in uv_rtc_find_next_timer()
178 u64 exp = head->cpu[c].expires; in uv_rtc_find_next_timer()
185 head->next_cpu = bcpu; in uv_rtc_find_next_timer()
186 c = head->cpu[bcpu].lcpu; in uv_rtc_find_next_timer()
188 /* If we didn't set it up in time, trigger */ in uv_rtc_find_next_timer()
205 struct uv_rtc_timer_head *head = blade_info[bid]; in uv_rtc_set_timer() local
207 u64 *t = &head->cpu[bcpu].expires; in uv_rtc_set_timer() local
211 spin_lock_irqsave(&head->lock, flags); in uv_rtc_set_timer()
213 next_cpu = head->next_cpu; in uv_rtc_set_timer()
214 *t = expires; in uv_rtc_set_timer()
218 expires < head->cpu[next_cpu].expires) { in uv_rtc_set_timer()
219 head->next_cpu = bcpu; in uv_rtc_set_timer()
221 *t = ULLONG_MAX; in uv_rtc_set_timer()
222 uv_rtc_find_next_timer(head, pnode); in uv_rtc_set_timer()
223 spin_unlock_irqrestore(&head->lock, flags); in uv_rtc_set_timer()
224 return -ETIME; in uv_rtc_set_timer()
228 spin_unlock_irqrestore(&head->lock, flags); in uv_rtc_set_timer()
241 struct uv_rtc_timer_head *head = blade_info[bid]; in uv_rtc_unset_timer() local
243 u64 *t = &head->cpu[bcpu].expires; in uv_rtc_unset_timer() local
247 spin_lock_irqsave(&head->lock, flags); in uv_rtc_unset_timer()
249 if ((head->next_cpu == bcpu && uv_read_rtc(NULL) >= *t) || force) in uv_rtc_unset_timer()
253 *t = ULLONG_MAX; in uv_rtc_unset_timer()
255 if (head->next_cpu == bcpu) in uv_rtc_unset_timer()
256 uv_rtc_find_next_timer(head, pnode); in uv_rtc_unset_timer()
259 spin_unlock_irqrestore(&head->lock, flags); in uv_rtc_unset_timer()
294 int ced_cpu = cpumask_first(ced->cpumask); in uv_rtc_next_event()
304 int ced_cpu = cpumask_first(evt->cpumask); in uv_rtc_shutdown()
315 if (!ced || !ced->event_handler) in uv_rtc_interrupt()
321 ced->event_handler(ced); in uv_rtc_interrupt()
337 ced->cpumask = cpumask_of(smp_processor_id()); in uv_rtc_register_clockevents()
346 return -ENODEV; in uv_rtc_setup_clock()