]> rtime.felk.cvut.cz Git - jailhouse.git/blob - hypervisor/include/jailhouse/control.h
core: Remove unused cpu_data from arch_cell_create/destroy
[jailhouse.git] / hypervisor / include / jailhouse / control.h
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2013
5  *
6  * Authors:
7  *  Jan Kiszka <jan.kiszka@siemens.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12
13 #include <asm/bitops.h>
14 #include <asm/percpu.h>
15 #include <jailhouse/cell-config.h>
16
17 #define SHUTDOWN_NONE                   0
18 #define SHUTDOWN_STARTED                1
19
20 extern struct jailhouse_system *system_config;
21
22 unsigned int next_cpu(unsigned int cpu, struct cpu_set *cpu_set,
23                       int exception);
24
25 #define for_each_cpu(cpu, set)                                  \
26         for ((cpu) = -1;                                        \
27              (cpu) = next_cpu((cpu), (set), -1),                \
28              (cpu) <= (set)->max_cpu_id;                        \
29             )
30
31 #define for_each_cpu_except(cpu, set, exception)                \
32         for ((cpu) = -1;                                        \
33              (cpu) = next_cpu((cpu), (set), (exception)),       \
34              (cpu) <= (set)->max_cpu_id;                        \
35             )
36
37 static inline bool cell_owns_cpu(struct cell *cell, unsigned int cpu_id)
38 {
39         return (cpu_id <= cell->cpu_set->max_cpu_id &&
40                 test_bit(cpu_id, cell->cpu_set->bitmap));
41 }
42
43 bool cpu_id_valid(unsigned long cpu_id);
44
45 int check_mem_regions(const struct jailhouse_cell_desc *config);
46 int cell_init(struct cell *cell);
47
48 long hypercall(unsigned long code, unsigned long arg1, unsigned long arg2);
49
50 void __attribute__((noreturn)) panic_stop(void);
51 void panic_halt(void);
52
53 void arch_suspend_cpu(unsigned int cpu_id);
54 void arch_resume_cpu(unsigned int cpu_id);
55 void arch_reset_cpu(unsigned int cpu_id);
56 void arch_park_cpu(unsigned int cpu_id);
57 void arch_shutdown_cpu(unsigned int cpu_id);
58
59 int arch_map_memory_region(struct cell *cell,
60                            const struct jailhouse_memory *mem);
61 int arch_unmap_memory_region(struct cell *cell,
62                              const struct jailhouse_memory *mem);
63
64 int arch_cell_create(struct cell *cell);
65 void arch_cell_destroy(struct cell *cell);
66
67 void arch_config_commit(struct per_cpu *cpu_data,
68                         struct cell *cell_added_removed);
69
70 void arch_shutdown(void);
71
72 void __attribute__((noreturn)) arch_panic_stop(void);
73 void arch_panic_halt(void);