STRUCT MSI_DOMAIN_OPS(9)
π 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 ofmsi_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 π
- Kernel file
./include/linux/msi.hβ and then the whole extended universe: struct msi_msg(9)struct pci_msi_desc(9)union msi_domain_cookie(9)struct msi_desc_data(9)struct msi_desc(9)struct msi_dev_domain(9)msi_first_desc(9)msi_domain_for_each_desc(9)msi_for_each_desc(9)msi_msg_set_addr(9)msi_insert_msi_desc(9)msi_free_msi_descs_range(9)msi_free_msi_descs(9)struct msi_domain_info(9)struct msi_domain_template(9)struct msi_parent_ops(9)
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
- 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