Madhukar Pappireddy | eed861e | 2024-09-25 13:50:54 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2024 The Hafnium Authors. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style |
| 5 | * license that can be found in the LICENSE file or at |
| 6 | * https://opensource.org/licenses/BSD-3-Clause. |
| 7 | */ |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "hf/vcpu.h" |
| 12 | |
| 13 | /** |
| 14 | * Partition manager maintains a list of entries, associated with vCPUs with |
| 15 | * pending timer deadline, for each CPU. Each list is protected from concurrent |
| 16 | * accesses, by multiple CPUs, with the help of a spinlock belonging to the CPU |
| 17 | * owning the list. |
| 18 | * Note: Each list is maintained as a circular linked list with a special entry |
| 19 | * called `root_entry`. This entry is not associated with any vCPU and solely |
| 20 | * exists to help with list manipulation operations. Therefore, if there are |
| 21 | * five vCPUs with pending timer being tracked by partition manager on a CPU, |
| 22 | * the corresponding list will have six entries. |
| 23 | */ |
| 24 | struct timer_pending_vcpu_list { |
| 25 | struct list_entry root_entry; |
| 26 | }; |
Madhukar Pappireddy | c31708a | 2024-09-25 14:04:03 -0500 | [diff] [blame] | 27 | |
| 28 | void timer_vcpu_manage(struct vcpu *vcpu); |
Madhukar Pappireddy | 2efb3e1 | 2024-09-25 15:19:34 -0500 | [diff] [blame] | 29 | |
| 30 | struct vcpu *timer_find_vcpu_nearest_deadline(struct cpu *cpu); |
| 31 | |
| 32 | struct vcpu *timer_find_target_vcpu(struct vcpu *current); |
Madhukar Pappireddy | 106bfc3 | 2024-09-25 15:47:11 -0500 | [diff] [blame] | 33 | |
| 34 | void timer_migrate_to_other_cpu(struct cpu *to_cpu, |
| 35 | struct vcpu_locked migrate_vcpu_locked); |