1
2
3
4
5
6
7#ifndef __LINUX_IRQCHIP_ARM_GIC_V4_H
8#define __LINUX_IRQCHIP_ARM_GIC_V4_H
9
10struct its_vpe;
11
12
13
14
15
16#define GICv4_ITS_LIST_MAX 16
17
18
19struct its_vm {
20 struct fwnode_handle *fwnode;
21 struct irq_domain *domain;
22 struct page *vprop_page;
23 struct its_vpe **vpes;
24 int nr_vpes;
25 irq_hw_number_t db_lpi_base;
26 unsigned long *db_bitmap;
27 int nr_db_lpis;
28 u32 vlpi_count[GICv4_ITS_LIST_MAX];
29};
30
31
32struct its_vpe {
33 struct page *vpt_page;
34 struct its_vm *its_vm;
35
36 atomic_t vlpi_count;
37
38 int irq;
39 irq_hw_number_t vpe_db_lpi;
40
41 bool resident;
42 union {
43
44 struct {
45
46 int vpe_proxy_event;
47
48 bool idai;
49 };
50
51 struct {
52 struct fwnode_handle *fwnode;
53 struct irq_domain *sgi_domain;
54 struct {
55 u8 priority;
56 bool enabled;
57 bool group;
58 } sgi_config[16];
59 atomic_t vmapp_count;
60 };
61 };
62
63
64
65
66
67 raw_spinlock_t vpe_lock;
68
69
70
71
72
73 u16 col_idx;
74
75 u16 vpe_id;
76
77 bool pending_last;
78};
79
80
81
82
83
84
85
86
87
88
89
90
91
92struct its_vlpi_map {
93 struct its_vm *vm;
94 struct its_vpe *vpe;
95 u32 vintid;
96 u8 properties;
97 bool db_enabled;
98};
99
100enum its_vcpu_info_cmd_type {
101 MAP_VLPI,
102 GET_VLPI,
103 PROP_UPDATE_VLPI,
104 PROP_UPDATE_AND_INV_VLPI,
105 SCHEDULE_VPE,
106 DESCHEDULE_VPE,
107 INVALL_VPE,
108 PROP_UPDATE_VSGI,
109};
110
111struct its_cmd_info {
112 enum its_vcpu_info_cmd_type cmd_type;
113 union {
114 struct its_vlpi_map *map;
115 u8 config;
116 bool req_db;
117 struct {
118 bool g0en;
119 bool g1en;
120 };
121 struct {
122 u8 priority;
123 bool group;
124 };
125 };
126};
127
128int its_alloc_vcpu_irqs(struct its_vm *vm);
129void its_free_vcpu_irqs(struct its_vm *vm);
130int its_make_vpe_resident(struct its_vpe *vpe, bool g0en, bool g1en);
131int its_make_vpe_non_resident(struct its_vpe *vpe, bool db);
132int its_invall_vpe(struct its_vpe *vpe);
133int its_map_vlpi(int irq, struct its_vlpi_map *map);
134int its_get_vlpi(int irq, struct its_vlpi_map *map);
135int its_unmap_vlpi(int irq);
136int its_prop_update_vlpi(int irq, u8 config, bool inv);
137int its_prop_update_vsgi(int irq, u8 priority, bool group);
138
139struct irq_domain_ops;
140int its_init_v4(struct irq_domain *domain,
141 const struct irq_domain_ops *vpe_ops,
142 const struct irq_domain_ops *sgi_ops);
143
144#endif
145