msi_create_d...e_irq_domain(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ 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 downstream
  • template β€” the MSI domain info bundle used as a template πŸŽ€
  • hwsize β€” maximum number of MSI table entries β€” and heads up, pass 0 if it's unknown or unlimited 🫑
  • domain_data β€” optional pointer to domain specific data, which gets set in msi_domain_info::data
  • chip_data β€” optional pointer to chip specific data, which gets set in msi_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 via msi_parent_ops::prefix. If that pointer is NULL the prefix is empty (so, no prefix, she's bare-faced and still gorgeous).
  • $CHIPNAME β€” the name of the irq_chip in template
  • $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