blob: 3f54c584c1572d8a579704d0b8c2347f0abe431c [file] [log] [blame]
Madhukar Pappireddyeed861e2024-09-25 13:50:54 -05001/*
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 */
24struct timer_pending_vcpu_list {
25 struct list_entry root_entry;
26};
Madhukar Pappireddyc31708a2024-09-25 14:04:03 -050027
28void timer_vcpu_manage(struct vcpu *vcpu);
Madhukar Pappireddy2efb3e12024-09-25 15:19:34 -050029
30struct vcpu *timer_find_vcpu_nearest_deadline(struct cpu *cpu);
31
32struct vcpu *timer_find_target_vcpu(struct vcpu *current);
Madhukar Pappireddy106bfc32024-09-25 15:47:11 -050033
34void timer_migrate_to_other_cpu(struct cpu *to_cpu,
35 struct vcpu_locked migrate_vcpu_locked);