lkml.org 
[lkml]   [2023]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/4] iommu/dma: Do not init domain if broken_unmanaged_domain
    Date
    Add a sanity of the broken_unmanaged_domain flag to reject the use of
    dma-iommu in the early stage, if the flag is set by the iommu driver.

    Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
    Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
    ---
    drivers/iommu/dma-iommu.c | 3 +++
    1 file changed, 3 insertions(+)

    diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
    index f798c44e0903..f1e8d952b17d 100644
    --- a/drivers/iommu/dma-iommu.c
    +++ b/drivers/iommu/dma-iommu.c
    @@ -545,6 +545,9 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
    if (!cookie || cookie->type != IOMMU_DMA_IOVA_COOKIE)
    return -EINVAL;

    + if (WARN_ON(!device_iommu_unmanaged_supported(dev)))
    + return -EINVAL;
    +
    iovad = &cookie->iovad;

    /* Use the smallest supported page size for IOVA granularity */
    --
    2.39.1
    \
     
     \ /
      Last update: 2023-03-26 23:59    [W:8.122 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site