]> rtime.felk.cvut.cz Git - jailhouse.git/blob - hypervisor/arch/arm/include/asm/irqchip.h
42948e8364a3f7e887013c17fd0fc1f265bb3fa5
[jailhouse.git] / hypervisor / arch / arm / include / asm / irqchip.h
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) ARM Limited, 2014
5  *
6  * Authors:
7  *  Jean-Philippe Brucker <jean-philippe.brucker@arm.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 #ifndef _JAILHOUSE_ASM_IRQCHIP_H
14 #define _JAILHOUSE_ASM_IRQCHIP_H
15
16 #define MAX_PENDING_IRQS        256
17
18 #include <jailhouse/cell.h>
19 #include <jailhouse/mmio.h>
20
21 #ifndef __ASSEMBLY__
22
23 struct per_cpu;
24
25 struct sgi {
26         /*
27          * Routing mode values:
28          * 0: use aff3.aff2.aff1.targets
29          * 1: all processors in the cell except this CPU
30          * 2: only this CPU
31          */
32         u8      routing_mode;
33         /* GICv2 only uses 8bit in targets, and no affinity routing */
34         u8      aff1;
35         u8      aff2;
36         /* Only available on 64-bit, when CTLR.A3V is 1 */
37         u8      aff3;
38         u16     targets;
39         u16     id;
40 };
41
42 struct irqchip_ops {
43         int     (*init)(void);
44         int     (*cpu_init)(struct per_cpu *cpu_data);
45         int     (*cell_init)(struct cell *cell);
46         void    (*cell_exit)(struct cell *cell);
47         int     (*cpu_reset)(struct per_cpu *cpu_data, bool is_shutdown);
48
49         int     (*send_sgi)(struct sgi *sgi);
50         void    (*handle_irq)(struct per_cpu *cpu_data);
51         void    (*eoi_irq)(u32 irqn, bool deactivate);
52         int     (*inject_irq)(struct per_cpu *cpu_data, u16 irq_id);
53         void    (*enable_maint_irq)(bool enable);
54
55         int     (*mmio_access)(struct mmio_access *access);
56 };
57
58 unsigned int irqchip_mmio_count_regions(struct cell *cell);
59
60 int irqchip_init(void);
61 int irqchip_cpu_init(struct per_cpu *cpu_data);
62 int irqchip_cpu_reset(struct per_cpu *cpu_data);
63 void irqchip_cpu_shutdown(struct per_cpu *cpu_data);
64
65 int irqchip_cell_init(struct cell *cell);
66 void irqchip_cell_exit(struct cell *cell);
67 void irqchip_root_cell_shrink(struct cell *cell);
68
69 int irqchip_send_sgi(struct sgi *sgi);
70 void irqchip_handle_irq(struct per_cpu *cpu_data);
71 void irqchip_eoi_irq(u32 irqn, bool deactivate);
72
73 void irqchip_inject_pending(struct per_cpu *cpu_data);
74 void irqchip_set_pending(struct per_cpu *cpu_data, u16 irq_id);
75
76 bool spi_in_cell(struct cell *cell, unsigned int spi);
77
78 #endif /* __ASSEMBLY__ */
79 #endif /* _JAILHOUSE_ASM_IRQCHIP_H */