]> asedeno.scripts.mit.edu Git - linux.git/commit
iommu/dma-iommu: Split iommu_dma_map_msi_msg() in two parts
authorJulien Grall <julien.grall@arm.com>
Wed, 1 May 2019 13:58:19 +0000 (14:58 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Fri, 3 May 2019 14:19:46 +0000 (15:19 +0100)
commitece6e6f0218b7777e650bf93728130ae6f4feb7d
tree40260544d7b400f04aa5f89df961c55aac8ac96e
parentaaebdf8d68479f78d9f72b239684f70fbb0722c6
iommu/dma-iommu: Split iommu_dma_map_msi_msg() in two parts

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: Julien Grall <julien.grall@arm.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Acked-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/iommu/Kconfig
drivers/iommu/dma-iommu.c
include/linux/dma-iommu.h