This series implements the MSI address mapping/unmapping in the MSI layer.IOMMU binding happens on pci_enable_msi since this function can sleep andreturn errors. On msi_domain_set_affinity, msi_domain_(de)activate, whichare not allowed to sleep, we simply look for the already existing binding.

A new MSI domain info flag value is introduced to report whether the msidomain implements IRQ remapping. GIC v3 ITS is the first MSI controlleradvertising it. This flag value will be used by VFIO subsystem todetermine whether MSI forwarding is safe.

v7 -> v8:take into account Marc's comments:- use iommu_msi_msg_pa_to_va with new proto- change in irq_chip_msi_doorbell_info struct definition: prot and size became shared between all doorbells and phys_addr_t __percpu- cleanups in v2m irqchip- eventually did not touch MSI_FLAG_IRQ_REMAPPING naming- On msi_handle_doorbell_mappings, stop on the first irqchip where doorbells can be found- fix resource deallocation on mapping failure in msi_domain_alloc_irqs

v6 -> v7:- do alloc/map handling on pci_enable_msi and search on msi_(de)domain_activate- add msi_doorbell_info callback in irq-chip to retrieve the characteristics of doorbells

RFC v3 -> v4:- Move doorbell mapping/unmapping in msi.c- fix ref count issue on set_affinity: in case of a change in the address the previous address is decremented- doorbell map/unmap now is done on msi composition. Should allow the use case for platform MSI controllers- create dma-reserved-iommu.h/c exposing/implementing a new API dedicated to reserved IOVA management (looking like dma-iommu glue)- series reordering to ease the review: - first part is related to IOMMU - second related to MSI sub-system - third related to VFIO (except arm-smmu IOMMU_CAP_INTR_REMAP removal)- expose the number of requested IOVA pages through VFIO_IOMMU_GET_INFO [this partially addresses Marc's comments on iommu_get/put_single_reserved size/alignment problematic - which I did not ignore - but I don't know how much I can do at the moment]

PATCH v1 -> RFC v2:- reverted to RFC since it looks more reasonable ;-) the code is split between VFIO, IOMMU, MSI controller and I am not sure I did the right choices. Also API need to be further discussed.- iova API usage in arm-smmu.c.- MSI controller natively programs the MSI addr with either the PA or IOVA. This is not done anymore in vfio-pci driver as suggested by Alex.- check irq remapping capability of the group

RFC v1 [2] -> PATCH v1:- use the existing dma map/unmap ioctl interface with a flag to register a reserved IOVA range. Use the legacy Rb to store this special vfio_dma.- a single reserved IOVA contiguous region now is allowed- use of an RB tree indexed by PA to store allocated reserved slots- use of a vfio_domain iova_domain to manage iova allocation within the window provided by the userspace- vfio alloc_map/unmap_free take a vfio_group handle- vfio_group handle is cached in vfio_pci_device- add ref counting to bindings- user modality enabled at the end of the series