[RFC PATCH v2 31/32] iommu: Allow replacing restored domain
From: Samiullah Khawaja
Date: Tue Dec 02 2025 - 18:10:44 EST
Allow replacing the restore domain with a new domain after liveupdate as
the restored domain is going to be replaced and not used for anything.
Signed-off-by: Samiullah Khawaja <skhawaja@xxxxxxxxxx>
---
drivers/iommu/iommu.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index ad47597baa04..b3cda7d044ee 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -2290,9 +2290,12 @@ static bool domain_iommu_ops_compatible(const struct iommu_ops *ops,
static int __iommu_attach_group(struct iommu_domain *domain,
struct iommu_group *group)
{
+ bool allow_replace = false;
struct device *dev;
- if (group->domain && group->domain != group->default_domain &&
+ allow_replace = group->domain && iommu_domain_restored_state(group->domain);
+ if (!allow_replace && group->domain &&
+ group->domain != group->default_domain &&
group->domain != group->blocking_domain)
return -EBUSY;
--
2.52.0.158.g65b55ccf14-goog