• Julien Grall's avatar
    iommu/dma-iommu: Split iommu_dma_map_msi_msg() in two parts · ece6e6f0
    Julien Grall authored
    On RT, iommu_dma_map_msi_msg() may be called from non-preemptible
    context. This will lead to a splat with CONFIG_DEBUG_ATOMIC_SLEEP as
    the function is using spin_lock (they can sleep on RT).
    
    iommu_dma_map_msi_msg() is used to map the MSI page in the IOMMU PT
    and update the MSI message with the IOVA.
    
    Only the part to lookup for the MSI page requires to be called in
    preemptible context. As the MSI page cannot change over the lifecycle
    of the MSI interrupt, the lookup can be cached and re-used later on.
    
    iomma_dma_map_msi_msg() is now split in two functions:
        - iommu_dma_prepare_msi(): This function will prepare the mapping
        in the IOMMU and store the cookie in the structure msi_desc. This
        function should be called in preemptible context.
        - iommu_dma_compose_msi_msg(): This function will update the MSI
        message with the IOVA when the device is behind an IOMMU.
    Signed-off-by: default avatarJulien Grall <julien.grall@arm.com>
    Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
    Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
    Acked-by: default avatarJoerg Roedel <jroedel@suse.de>
    Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    ece6e6f0
dma-iommu.c 27.2 KB