drivers/irqchip/irq-gic.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-gic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-gic.c- Extension
.c- Size
- 43526 bytes
- Lines
- 1710
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/kernel.hlinux/kstrtox.hlinux/err.hlinux/module.hlinux/list.hlinux/smp.hlinux/cpu.hlinux/cpu_pm.hlinux/cpumask.hlinux/io.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/acpi.hlinux/irqdomain.hlinux/interrupt.hlinux/percpu.hlinux/seq_file.hlinux/slab.hlinux/irqchip.hlinux/irqchip/chained_irq.hlinux/irqchip/arm-gic.hasm/cputype.hasm/irq.hasm/exception.hasm/smp_plat.hasm/virt.hirq-gic-common.hasm/cpufeature.h
Detected Declarations
struct gic_chip_datafunction Copyrightfunction enable_frankengicfunction cascading_gic_irqfunction gic_poke_irqfunction gic_peek_irqfunction gic_mask_irqfunction gic_eoimode1_mask_irqfunction gic_unmask_irqfunction gic_eoi_irqfunction gic_eoimode1_eoi_irqfunction gic_irq_set_irqchip_statefunction gic_irq_get_irqchip_statefunction gic_set_typefunction gic_irq_set_vcpu_affinityfunction gic_retriggerfunction gic_handle_irqfunction gic_handle_cascade_irqfunction gic_irq_print_chipfunction gic_cascade_irqfunction gic_get_cpumaskfunction gic_check_gicv2function gic_cpu_if_upfunction gic_dist_initfunction gic_cpu_initfunction CPUfunction gic_cpu_if_downfunction gic_dist_savefunction gic_dist_restorefunction gic_cpu_savefunction gic_cpu_restorefunction gic_notifierfunction gic_pm_initfunction gic_pm_initfunction rmw_writebfunction gic_set_affinityfunction gic_ipi_send_maskfunction gic_starting_cpufunction gic_smp_initfunction gic_send_sgifunction unknownfunction gic_migrate_targetfunction gic_get_sgir_physaddrfunction gic_init_physaddrfunction gic_irq_domain_mapfunction gic_irq_domain_translatefunction gic_irq_domain_allocfunction gic_init_bases
Annotated Snippet
struct gic_chip_data {
union gic_base dist_base;
union gic_base cpu_base;
void __iomem *raw_dist_base;
void __iomem *raw_cpu_base;
u32 percpu_offset;
#if defined(CONFIG_CPU_PM) || defined(CONFIG_ARM_GIC_PM)
u32 saved_spi_enable[DIV_ROUND_UP(1020, 32)];
u32 saved_spi_active[DIV_ROUND_UP(1020, 32)];
u32 saved_spi_conf[DIV_ROUND_UP(1020, 16)];
u32 saved_spi_target[DIV_ROUND_UP(1020, 4)];
u32 __percpu *saved_ppi_enable;
u32 __percpu *saved_ppi_active;
u32 __percpu *saved_ppi_conf;
#endif
struct irq_domain *domain;
unsigned int gic_irqs;
};
#ifdef CONFIG_BL_SWITCHER
static DEFINE_RAW_SPINLOCK(cpu_map_lock);
#define gic_lock_irqsave(f) \
raw_spin_lock_irqsave(&cpu_map_lock, (f))
#define gic_unlock_irqrestore(f) \
raw_spin_unlock_irqrestore(&cpu_map_lock, (f))
#define gic_lock() raw_spin_lock(&cpu_map_lock)
#define gic_unlock() raw_spin_unlock(&cpu_map_lock)
#else
#define gic_lock_irqsave(f) do { (void)(f); } while(0)
#define gic_unlock_irqrestore(f) do { (void)(f); } while(0)
#define gic_lock() do { } while(0)
#define gic_unlock() do { } while(0)
#endif
static DEFINE_STATIC_KEY_FALSE(needs_rmw_access);
/*
* The GIC mapping of CPU interfaces does not necessarily match
* the logical CPU numbering. Let's use a mapping as returned
* by the GIC itself.
*/
#define NR_GIC_CPU_IF 8
static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
static DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);
static struct gic_chip_data gic_data[CONFIG_ARM_GIC_MAX_NR] __read_mostly;
static struct gic_kvm_info gic_v2_kvm_info __initdata;
static DEFINE_PER_CPU(u32, sgi_intid);
#ifdef CONFIG_GIC_NON_BANKED
static DEFINE_STATIC_KEY_FALSE(frankengic_key);
static void enable_frankengic(void)
{
static_branch_enable(&frankengic_key);
}
static inline void __iomem *__get_base(union gic_base *base)
{
if (static_branch_unlikely(&frankengic_key))
return raw_cpu_read(*base->percpu_base);
return base->common_base;
}
#define gic_data_dist_base(d) __get_base(&(d)->dist_base)
#define gic_data_cpu_base(d) __get_base(&(d)->cpu_base)
#else
#define gic_data_dist_base(d) ((d)->dist_base.common_base)
#define gic_data_cpu_base(d) ((d)->cpu_base.common_base)
#define enable_frankengic() do { } while(0)
#endif
static inline void __iomem *gic_dist_base(struct irq_data *d)
{
struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);
return gic_data_dist_base(gic_data);
}
static inline void __iomem *gic_cpu_base(struct irq_data *d)
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/kstrtox.h`, `linux/err.h`, `linux/module.h`, `linux/list.h`, `linux/smp.h`, `linux/cpu.h`.
- Detected declarations: `struct gic_chip_data`, `function Copyright`, `function enable_frankengic`, `function cascading_gic_irq`, `function gic_poke_irq`, `function gic_peek_irq`, `function gic_mask_irq`, `function gic_eoimode1_mask_irq`, `function gic_unmask_irq`, `function gic_eoi_irq`.
- 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.