Hi Joerg,

On 12/20/18 10:08 AM, Joerg Roedel wrote:
> From: Joerg Roedel <[email protected]>
> 
> This check needs to be there and got lost at some point
> during development. Add it again.
> 
> Fixes: 641fb0efbff0 ('iommu/of: Don't call iommu_ops->add_device directly')
I experience a regression with those 2 patches. I have virtio-pci device
protected by virtual smmuv3 and in that case I get err = -EPROBE_DEFER
after pci_for_each_dma_alias() in of_iommu_configure(). When
iommu_probe_device is called, ops = NULL so it returns -EINVAL and err
is overwritten. So there is no deferred probing while it happened before.

Thanks

Eric
> Reported-by: Marek Szyprowski <[email protected]>
> Reported-by: kernelci.org bot <[email protected]>
> Signed-off-by: Joerg Roedel <[email protected]>
> ---
>  drivers/iommu/iommu.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index a2131751dcff..3ed4db334341 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -114,10 +114,14 @@ void iommu_device_unregister(struct iommu_device *iommu)
>  int iommu_probe_device(struct device *dev)
>  {
>       const struct iommu_ops *ops = dev->bus->iommu_ops;
> +     int ret = -EINVAL;
>  
>       WARN_ON(dev->iommu_group);
>  
> -     return ops->add_device(dev);
> +     if (ops)
> +             ret = ops->add_device(dev);
> +
> +     return ret;
>  }
>  
>  void iommu_release_device(struct device *dev)
> 
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to