Re: [PATCH 1/5] iommu/vt-d: Add attach_deferred() helper

From: Christoph Hellwig
Date: Tue Feb 18 2020 - 12:15:03 EST


> +static bool attach_deferred(struct device *dev)
> +{
> + return dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO;
> +}

This is not a very useful helper.

> +
> /**
> * is_downstream_to_pci_bridge - test if a device belongs to the PCI
> * sub-hierarchy of a candidate PCI-PCI bridge
> @@ -2510,8 +2515,7 @@ struct dmar_domain *find_domain(struct device *dev)
> {
> struct device_domain_info *info;
>
> - if (unlikely(dev->archdata.iommu == DEFER_DEVICE_DOMAIN_INFO ||
> - dev->archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO))
> + if (unlikely(attach_deferred(dev) || iommu_dummy(dev)))
> return NULL;

I'd rather kill the iommu_dummy helper as well. And IIRC I have an
outstanding series somewhere that does just that..