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

Commit 9d277f45 authored by Tarun Karra's avatar Tarun Karra
Browse files

msm: kgsl: Dont attach pagetable for unused iommu contextbank



IOMMU driver assumes context bank 2 to be secured, if for some
reason we are not able to create secure pagetable we will try
to attach unsecured pagetable to secure context bank, this
causes a device crash. Fix it by not attaching a pagetable to
secure context bank if secure pagetable does not exist.

Change-Id: I5bd150e5f53ea7e33d230af5dc4caf997625193f
Signed-off-by: default avatarTarun Karra <tkarra@codeaurora.org>
parent a2b0f946
Loading
Loading
Loading
Loading
+17 −6
Original line number Diff line number Diff line
@@ -789,12 +789,20 @@ static int kgsl_attach_pagetable_iommu_domain(struct kgsl_mmu *mmu)
			 * If there is a 2nd default pagetable then priv domain
			 * is attached to this pagetable
			 */
			if (mmu->priv_bank_table &&
					(KGSL_IOMMU_CONTEXT_PRIV == j))
			if (KGSL_IOMMU_CONTEXT_PRIV == j) {
				if (mmu->priv_bank_table)
					iommu_pt = mmu->priv_bank_table->priv;
			if (mmu->securepagetable &&
					(KGSL_IOMMU_CONTEXT_SECURE == j))
				else
					continue;
			}

			if (KGSL_IOMMU_CONTEXT_SECURE == j) {
				if (mmu->securepagetable)
					iommu_pt = mmu->securepagetable->priv;
				else
					continue;
			}

			if (!iommu_unit->dev[j].attached) {
				ret = iommu_attach_device(iommu_pt->domain,
							iommu_unit->dev[j].dev);
@@ -1620,6 +1628,9 @@ static int kgsl_iommu_start(struct kgsl_mmu *mmu)
		struct kgsl_iommu_unit *iommu_unit = &iommu->iommu_units[i];
		for (j = 0; j < iommu_unit->dev_count; j++) {

			if (!iommu_unit->dev[j].attached)
				continue;

			/*
			 * For IOMMU V1 do not halt IOMMU on pagefault if
			 * FT pagefault policy is set accordingly