1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2016,2017 ARM Limited, All Rights Reserved.
7 #ifndef __LINUX_IRQCHIP_ARM_GIC_V4_H
8 #define __LINUX_IRQCHIP_ARM_GIC_V4_H
13 * Maximum number of ITTs when GITS_TYPER.VMOVP == 0, using the
14 * ITSList mechanism to perform inter-ITS synchronization.
16 #define GICv4_ITS_LIST_MAX 16
18 /* Embedded in kvm.arch */
20 struct fwnode_handle *fwnode;
21 struct irq_domain *domain;
22 struct page *vprop_page;
23 struct its_vpe **vpes;
25 irq_hw_number_t db_lpi_base;
26 unsigned long *db_bitmap;
29 * Ensures mutual exclusion between updates to vlpi_count[]
30 * and map/unmap when using the ITSList mechanism.
32 * The lock order for any sequence involving the ITSList is
33 * vmapp_lock -> vpe_lock ->vmovp_lock.
35 raw_spinlock_t vmapp_lock;
36 u32 vlpi_count[GICv4_ITS_LIST_MAX];
39 /* Embedded in kvm_vcpu.arch */
41 struct page *vpt_page;
42 struct its_vm *its_vm;
43 /* per-vPE VLPI tracking */
45 /* Doorbell interrupt */
47 irq_hw_number_t vpe_db_lpi;
50 /* VPT parse complete */
53 /* GICv4.0 implementations */
55 /* VPE proxy mapping */
57 /* Implementation Defined Area Invalid */
60 /* GICv4.1 implementations */
62 struct fwnode_handle *fwnode;
63 struct irq_domain *sgi_domain;
72 /* Track the VPE being mapped */
76 * Ensures mutual exclusion between affinity setting of the
77 * vPE and vLPI operations using vpe->col_idx.
79 raw_spinlock_t vpe_lock;
81 * This collection ID is used to indirect the target
82 * redistributor for this VPE. The ID itself isn't involved in
83 * programming of the ITS.
86 /* Unique (system-wide) VPE identifier */
88 /* Pending VLPIs on schedule out? */
93 * struct its_vlpi_map: structure describing the mapping of a
94 * VLPI. Only to be interpreted in the context of a physical interrupt
95 * it complements. To be used as the vcpu_info passed to
96 * irq_set_vcpu_affinity().
98 * @vm: Pointer to the GICv4 notion of a VM
99 * @vpe: Pointer to the GICv4 notion of a virtual CPU (VPE)
100 * @vintid: Virtual LPI number
101 * @properties: Priority and enable bits (as written in the prop table)
102 * @db_enabled: Is the VPE doorbell to be generated?
104 struct its_vlpi_map {
112 enum its_vcpu_info_cmd_type {
116 PROP_UPDATE_AND_INV_VLPI,
124 struct its_cmd_info {
125 enum its_vcpu_info_cmd_type cmd_type;
127 struct its_vlpi_map *map;
141 int its_alloc_vcpu_irqs(struct its_vm *vm);
142 void its_free_vcpu_irqs(struct its_vm *vm);
143 int its_make_vpe_resident(struct its_vpe *vpe, bool g0en, bool g1en);
144 int its_make_vpe_non_resident(struct its_vpe *vpe, bool db);
145 int its_commit_vpe(struct its_vpe *vpe);
146 int its_invall_vpe(struct its_vpe *vpe);
147 int its_map_vlpi(int irq, struct its_vlpi_map *map);
148 int its_get_vlpi(int irq, struct its_vlpi_map *map);
149 int its_unmap_vlpi(int irq);
150 int its_prop_update_vlpi(int irq, u8 config, bool inv);
151 int its_prop_update_vsgi(int irq, u8 priority, bool group);
153 struct irq_domain_ops;
154 int its_init_v4(struct irq_domain *domain,
155 const struct irq_domain_ops *vpe_ops,
156 const struct irq_domain_ops *sgi_ops);
158 bool gic_cpuif_has_vsgi(void);