STRUCT IRQ_CHIP_GENERIC(9)
β¨ struct irq_chip_generic(9) β¨
okay so bestie, buckle up π this one lives in the Kernel API Manual and it's literally the blueprint for the generic irq chip data structure. it's giving "one struct to rule them all" energy, and we're gonna go through it line by line, no cap π«Ά
πΈ NAME πΈ
struct irq_chip_generic β the Generic irq chip data structure. that's it, that's the whole name, and honestly? iconic π
π SYNOPSIS π
struct irq_chip_generic {
raw_spinlock_t lock;
void __iomem *reg_base;
u32 (*reg_readl)(void __iomem *addr);
void (*reg_writel)(u32 val, void __iomem *addr);
void (*suspend)(struct irq_chip_generic *gc);
void (*resume)(struct irq_chip_generic *gc);
unsigned int irq_base;
unsigned int irq_cnt;
u32 mask_cache;
u32 wake_enabled;
u32 wake_active;
unsigned int num_ct;
void *private;
unsigned long installed;
unsigned long unused;
struct irq_domain *domain;
struct list_head list;
struct irq_chip_type chip_types[];
};
copy it exactly, bestie, i'm not playing about the field order π€
π¦ Members π¦
lockβ the lock that protects register and cache data access. guard your state, queen πreg_baseβ the register base address, and yes it's the virtual one. very demure, very mindful.reg_readlβ an alternate I/O accessor. defaults toreadlif it'sNULL, so like, if you don't fill it in, it just handles itself π«Άreg_writelβ an alternate I/O accessor too. defaults towritelif it'sNULL. same deal π«suspendβ a function the core code calls on suspend, once per chip. it can be useful instead ofirq_chip::suspendto handle chip details even when no interrupts are in use. lowkey the glow-up version of the callback.resumeβ a function the core code calls on resume, once per chip. can be useful instead ofirq_chip::suspendto handle chip details even when no interrupts are in use. (yes, the original text really saysirq_chip::suspendthere too β i'm not fixing it, i'm just reporting it fr fr π«‘)irq_baseβ the interrupt base nr for this chip. the starting number, the origin story βirq_cntβ how many interrupts this chip handles. the headcount πmask_cacheβ the cached mask register, shared between all chip types. yes, all of them. sharing is caring πwake_enabledβ the interrupt can wakeup from suspend. main character wake-up energy π΄β‘οΈπ₯wake_activeβ the interrupt is marked as an wakeup from suspend source. it's been activated, bestie.num_ctβ number of availableirq_chip_typeinstances (usually1). usually one, sometimes a whole little squad πprivateβ private data for non generic chip callbacks. your own little secret stash πinstalledβ a bitfield to denote installed interrupts. one bit per interrupt, so slay πunusedβ a bitfield to denote unused interrupts. the opposite vibe entirely.domainβ the irq domain pointer. it's giving connections πlistβ the list head for keeping track of instances. so the kernel never loses track of you πchip_typesβ array of interruptirq_chip_types. the whole collection, the full set, the wardrobe π
π§ Description π§
okay so here's the actual tea: note that irq_chip_generic can have multiple irq_chip_type implementations, and those can be associated to a particular irq line of an irq_chip_generic instance. why does that matter? because it lets you share and protect state in an irq_chip_generic instance when we need to implement different flow mechanisms (level/edge) for it. literally sharing state while keeping it safe β the friend group we all deserve π«Άπ
π SEE ALSO π
- Kernel file
./include/linux/irq.h struct irq_common_data(9)struct irq_data(9)struct irq_chip(9)struct irq_chip_regs(9)struct irq_chip_type(9)enum irq_gc_flags(9)struct irq_domain_chip_generic_info(9)
go read the friends too, bestie β they're all in ./include/linux/irq.h and they're all part of the same friend group, iykyk πΈ
and that's the page!! π
this one's from ./include/linux, dated October 2026, and it's still filed under struct irq_chip_generic(9) β so if you ever need to find it again, that's where it lives. mwah, go forth and slay those interrupts β¨ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms