genirq/msi: Provide optional translation op
authorThomas Gleixner <tglx@linutronix.de>
Sat, 27 Jan 2024 16:17:35 +0000 (21:47 +0530)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 15 Feb 2024 16:55:40 +0000 (17:55 +0100)
commit9c78c1a85c04bdfbccc5a50588e001087d942b08
tree012927a0a843a18c204740df1d69ffcf0f697cfc
parent1a4671ff7a903e87e4e76213e200bb8bcfa942e4
genirq/msi: Provide optional translation op

irq_create_fwspec_mapping() requires translation of the firmware spec to a
hardware interrupt number and the trigger type information.

Wired interrupts which are connected to a wire to MSI bridge, like MBIGEN
are allocated that way. So far MBIGEN provides a regular irqdomain which
then hooks backwards into the MSI infrastructure. That's an unholy mess and
will be replaced with per device MSI domains which are regular MSI domains.

Interrupts on MSI domains are not supported by irq_create_fwspec_mapping(),
but for making the wire to MSI bridges sane it makes sense to provide a
special allocation/free interface in the MSI infrastructure. That avoids
the backdoors into the core MSI allocation code and just shares all the
regular MSI infrastructure.

Provide an optional translation callback in msi_domain_ops which can be
utilized by these wire to MSI bridges. No other MSI domain should provide a
translation callback. The default translation callback of the MSI
irqdomains will warn when it is invoked on a non-prepared MSI domain.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240127161753.114685-8-apatel@ventanamicro.com
include/linux/msi.h
kernel/irq/msi.c