Hi BaoLu,

On Mon,  7 Feb 2022 14:41:41 +0800, Lu Baolu <[email protected]>
wrote:

>  
> -     if (dev && domain_context_mapping(domain, dev)) {
> -             dev_err(dev, "Domain context map failed\n");
> -             dmar_remove_one_dev_info(dev);
> -             return NULL;
> -     }
> +     /* Setup the context entry for device: */
> +     ret = domain_context_mapping(domain, dev);
> +     if (ret)
> +             goto setup_context_err;
>  
> -     return domain;
> +     info->domain = domain;
> +     list_add_rcu(&info->link, &domain->devices);
> +
There seems to be an ordering problem. We need to do list_add_rcu()
*before*  domain_context_mapping(). Otherwise, while doing context mapping
the search for dev IOTLB support in iommu_support_dev_iotlb() will fail.
Then ATS capable device context will not have DTE bit set. The result is
DMAR unrecoverable fault while doing DMA.


Thanks,

Jacob
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to