msi_create_d...e_irq_domain(9)
π NAME π
msi_create_device_irq_domain β bestie, this is the one that creates a device MSI interrupt domain β¨
So real quick, this page lives in the Kernel API Manual under the title msi_create_d...e_irq_domain(9) (yes the title got squished, it's the truncated-looking version, she's still iconic π
).
πΈ SYNOPSIS πΈ
bool msi_create_device_irq_domain (struct device *dev , unsigned int
domid , const struct msi_domain_template *template , unsigned int hwsize
, void *domain_data , void *chip_data );
That's a bool return, no cap. Six args, all of them matter, okurrr π«Ά
π ARGUMENTS π
devβ pointer to the device, the main character of this whole operation πdomidβ the domain id, literally the key to everything downstreamtemplateβ the MSI domain info bundle used as a template πhwsizeβ maximum number of MSI table entries β and heads up, pass0if it's unknown or unlimited π«‘domain_dataβ optional pointer to domain specific data, which gets set inmsi_domain_info::datachip_dataβ optional pointer to chip specific data, which gets set inmsi_domain_info::chip_data
β RETURN β
True on success, false otherwise. Simple. Slay. π
π DESCRIPTION π
Okay so the tea here π: there is no firmware node required for this interface. Why? Because the per device domains are software constructs which are actually closer to the hardware reality than any firmware can describe them. Periodt. Like, firmware could never.
The domain name and the irq chip name for a MSI device domain are composed by this formula, exactly:
"$(PREFIX)$(CHIPNAME)-$(DEVNAME)"
Let's break down the cast π:
$PREFIXβ optional prefix provided by the underlying MSI parent domain viamsi_parent_ops::prefix. If that pointer isNULLthe prefix is empty (so, no prefix, she's bare-faced and still gorgeous).$CHIPNAMEβ the name of theirq_chipintemplate$DEVNAMEβ the name of the device
The way this results in understandable chip names and hardware interrupt numbers in e.g. /proc/interrupts β obsessed ππ₯ Look:
PCI-MSI-0000:00:1c.0 0-edge Parent domain has no prefix
IR-PCI-MSI-0000:00:1c.4 0-edge Same with interrupt remapping prefix 'IR-'
IR-PCI-MSIX-0000:3d:00.0 0-edge Hardware interrupt numbers reflect
IR-PCI-MSIX-0000:3d:00.0 1-edge the real MSI-X index on that device
IR-PCI-MSIX-0000:3d:00.0 2-edge
See how the numbers actually make sense? Gorgeous. πΈ
On IMS domains the hardware interrupt number is either a table entry index or a purely software managed index β but ngl the important part is that it is guaranteed to be unique π.
Heads up bestie: the domain pointer is stored in dev::msi::data::__irqdomains[]. All subsequent operations on the domain depend on the domain id. Like, all of them. So keep track of that id fr fr π
And the comfy part β the domain is automatically freed when the device is removed via devres in the context of dev::msi::data freeing. But you can also independently remove it via msi_remove_device_irq_domain if you're feeling independent β¨
π¦ SEE ALSO π¦
Kernel file ./kernel/irq/msi.c plus this whole group chat of friends: struct msi_device_data(9), struct msi_ctrl(9), msi_alloc_desc(9), msi_domain_insert_msi_desc(9), msi_domain_free_msi_descs_range(9), msi_domain_add_simple_msi_descs(9), msi_setup_device_data(9), __msi_lock_descs(9), __msi_unlock_descs(9), msi_domain_first_desc(9), msi_next_desc(9), msi_domain_get_virq(9), msi_device_populate_sysfs(9), msi_device_destroy_sysfs(9), msi_domain_set_affinity(9), msi_create_irq_domain(9), msi_create_parent_irq_domain(9), msi_parent_init_dev_msi_info(9), msi_remove_device_irq_domain(9), msi_match_device_irq_domain(9), msi_domain_alloc_irqs_range_locked(9), msi_domain_alloc_irqs_range(9), msi_domain_alloc_irqs_all_locked(9), msi_domain_alloc_irq_at(9), msi_device_domain_alloc_wired(9), msi_domain_free_irqs_range_locked(9), msi_domain_free_irqs_range(9), msi_domain_free_irqs_all_locked(9), msi_domain_free_irqs_all(9), msi_device_domain_free_wired(9), msi_get_domain_info(9), msi_device_has_isolated_msi(9)
π§ And that's the whole page! Signing off from ./kernel/irq β sourced from the Kernel API Manual, dated October 2026. Love u, go create some domains responsibly πβ¨π
π¦ 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