Lines Matching +full:de +full:- +full:activated

1 // SPDX-License-Identifier: GPL-2.0-only
6 * Copyright (c) 2013, Alexander Graf <agraf@suse.de>
12 * Alexander Graf <agraf@suse.de>
28 irq_rt = srcu_dereference_check(kvm->irq_routing, &kvm->irq_srcu, in kvm_irq_map_gsi()
29 lockdep_is_held(&kvm->irq_lock)); in kvm_irq_map_gsi()
30 if (irq_rt && gsi < irq_rt->nr_rt_entries) { in kvm_irq_map_gsi()
31 hlist_for_each_entry(e, &irq_rt->map[gsi], link) { in kvm_irq_map_gsi()
44 irq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu); in kvm_irq_map_chip_pin()
45 return irq_rt->chip[irqchip][pin]; in kvm_irq_map_chip_pin()
52 if (!kvm_arch_irqchip_in_kernel(kvm) || (msi->flags & ~KVM_MSI_VALID_DEVID)) in kvm_send_userspace_msi()
53 return -EINVAL; in kvm_send_userspace_msi()
55 route.msi.address_lo = msi->address_lo; in kvm_send_userspace_msi()
56 route.msi.address_hi = msi->address_hi; in kvm_send_userspace_msi()
57 route.msi.data = msi->data; in kvm_send_userspace_msi()
58 route.msi.flags = msi->flags; in kvm_send_userspace_msi()
59 route.msi.devid = msi->devid; in kvm_send_userspace_msi()
74 int ret = -1, i, idx; in kvm_set_irq()
82 idx = srcu_read_lock(&kvm->irq_srcu); in kvm_set_irq()
84 srcu_read_unlock(&kvm->irq_srcu, idx); in kvm_set_irq()
86 while (i--) { in kvm_set_irq()
106 for (i = 0; i < rt->nr_rt_entries; ++i) { in free_irq_routing_table()
110 hlist_for_each_entry_safe(e, n, &rt->map[i], link) { in free_irq_routing_table()
111 hlist_del(&e->link); in free_irq_routing_table()
123 struct kvm_irq_routing_table *rt = rcu_access_pointer(kvm->irq_routing); in kvm_free_irq_routing()
134 u32 gsi = array_index_nospec(ue->gsi, KVM_MAX_IRQ_ROUTES); in setup_routing_entry()
138 * Allow only one to one mapping between GSI and non-irqchip routing. in setup_routing_entry()
140 hlist_for_each_entry(ei, &rt->map[gsi], link) in setup_routing_entry()
141 if (ei->type != KVM_IRQ_ROUTING_IRQCHIP || in setup_routing_entry()
142 ue->type != KVM_IRQ_ROUTING_IRQCHIP || in setup_routing_entry()
143 ue->u.irqchip.irqchip == ei->irqchip.irqchip) in setup_routing_entry()
144 return -EINVAL; in setup_routing_entry()
146 e->gsi = gsi; in setup_routing_entry()
147 e->type = ue->type; in setup_routing_entry()
151 if (e->type == KVM_IRQ_ROUTING_IRQCHIP) in setup_routing_entry()
152 rt->chip[e->irqchip.irqchip][e->irqchip.pin] = e->gsi; in setup_routing_entry()
154 hlist_add_head(&e->link, &rt->map[e->gsi]); in setup_routing_entry()
180 return -EINVAL; in kvm_set_irq_routing()
188 return -ENOMEM; in kvm_set_irq_routing()
190 new->nr_rt_entries = nr_rt_entries; in kvm_set_irq_routing()
193 new->chip[i][j] = -1; in kvm_set_irq_routing()
196 r = -ENOMEM; in kvm_set_irq_routing()
201 r = -EINVAL; in kvm_set_irq_routing()
202 switch (ue->type) { in kvm_set_irq_routing()
204 if (ue->flags & ~KVM_MSI_VALID_DEVID) in kvm_set_irq_routing()
208 if (ue->flags) in kvm_set_irq_routing()
218 mutex_lock(&kvm->irq_lock); in kvm_set_irq_routing()
219 old = rcu_dereference_protected(kvm->irq_routing, 1); in kvm_set_irq_routing()
220 rcu_assign_pointer(kvm->irq_routing, new); in kvm_set_irq_routing()
223 mutex_unlock(&kvm->irq_lock); in kvm_set_irq_routing()
227 synchronize_srcu_expedited(&kvm->irq_srcu); in kvm_set_irq_routing()
243 * when userspace-driven IRQ routing is activated, and so that kvm->irq_routing
244 * is guaranteed to be non-NULL.
253 return -ENOMEM; in kvm_init_irq_routing()
255 new->nr_rt_entries = 1; in kvm_init_irq_routing()
258 memset(new->chip, -1, chip_size); in kvm_init_irq_routing()
260 RCU_INIT_POINTER(kvm->irq_routing, new); in kvm_init_irq_routing()