Lines Matching +full:interrupt +full:- +full:affinity
1 // SPDX-License-Identifier: GPL-2.0
4 * Hyper-V stub IOMMU driver.
12 #include <linux/interrupt.h>
30 * According 82093AA IO-APIC spec , IO APIC has a 24-entry Interrupt
31 * Redirection Table. Hyper-V exposes one single IO-APIC and so define
42 struct irq_data *parent = data->parent_data; in hyperv_ir_set_affinity()
46 /* Return error If new irq affinity is out of ioapic_max_cpumask. */ in hyperv_ir_set_affinity()
48 return -EINVAL; in hyperv_ir_set_affinity()
50 ret = parent->chip->irq_set_affinity(parent, mask, force); in hyperv_ir_set_affinity()
60 .name = "HYPERV-IR",
73 if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1) in hyperv_irq_remapping_alloc()
74 return -EINVAL; in hyperv_irq_remapping_alloc()
83 return -EINVAL; in hyperv_irq_remapping_alloc()
86 irq_data->chip = &hyperv_ir_chip; in hyperv_irq_remapping_alloc()
89 * Hypver-V IO APIC irq affinity should be in the scope of in hyperv_irq_remapping_alloc()
107 /* Claim the only I/O APIC emulated by Hyper-V */ in hyperv_irq_remapping_select()
128 return -ENODEV; in hyperv_prepare_irq_remapping()
131 name = "HYPERV-ROOT-IR"; in hyperv_prepare_irq_remapping()
134 name = "HYPERV-IR"; in hyperv_prepare_irq_remapping()
140 return -ENOMEM; in hyperv_prepare_irq_remapping()
148 return -ENOMEM; in hyperv_prepare_irq_remapping()
155 * Hyper-V doesn't provide irq remapping function for in hyperv_prepare_irq_remapping()
156 * IO-APIC and so IO-APIC only accepts 8-bit APIC ID. in hyperv_prepare_irq_remapping()
158 * in the MADT table on Hyper-v are sorted monotonic increasingly. in hyperv_prepare_irq_remapping()
161 * max cpu affinity for IOAPIC irqs. Scan cpu 0-255 and set cpu in hyperv_prepare_irq_remapping()
164 for (i = min_t(unsigned int, num_possible_cpus() - 1, 255); i >= 0; i--) in hyperv_prepare_irq_remapping()
195 const struct cpumask *affinity; in hyperv_root_ir_compose_msi_msg() local
198 struct hyperv_root_ir_data *data = irq_data->chip_data; in hyperv_root_ir_compose_msi_msg()
202 affinity = irq_data_get_effective_affinity_mask(irq_data); in hyperv_root_ir_compose_msi_msg()
203 cpu = cpumask_first_and(affinity, cpu_online_mask); in hyperv_root_ir_compose_msi_msg()
205 vector = cfg->vector; in hyperv_root_ir_compose_msi_msg()
206 ioapic_id = data->ioapic_id; in hyperv_root_ir_compose_msi_msg()
208 if (data->entry.source == HV_DEVICE_TYPE_IOAPIC in hyperv_root_ir_compose_msi_msg()
209 && data->entry.ioapic_rte.as_uint64) { in hyperv_root_ir_compose_msi_msg()
210 entry = data->entry; in hyperv_root_ir_compose_msi_msg()
217 data->entry.ioapic_rte.as_uint64 = 0; in hyperv_root_ir_compose_msi_msg()
218 data->entry.source = 0; /* Invalid source */ in hyperv_root_ir_compose_msi_msg()
222 status = hv_map_ioapic_interrupt(ioapic_id, data->is_level, cpu, in hyperv_root_ir_compose_msi_msg()
230 data->entry = entry; in hyperv_root_ir_compose_msi_msg()
237 msg->arch_data.vector = e.vector; in hyperv_root_ir_compose_msi_msg()
238 msg->arch_data.delivery_mode = e.delivery_mode; in hyperv_root_ir_compose_msi_msg()
239 msg->arch_addr_lo.dest_mode_logical = e.dest_mode_logical; in hyperv_root_ir_compose_msi_msg()
240 msg->arch_addr_lo.dmar_format = e.ir_format; in hyperv_root_ir_compose_msi_msg()
241 msg->arch_addr_lo.dmar_index_0_14 = e.ir_index_0_14; in hyperv_root_ir_compose_msi_msg()
247 struct irq_data *parent = data->parent_data; in hyperv_root_ir_set_affinity()
251 ret = parent->chip->irq_set_affinity(parent, mask, force); in hyperv_root_ir_set_affinity()
261 .name = "HYPERV-ROOT-IR",
276 if (!info || info->type != X86_IRQ_ALLOC_TYPE_IOAPIC || nr_irqs > 1) in hyperv_root_irq_remapping_alloc()
277 return -EINVAL; in hyperv_root_irq_remapping_alloc()
286 return -ENOMEM; in hyperv_root_irq_remapping_alloc()
293 return -EINVAL; in hyperv_root_irq_remapping_alloc()
296 data->ioapic_id = info->devid; in hyperv_root_irq_remapping_alloc()
297 data->is_level = info->ioapic.is_level; in hyperv_root_irq_remapping_alloc()
299 irq_data->chip = &hyperv_root_ir_chip; in hyperv_root_irq_remapping_alloc()
300 irq_data->chip_data = data; in hyperv_root_irq_remapping_alloc()
316 if (irq_data && irq_data->chip_data) { in hyperv_root_irq_remapping_free()
317 data = irq_data->chip_data; in hyperv_root_irq_remapping_free()
318 e = &data->entry; in hyperv_root_irq_remapping_free()
320 if (e->source == HV_DEVICE_TYPE_IOAPIC in hyperv_root_irq_remapping_free()
321 && e->ioapic_rte.as_uint64) in hyperv_root_irq_remapping_free()
322 hv_unmap_ioapic_interrupt(data->ioapic_id, in hyperv_root_irq_remapping_free()
323 &data->entry); in hyperv_root_irq_remapping_free()