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

Commit d2b425ea authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mdss: fix race condition between iommu attach and sending DCS cmds"

parents 227ab054 dd7ad27e
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -172,6 +172,7 @@ static int mdss_smmu_attach_v2(struct mdss_data_type *mdata)
	struct mdss_smmu_client *mdss_smmu;
	struct mdss_smmu_client *mdss_smmu;
	int i, rc = 0;
	int i, rc = 0;


	mutex_lock(&mdp_iommu_lock);
	for (i = 0; i < MDSS_IOMMU_MAX_DOMAIN; i++) {
	for (i = 0; i < MDSS_IOMMU_MAX_DOMAIN; i++) {
		if (!mdss_smmu_is_valid_domain_type(mdata, i))
		if (!mdss_smmu_is_valid_domain_type(mdata, i))
			continue;
			continue;
@@ -203,9 +204,12 @@ static int mdss_smmu_attach_v2(struct mdss_data_type *mdata)
			}
			}
		} else {
		} else {
			pr_err("iommu device not attached for domain[%d]\n", i);
			pr_err("iommu device not attached for domain[%d]\n", i);
			mutex_unlock(&mdp_iommu_lock);
			return -ENODEV;
			return -ENODEV;
		}
		}
	}
	}
	mutex_unlock(&mdp_iommu_lock);

	return 0;
	return 0;


err:
err:
@@ -217,6 +221,8 @@ err:
			mdss_smmu->domain_attached = false;
			mdss_smmu->domain_attached = false;
		}
		}
	}
	}
	mutex_unlock(&mdp_iommu_lock);

	return rc;
	return rc;
}
}


@@ -231,6 +237,7 @@ static int mdss_smmu_detach_v2(struct mdss_data_type *mdata)
	struct mdss_smmu_client *mdss_smmu;
	struct mdss_smmu_client *mdss_smmu;
	int i;
	int i;


	mutex_lock(&mdp_iommu_lock);
	for (i = 0; i < MDSS_IOMMU_MAX_DOMAIN; i++) {
	for (i = 0; i < MDSS_IOMMU_MAX_DOMAIN; i++) {
		if (!mdss_smmu_is_valid_domain_type(mdata, i))
		if (!mdss_smmu_is_valid_domain_type(mdata, i))
			continue;
			continue;
@@ -239,6 +246,8 @@ static int mdss_smmu_detach_v2(struct mdss_data_type *mdata)
		if (mdss_smmu && mdss_smmu->dev && !mdss_smmu->handoff_pending)
		if (mdss_smmu && mdss_smmu->dev && !mdss_smmu->handoff_pending)
			mdss_smmu_enable_power(mdss_smmu, false);
			mdss_smmu_enable_power(mdss_smmu, false);
	}
	}
	mutex_unlock(&mdp_iommu_lock);

	return 0;
	return 0;
}
}