Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd330bd4 authored by Patrick Daly's avatar Patrick Daly
Browse files

iommu: Modify default_domain treatment in attach/detach



Do not treat the default domain as special when attaching
or detaching.

Change-Id: I13763fb0eff7ef807e84879d469815cba9789c06
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent a7229c6d
Loading
Loading
Loading
Loading
+8 −21
Original line number Diff line number Diff line
@@ -1450,9 +1450,6 @@ static int __iommu_attach_group(struct iommu_domain *domain,
{
	int ret;

	if (group->default_domain && group->domain != group->default_domain)
		return -EBUSY;

	ret = __iommu_group_for_each_dev(group, domain,
					 iommu_group_do_attach_device);
	if (ret == 0)
@@ -1482,30 +1479,20 @@ static int iommu_group_do_detach_device(struct device *dev, void *data)
	return 0;
}

/*
 * Although upstream implements detaching the default_domain as a noop,
 * the "SID switch" secure usecase require complete removal of SIDS/SMRS
 * from HLOS iommu registers.
 */
static void __iommu_detach_group(struct iommu_domain *domain,
				 struct iommu_group *group)
{
	int ret;

	if (!group->default_domain) {
	__iommu_group_for_each_dev(group, domain,
					   iommu_group_do_detach_device);
	group->domain = NULL;
	return;
}

	if (group->domain == group->default_domain)
		return;

	/* Detach by re-attaching to the default domain */
	ret = __iommu_group_for_each_dev(group, group->default_domain,
					 iommu_group_do_attach_device);
	if (ret != 0)
		WARN_ON(1);
	else
		group->domain = group->default_domain;
}

void iommu_detach_group(struct iommu_domain *domain, struct iommu_group *group)
{
	mutex_lock(&group->mutex);