Lines Matching +full:gic +full:- +full:its
1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <linux/irqchip/arm-gic-v4.h>
23 * core GIC code (that would in turn leak into the hypervisor code),
26 * agnostic actually means KVM-specific - what were you thinking?).
31 * - Any guest-visible VLPI is backed by a Linux interrupt (and a
37 * - Enabling/disabling a VLPI is done by issuing mask/unmask calls.
39 * - Guest INT/CLEAR commands are implemented through
42 * - The *bizarre* stuff (mapping/unmapping an interrupt to a VLPI, or
52 * the virtual ITS (because it references a virtual device, and the
53 * physical ITS is still very much in charge of the physical
54 * device). Same goes for things like MAPC (the physical ITS deals
62 * interrupts which are delivered when a VLPI targeting a non-running
71 * - VMs (or rather the VM abstraction that matters to the GIC)
76 * - mask/unmask do what is expected on the doorbell interrupt.
78 * - irq_set_affinity is used to move a VPE from one redistributor to
81 * - irq_set_vcpu_affinity once again gets hijacked for the purpose of
82 * creating a new sub-API, namely scheduling/descheduling a VPE
127 name = kasprintf(GFP_KERNEL, "GICv4-sgi-%d", task_pid_nr(current)); in its_alloc_vcpu_sgis()
131 vpe->fwnode = irq_domain_alloc_named_id_fwnode(name, idx); in its_alloc_vcpu_sgis()
132 if (!vpe->fwnode) in its_alloc_vcpu_sgis()
138 vpe->sgi_domain = irq_domain_create_linear(vpe->fwnode, 16, in its_alloc_vcpu_sgis()
140 if (!vpe->sgi_domain) in its_alloc_vcpu_sgis()
143 sgi_base = irq_domain_alloc_irqs(vpe->sgi_domain, 16, NUMA_NO_NODE, vpe); in its_alloc_vcpu_sgis()
150 if (vpe->sgi_domain) in its_alloc_vcpu_sgis()
151 irq_domain_remove(vpe->sgi_domain); in its_alloc_vcpu_sgis()
152 if (vpe->fwnode) in its_alloc_vcpu_sgis()
153 irq_domain_free_fwnode(vpe->fwnode); in its_alloc_vcpu_sgis()
155 return -ENOMEM; in its_alloc_vcpu_sgis()
162 vm->fwnode = irq_domain_alloc_named_id_fwnode("GICv4-vpe", in its_alloc_vcpu_irqs()
164 if (!vm->fwnode) in its_alloc_vcpu_irqs()
167 vm->domain = irq_domain_create_hierarchy(gic_domain, 0, vm->nr_vpes, in its_alloc_vcpu_irqs()
168 vm->fwnode, vpe_domain_ops, in its_alloc_vcpu_irqs()
170 if (!vm->domain) in its_alloc_vcpu_irqs()
173 for (i = 0; i < vm->nr_vpes; i++) { in its_alloc_vcpu_irqs()
174 vm->vpes[i]->its_vm = vm; in its_alloc_vcpu_irqs()
175 vm->vpes[i]->idai = true; in its_alloc_vcpu_irqs()
178 vpe_base_irq = irq_domain_alloc_irqs(vm->domain, vm->nr_vpes, in its_alloc_vcpu_irqs()
183 for (i = 0; i < vm->nr_vpes; i++) { in its_alloc_vcpu_irqs()
185 vm->vpes[i]->irq = vpe_base_irq + i; in its_alloc_vcpu_irqs()
186 ret = its_alloc_vcpu_sgis(vm->vpes[i], i); in its_alloc_vcpu_irqs()
194 if (vm->domain) in its_alloc_vcpu_irqs()
195 irq_domain_remove(vm->domain); in its_alloc_vcpu_irqs()
196 if (vm->fwnode) in its_alloc_vcpu_irqs()
197 irq_domain_free_fwnode(vm->fwnode); in its_alloc_vcpu_irqs()
199 return -ENOMEM; in its_alloc_vcpu_irqs()
209 for (i = 0; i < vm->nr_vpes; i++) { in its_free_sgi_irqs()
210 unsigned int irq = irq_find_mapping(vm->vpes[i]->sgi_domain, 0); in its_free_sgi_irqs()
216 irq_domain_remove(vm->vpes[i]->sgi_domain); in its_free_sgi_irqs()
217 irq_domain_free_fwnode(vm->vpes[i]->fwnode); in its_free_sgi_irqs()
224 irq_domain_free_irqs(vm->vpes[0]->irq, vm->nr_vpes); in its_free_vcpu_irqs()
225 irq_domain_remove(vm->domain); in its_free_vcpu_irqs()
226 irq_domain_free_fwnode(vm->fwnode); in its_free_vcpu_irqs()
231 return irq_set_vcpu_affinity(vpe->irq, info); in its_send_vpe_cmd()
236 struct irq_desc *desc = irq_to_desc(vpe->irq); in its_make_vpe_non_resident()
248 while (db && irqd_irq_disabled(&desc->irq_data)) in its_make_vpe_non_resident()
249 enable_irq(vpe->irq); in its_make_vpe_non_resident()
254 vpe->resident = false; in its_make_vpe_non_resident()
256 vpe->ready = false; in its_make_vpe_non_resident()
274 disable_irq_nosync(vpe->irq); in its_make_vpe_resident()
279 vpe->resident = true; in its_make_vpe_resident()
295 vpe->ready = true; in its_commit_vpe()
381 pr_info("ITS: Enabling GICv4 support\n"); in its_init_v4()
388 pr_err("ITS: No GICv4 VPE domain allocated\n"); in its_init_v4()
389 return -ENODEV; in its_init_v4()