This is V2 of the third part of the effort to provide support for per device MSI interrupt domains. Version 1 of this part can be found here: https://lore.kernel.org/all/20221111133158.196269823@xxxxxxxxxxxxx This is based on the second part which is available here: https://lore.kernel.org/all/20221121083210.309161925@xxxxxxxxxxxxx and from git: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git devmsi-v2-part2 This third part is available from git too: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git devmsi-v2-part3 This part provides the actual per device domain implementation and related functionality: 1) Provide infrastructure to create and remove per device MSI domains 2) Implement per device MSI domains in the PCI/MSI code and make them conditional on the availability of a suitable parent MSI domain. This allows to convert the existing domains one by one and keeps both the legacy and the current "global" PCI/MSI domain model working. 3) Convert the related x86 MSI domains over (vector and remapping). 4) Provide core infrastructure for dynamic allocations 5) Provide PCI/MSI-X interfaces for device drivers to do post MSI-X enable allocation/free 6) Enable dynamic allocation support on the x86 MSI parent domains 7) Provide infrastructure to create PCI/IMS domains 8) Enable IMS support on the x86 MSI parent domains 9) Provide a driver for IDXD which demonstrates how IMS domains look like. Changes vs. v1: - Clarified argument names for the init callback (Jason) - Split the domain and instance data and named them accordingly - Fixed the recursive allocation issue and the missing index offset (Reinette) - Updated changelogs and comments (Bjorn, Jason) - Fixed the kernel robot fallout from randconfig builds - Picked up Reviewed/Acked-by tags where appropriate Thanks, tglx --- arch/x86/include/asm/irq_remapping.h | 4 arch/x86/include/asm/msi.h | 6 arch/x86/include/asm/pci.h | 1 arch/x86/kernel/apic/msi.c | 208 +++++++++------ drivers/iommu/amd/amd_iommu_types.h | 1 drivers/iommu/amd/iommu.c | 23 + drivers/iommu/intel/iommu.h | 1 drivers/iommu/intel/irq_remapping.c | 31 +- drivers/irqchip/Kconfig | 7 drivers/irqchip/Makefile | 1 drivers/irqchip/irq-pci-intel-idxd.c | 143 ++++++++++ drivers/pci/msi/api.c | 117 ++++++++ drivers/pci/msi/irqdomain.c | 278 ++++++++++++++++++-- drivers/pci/msi/msi.c | 192 ++++++++------ drivers/pci/msi/msi.h | 4 include/linux/irqchip/irq-pci-intel-idxd.h | 22 + include/linux/irqdomain.h | 9 include/linux/irqdomain_defs.h | 5 include/linux/msi.h | 149 +++++++++- include/linux/msi_api.h | 38 ++ include/linux/pci.h | 14 + kernel/irq/msi.c | 394 +++++++++++++++++++++++++++-- 22 files changed, 1395 insertions(+), 253 deletions(-)