[PATCH v6 04/17] iommu: Pass in gdev's blocked state to iommu_deinit_device()
Nicolin Chen
nicolinc at nvidia.com
Wed Sep 23 13:11:23 PDT 2026
iommu_deinit_device() parks the device on the driver's release_domain and
passes group->domain to its attach_dev() callback as the old domain. That
is only correct while the device is still attached to group->domain.
A subsequent change keeps a device blocked on group->blocking_domain after
a failed reset, so the old domain has to follow the device's blocked state.
The group_device holding that state is freed by __iommu_group_free_device()
before iommu_deinit_device() runs, so read it at the call site and pass it
in.
No functional change.
Assisted-by: LLM
Signed-off-by: Nicolin Chen <nicolinc at nvidia.com>
---
drivers/iommu/iommu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 379132e2d6cf6..344288e930c40 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -550,7 +550,7 @@ static int iommu_init_device(struct device *dev)
return ret;
}
-static void iommu_deinit_device(struct device *dev)
+static void iommu_deinit_device(struct device *dev, bool blocked)
{
struct iommu_group *group = dev->iommu_group;
const struct iommu_ops *ops = dev_iommu_ops(dev);
@@ -703,7 +703,7 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list
list_del(&gdev->list);
__iommu_group_free_device(group, gdev);
err_put_group:
- iommu_deinit_device(dev);
+ iommu_deinit_device(dev, false);
mutex_unlock(&group->mutex);
iommu_group_put(group);
@@ -759,13 +759,15 @@ static void __iommu_group_remove_device(struct device *dev)
mutex_lock(&group->mutex);
for_each_group_device(group, device) {
+ bool blocked = device->blocked;
+
if (device->dev != dev)
continue;
list_del(&device->list);
__iommu_group_free_device(group, device);
if (dev_has_iommu(dev))
- iommu_deinit_device(dev);
+ iommu_deinit_device(dev, blocked);
else
dev->iommu_group = NULL;
break;
--
2.43.0
More information about the linux-arm-kernel
mailing list