Lines Matching +full:vm +full:- +full:map
1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/irqchip/arm-gic-v4.h>
25 * agnostic actually means KVM-specific - what were you thinking?).
30 * - Any guest-visible VLPI is backed by a Linux interrupt (and a
36 * - Enabling/disabling a VLPI is done by issuing mask/unmask calls.
38 * - Guest INT/CLEAR commands are implemented through
41 * - The *bizarre* stuff (mapping/unmapping an interrupt to a VLPI, or
45 * confines the crap to a single location. And map/unmap really is
61 * interrupts which are delivered when a VLPI targeting a non-running
70 * - VMs (or rather the VM abstraction that matters to the GIC)
75 * - mask/unmask do what is expected on the doorbell interrupt.
77 * - irq_set_affinity is used to move a VPE from one redistributor to
80 * - irq_set_vcpu_affinity once again gets hijacked for the purpose of
81 * creating a new sub-API, namely scheduling/descheduling a VPE
103 name = kasprintf(GFP_KERNEL, "GICv4-sgi-%d", task_pid_nr(current)); in its_alloc_vcpu_sgis()
107 vpe->fwnode = irq_domain_alloc_named_id_fwnode(name, idx); in its_alloc_vcpu_sgis()
108 if (!vpe->fwnode) in its_alloc_vcpu_sgis()
114 vpe->sgi_domain = irq_domain_create_linear(vpe->fwnode, 16, in its_alloc_vcpu_sgis()
116 if (!vpe->sgi_domain) in its_alloc_vcpu_sgis()
119 sgi_base = __irq_domain_alloc_irqs(vpe->sgi_domain, -1, 16, in its_alloc_vcpu_sgis()
128 if (vpe->sgi_domain) in its_alloc_vcpu_sgis()
129 irq_domain_remove(vpe->sgi_domain); in its_alloc_vcpu_sgis()
130 if (vpe->fwnode) in its_alloc_vcpu_sgis()
131 irq_domain_free_fwnode(vpe->fwnode); in its_alloc_vcpu_sgis()
133 return -ENOMEM; in its_alloc_vcpu_sgis()
136 int its_alloc_vcpu_irqs(struct its_vm *vm) in its_alloc_vcpu_irqs() argument
140 vm->fwnode = irq_domain_alloc_named_id_fwnode("GICv4-vpe", in its_alloc_vcpu_irqs()
142 if (!vm->fwnode) in its_alloc_vcpu_irqs()
145 vm->domain = irq_domain_create_hierarchy(gic_domain, 0, vm->nr_vpes, in its_alloc_vcpu_irqs()
146 vm->fwnode, vpe_domain_ops, in its_alloc_vcpu_irqs()
147 vm); in its_alloc_vcpu_irqs()
148 if (!vm->domain) in its_alloc_vcpu_irqs()
151 for (i = 0; i < vm->nr_vpes; i++) { in its_alloc_vcpu_irqs()
152 vm->vpes[i]->its_vm = vm; in its_alloc_vcpu_irqs()
153 vm->vpes[i]->idai = true; in its_alloc_vcpu_irqs()
156 vpe_base_irq = __irq_domain_alloc_irqs(vm->domain, -1, vm->nr_vpes, in its_alloc_vcpu_irqs()
157 NUMA_NO_NODE, vm, in its_alloc_vcpu_irqs()
162 for (i = 0; i < vm->nr_vpes; i++) { in its_alloc_vcpu_irqs()
164 vm->vpes[i]->irq = vpe_base_irq + i; in its_alloc_vcpu_irqs()
165 ret = its_alloc_vcpu_sgis(vm->vpes[i], i); in its_alloc_vcpu_irqs()
173 if (vm->domain) in its_alloc_vcpu_irqs()
174 irq_domain_remove(vm->domain); in its_alloc_vcpu_irqs()
175 if (vm->fwnode) in its_alloc_vcpu_irqs()
176 irq_domain_free_fwnode(vm->fwnode); in its_alloc_vcpu_irqs()
178 return -ENOMEM; in its_alloc_vcpu_irqs()
181 static void its_free_sgi_irqs(struct its_vm *vm) in its_free_sgi_irqs() argument
188 for (i = 0; i < vm->nr_vpes; i++) { in its_free_sgi_irqs()
189 unsigned int irq = irq_find_mapping(vm->vpes[i]->sgi_domain, 0); in its_free_sgi_irqs()
195 irq_domain_remove(vm->vpes[i]->sgi_domain); in its_free_sgi_irqs()
196 irq_domain_free_fwnode(vm->vpes[i]->fwnode); in its_free_sgi_irqs()
200 void its_free_vcpu_irqs(struct its_vm *vm) in its_free_vcpu_irqs() argument
202 its_free_sgi_irqs(vm); in its_free_vcpu_irqs()
203 irq_domain_free_irqs(vm->vpes[0]->irq, vm->nr_vpes); in its_free_vcpu_irqs()
204 irq_domain_remove(vm->domain); in its_free_vcpu_irqs()
205 irq_domain_free_fwnode(vm->fwnode); in its_free_vcpu_irqs()
210 return irq_set_vcpu_affinity(vpe->irq, info); in its_send_vpe_cmd()
215 struct irq_desc *desc = irq_to_desc(vpe->irq); in its_make_vpe_non_resident()
227 while (db && irqd_irq_disabled(&desc->irq_data)) in its_make_vpe_non_resident()
228 enable_irq(vpe->irq); in its_make_vpe_non_resident()
233 vpe->resident = false; in its_make_vpe_non_resident()
251 disable_irq_nosync(vpe->irq); in its_make_vpe_resident()
256 vpe->resident = true; in its_make_vpe_resident()
270 int its_map_vlpi(int irq, struct its_vlpi_map *map) in its_map_vlpi() argument
275 .map = map, in its_map_vlpi()
293 int its_get_vlpi(int irq, struct its_vlpi_map *map) in its_get_vlpi() argument
298 .map = map, in its_get_vlpi()
349 return -ENODEV; in its_init_v4()