STRUCT IRQ_CHIP_GENERIC(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 to readl if it's NULL, so like, if you don't fill it in, it just handles itself 🫢
  • reg_writel β€” an alternate I/O accessor too. defaults to writel if it's NULL. same deal πŸ’«
  • suspend β€” a function the core code calls on suspend, once per chip. it can be useful instead of irq_chip::suspend to 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 of irq_chip::suspend to handle chip details even when no interrupts are in use. (yes, the original text really says irq_chip::suspend there 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 available irq_chip_type instances (usually 1). 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 interrupt irq_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