STRUCT MSI_DOMAIN_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct msi_domain_ops(9) β€” the MSI interrupt domain callback squad

okay bestie, so this is struct msi_domain_ops from the Kernel API Manual, section 9 (kernel internals, iykyk). it's the official list of callbacks an MSI interrupt domain can hand you. think of it as the group chat roles for your irq domain β€” everyone has a job, and if you don't assign one, the default kicks in. periodt. ✨


✨ SYNOPSIS ✨

here's the whole struct, exactly as it lives β€” no cap, every field:

struct msi_domain_ops {
    irq_hw_number_t (*get_hwirq)(struct msi_domain_info *info,
msi_alloc_info_t *arg);
    int (*msi_init)(struct irq_domain *domain, struct msi_domain_info
*info, unsigned int virq, irq_hw_number_t hwirq, msi_alloc_info_t *arg);
    void (*msi_free)(struct irq_domain *domain, struct msi_domain_info
*info, unsigned int virq);
    int (*msi_prepare)(struct irq_domain *domain, struct device *dev,
int nvec, msi_alloc_info_t *arg);
    void (*msi_teardown)(struct irq_domain *domain, msi_alloc_info_t
*arg);
    void (*prepare_desc)(struct irq_domain *domain, msi_alloc_info_t
*arg, struct msi_desc *desc);
    void (*set_desc)(msi_alloc_info_t *arg, struct msi_desc *desc);
    int (*domain_alloc_irqs)(struct irq_domain *domain, struct device
*dev, int nvec);
    void (*domain_free_irqs)(struct irq_domain *domain, struct device
*dev);
    int (*msi_translate)(struct irq_domain *domain, struct irq_fwspec
*fwspec, irq_hw_number_t *hwirq, unsigned int *type);
 };

πŸŽ€ MEMBERS πŸŽ€

  • get_hwirq β€” get the resulting hardware irq number. literally the "what's my actual hw irq" hook 🌸
  • msi_init β€” the domain-specific init function for MSI interrupts. sets your babies up πŸ’–
  • msi_free β€” domain-specific function to free an MSI interrupt. cleanup queen πŸ‘‘
  • msi_prepare β€” prep the allocation of the interrupts inside the domain. the pre-game ritual ✨
  • msi_teardown β€” reverse the effects of msi_prepare. undoing the vibe check 🫢
  • prepare_desc β€” optional function to prepare the allocated MSI descriptor in the domain. optional but iconic πŸ’…
  • set_desc β€” set the MSI descriptor for an interrupt. assign the desc, no discussion πŸ’€
  • domain_alloc_irqs β€” optional function to override the default allocation function. main character energy, taking over the default πŸ”₯
  • domain_free_irqs β€” optional function to override the default free function. the matching override for cleanup 🌈
  • msi_translate β€” optional translate callback to support the odd wire-to-MSI bridges, e.g. MBIGEN. for the weird edge cases, and honestly? obsessed πŸ¦‹

🌟 DESCRIPTION 🌟

so get_hwirq, msi_init and msi_free are the callbacks used by the underlying irqdomain. that's their whole thing, they belong to the irqdomain. fr fr.

msi_check, msi_prepare, msi_teardown, prepare_desc and set_desc are the callbacks used by the msi_domain_alloc/free_irqs*() variants. yes β€” msi_check is named here in the description even though it's not one of the struct members up above. that's just how the kernel do. πŸ™ˆ

domain_alloc_irqs, domain_free_irqs can be used to override the default allocation/free functions (__msi_domain_alloc/free_irqs). and the lore behind that? it's initially for a wrapper around XEN's separate MSI universe which can't be wrapped into the regular irq domains concepts by mere mortals. 😭 like, mortals literally cannot. this allows you to universally use msi_domain_alloc/free_irqs without having to special case XEN all over the place. we love a clean abstraction, periodt. πŸ’œ

ngl, the "by mere mortals" line is doing a LOT of work here and I respect it deeply. πŸ’…

πŸ‘€ SEE ALSO πŸ‘€


okay that's the whole page, bestie, every last callback accounted for. 🧚

this cutie lives in ./include/linux, stamped October 2026, and the page itself is struct msi_domain_ops(9). go forth and slay your interrupt domain πŸ’–βœ¨

πŸ“¦ where this page comes from