• Thomas Gleixner's avatar
    genirq/msi: Add pointers for per device irq domains · 64258eaa
    Thomas Gleixner authored
    With the upcoming per device MSI interrupt domain support it is necessary
    to store the domain pointers per device.
    
    Instead of delegating that storage to device drivers or subsystems add a
    domain pointer to the msi_dev_domain array in struct msi_device_data.
    
    This pointer is also used to take care of tearing down the irq domains when
    msi_device_data is cleaned up via devres.
    
    The interfaces into the MSI core will be changed from irqdomain pointer
    based interfaces to domain id based interfaces to support multiple MSI
    domains on a single device (e.g. PCI/MSI[-X] and PCI/IMS.
    
    Once the per device domain support is complete the irq domain pointer in
    struct device::msi.domain will not longer contain a pointer to the "global"
    MSI domain. It will contain a pointer to the MSI parent domain instead.
    
    It would be a horrible maze of conditionals to evaluate all over the place
    which domain pointer should be used, i.e. the "global" one in
    device::msi::domain or one from the internal pointer array.
    
    To avoid this evaluate in msi_setup_device_data() whether the irq domain
    which is associated to a device is a "global" or a parent MSI domain. If it
    is global then copy the pointer into the first entry of the msi_dev_domain
    array.
    
    This allows to convert interfaces and implementation to domain ids while
    keeping everything existing working.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Reviewed-by: default avatarKevin Tian <kevin.tian@intel.com>
    Acked-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20221124230313.923860399@linutronix.de
    64258eaa
msi.c 28.5 KB