genirq/msi: Provide allocation/free functions for "wired" MSI interrupts
authorThomas Gleixner <tglx@linutronix.de>
Sat, 27 Jan 2024 16:17:39 +0000 (21:47 +0530)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 15 Feb 2024 16:55:41 +0000 (17:55 +0100)
commit0ee1578b00bcf5ef8e7955f0c6f02a624443eb29
treea4f3fd5140f1fba22976da2a6c8e7f20189c5116
parent9d1c58c8004653b37721dd7b16f4360216778c94
genirq/msi: Provide allocation/free functions for "wired" MSI interrupts

To support wire to MSI bridges proper in the MSI core infrastructure it is
required to have separate allocation/free interfaces which can be invoked
from the regular irqdomain allocaton/free functions.

The mechanism for allocation is:
  - Allocate the next free MSI descriptor index in the domain
  - Store the hardware interrupt number and the trigger type
    which was extracted by the irqdomain core from the firmware spec
    in the MSI descriptor device cookie so it can be retrieved by
    the underlying interrupt domain and interrupt chip
  - Use the regular MSI allocation mechanism for the newly allocated
    index which returns a fully initialized Linux interrupt on succes

This works because:
  - the domains have a fixed size
  - each hardware interrupt is only allocated once
  - the underlying domain does not care about the MSI index it only cares
    about the hardware interrupt number and the trigger type

The free function looks up the MSI index in the MSI descriptor of the
provided Linux interrupt number and uses the regular index based free
functions of the MSI core.

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-12-apatel@ventanamicro.com
include/linux/irqdomain.h
kernel/irq/msi.c