iommu: Fix deferred domain attachment in iommu_probe_device()
Subsystems (2)
PATCH 1/1 iommu: Fix deferred domain attachment in iommu_probe_device()
The IOMMU core has support for deferring the attachment of default domain to device. Fix a missed deferred attaching check in iommu_probe_device().
--- drivers/iommu/iommu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iommu/iommu.c +4 -1
@@ -93,6 +93,8 @@ static void __iommu_detach_group(struct iommu_domain *domain,static int iommu_create_device_direct_mappings (struct iommu_group *group,struct device *dev);static struct iommu_group *iommu_group_get_for_dev (struct device *dev); +static bool iommu_is_attach_deferred (struct iommu_domain *domain, +struct device *dev);#define IOMMU_GROUP_ATTR (_name, _mode, _show, _store) \ struct iommu_group_attribute iommu_group_attr_##_name = \
@@ -264,7 +266,8 @@ int iommu_probe_device(struct device *dev)*/ iommu_alloc_default_domain (group, dev); -if (group->default_domain) +if (group->default_domain && + !iommu_is_attach_deferred (group->default_domain, dev)) ret =__iommu_attach_device (group->default_domain, dev);iommu_create_device_direct_mappings (group, dev);
Signature · 1 line
2.17.1
Joerg Roedel
maintainerHi Baolu,
drivers/iommu/iommu.c int iommu_probe_device(struct device *dev) · line 271
Quoted 8 lines · Lu Baolu
drivers/iommu/iommu.c +2
-1@@ -264,7 +266,8 @@ int iommu_probe_device(struct device *dev)*/ iommu_alloc_default_domain (group, dev); -if (group->default_domain) +if (group->default_domain && + !iommu_is_attach_deferred (group->default_domain, dev)) ret =__iommu_attach_device (group->default_domain, dev);
This is the hotplug path, not used for boot-initialization. Have you seen failures from the missing check here?
Regards,
Joerg
Hi Joerg,
Quoted 7 lines · Joerg Roedel
Hi Baolu,
Quoted 4 lines · Lu Baolu
drivers/iommu/iommu.c +0
-0@@ -264,7 +266,8 @@ int iommu_probe_device(struct device *dev)*/ iommu_alloc_default_domain (group, dev);
Quoted 7 lines
drivers/iommu/iommu.c int iommu_probe_device(struct device *dev) · line 271
Quoted 4 lines
drivers/iommu/iommu.c +2
-1-if (group->default_domain) +if (group->default_domain && + !iommu_is_attach_deferred (group->default_domain, dev)) ret =__iommu_attach_device (group->default_domain, dev);This is the hotplug path, not used for boot-initialization. Have you seen failures from the missing check here?
I haven't seen any failure. Just wondered why deferred attaching was not checked here. It's fine to me if it's only for hotplug path.
Please ignore this change.
Best regards,
baolu