drivers/irqchip/irq-mips-gic.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-mips-gic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-mips-gic.c- Extension
.c- Size
- 26007 bytes
- Lines
- 1018
- Domain
- Driver Families
- Bucket
- drivers/irqchip
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/bitmap.hlinux/clocksource.hlinux/cpuhotplug.hlinux/init.hlinux/interrupt.hlinux/irq.hlinux/irqchip.hlinux/irqdomain.hlinux/of_address.hlinux/percpu.hlinux/sched.hlinux/smp.hasm/mips-cps.hasm/setup.hasm/traps.hdt-bindings/interrupt-controller/mips-gic.h
Detected Declarations
function __gic_with_next_online_cpufunction gic_unlock_clusterfunction gic_unlock_clusterfunction gic_clear_pcpu_masksfunction gic_local_irq_is_routablefunction gic_bind_eic_interruptfunction gic_send_ipifunction gic_get_c0_compare_intfunction gic_get_c0_perfcount_intfunction gic_get_c0_fdc_intfunction gic_handle_shared_intfunction for_each_set_bitfunction gic_mask_irqfunction gic_unmask_irqfunction gic_ack_irqfunction gic_set_typefunction gic_set_affinityfunction VPfunction gic_handle_local_intfunction for_each_set_bitfunction gic_mask_local_irqfunction gic_unmask_local_irqfunction gic_mask_local_irq_all_vpesfunction gic_unmask_local_irq_all_vpesfunction gic_all_vpes_irq_cpu_onlinefunction __gic_irq_dispatchfunction gic_irq_dispatchfunction gic_shared_irq_domain_mapfunction gic_irq_domain_xlatefunction gic_irq_domain_mapfunction gic_all_vpes_irq_cpu_onlinefunction gic_irq_domain_allocfunction gic_irq_domain_freefunction gic_ipi_domain_xlatefunction gic_ipi_domain_allocfunction gic_ipi_domain_freefunction gic_ipi_domain_matchfunction gic_register_ipi_domainfunction gic_register_ipi_domainfunction gic_cpu_startupfunction gic_of_init
Annotated Snippet
if (gic_irq_lock_cluster(d)) {
write_gic_redir_map_vp(irq, 0);
mips_cm_unlock_other();
} else {
write_gic_map_vp(irq, 0);
}
}
/*
* Update effective affinity - after this gic_irq_lock_cluster() will
* begin operating on the new cluster.
*/
irq_data_update_effective_affinity(d, cpumask_of(cpu));
/*
* If we're moving affinity between clusters, configure the interrupt
* trigger type in the new cluster.
*/
if (cl != old_cl)
gic_set_type(d, irqd_get_trigger_type(d));
/* Route the interrupt to its new VP(E) */
if (gic_irq_lock_cluster(d)) {
write_gic_redir_map_pin(irq,
GIC_MAP_PIN_MAP_TO_PIN | gic_cpu_pin);
write_gic_redir_map_vp(irq, BIT(mips_cm_vp_id(cpu)));
/* Update the pcpu_masks */
gic_clear_pcpu_masks(irq);
if (read_gic_redir_mask(irq))
set_bit(irq, per_cpu_ptr(pcpu_masks, cpu));
mips_cm_unlock_other();
} else {
write_gic_map_pin(irq, GIC_MAP_PIN_MAP_TO_PIN | gic_cpu_pin);
write_gic_map_vp(irq, BIT(mips_cm_vp_id(cpu)));
/* Update the pcpu_masks */
gic_clear_pcpu_masks(irq);
if (read_gic_mask(irq))
set_bit(irq, per_cpu_ptr(pcpu_masks, cpu));
}
raw_spin_unlock_irqrestore(&gic_lock, flags);
return IRQ_SET_MASK_OK;
}
#endif
static struct irq_chip gic_level_irq_controller = {
.name = "MIPS GIC",
.irq_mask = gic_mask_irq,
.irq_unmask = gic_unmask_irq,
.irq_set_type = gic_set_type,
#ifdef CONFIG_SMP
.irq_set_affinity = gic_set_affinity,
#endif
};
static struct irq_chip gic_edge_irq_controller = {
.name = "MIPS GIC",
.irq_ack = gic_ack_irq,
.irq_mask = gic_mask_irq,
.irq_unmask = gic_unmask_irq,
.irq_set_type = gic_set_type,
#ifdef CONFIG_SMP
.irq_set_affinity = gic_set_affinity,
#endif
.ipi_send_single = gic_send_ipi,
};
static void gic_handle_local_int(bool chained)
{
unsigned long pending, masked;
unsigned int intr;
pending = read_gic_vl_pend();
masked = read_gic_vl_mask();
bitmap_and(&pending, &pending, &masked, GIC_NUM_LOCAL_INTRS);
for_each_set_bit(intr, &pending, GIC_NUM_LOCAL_INTRS) {
if (chained)
generic_handle_domain_irq(gic_irq_domain,
GIC_LOCAL_TO_HWIRQ(intr));
else
do_domain_IRQ(gic_irq_domain,
GIC_LOCAL_TO_HWIRQ(intr));
}
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitmap.h`, `linux/clocksource.h`, `linux/cpuhotplug.h`, `linux/init.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/irqchip.h`.
- Detected declarations: `function __gic_with_next_online_cpu`, `function gic_unlock_cluster`, `function gic_unlock_cluster`, `function gic_clear_pcpu_masks`, `function gic_local_irq_is_routable`, `function gic_bind_eic_interrupt`, `function gic_send_ipi`, `function gic_get_c0_compare_int`, `function gic_get_c0_perfcount_int`, `function gic_get_c0_fdc_int`.
- Atlas domain: Driver Families / drivers/irqchip.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.