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

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

iommu/arm-smmu: Support DOMAIN_ATTR_S1_BYPASS



Certain configurations may require nested translation, but may
want to avoid software performance limitation on map/unmap
operations.

Change-Id: I6653b3b6ceb071283fb5a8e07257c496e99dd1f3
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent bb82f963
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -1044,7 +1044,11 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain,
	}

	/* SCTLR */
	reg = SCTLR_CFCFG | SCTLR_CFIE | SCTLR_CFRE | SCTLR_M | SCTLR_EAE_SBOP;
	reg = SCTLR_CFCFG | SCTLR_CFIE | SCTLR_CFRE | SCTLR_EAE_SBOP;

	if (!(smmu_domain->attributes & (1 << DOMAIN_ATTR_S1_BYPASS)) ||
	    !stage1)
		reg |= SCTLR_M;
	if (stage1)
		reg |= SCTLR_S1_ASIDPNE;
#ifdef __BIG_ENDIAN
@@ -1883,6 +1887,11 @@ static int arm_smmu_domain_get_attr(struct iommu_domain *domain,
				    & (1 << DOMAIN_ATTR_NON_FATAL_FAULTS));
		ret = 0;
		break;
	case DOMAIN_ATTR_S1_BYPASS:
		*((int *)data) = !!(smmu_domain->attributes
				    & (1 << DOMAIN_ATTR_S1_BYPASS));
		ret = 0;
		break;
	default:
		return -ENODEV;
	}
@@ -1965,6 +1974,23 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
		ret = 0;
		break;
	}
	case DOMAIN_ATTR_S1_BYPASS: {
		int bypass = *((int *)data);

		/* bypass can't be changed while attached */
		if (smmu_domain->smmu != NULL) {
			ret = -EBUSY;
			break;
		}
		if (bypass)
			smmu_domain->attributes |= 1 << DOMAIN_ATTR_S1_BYPASS;
		else
			smmu_domain->attributes &=
					~(1 << DOMAIN_ATTR_S1_BYPASS);

		ret = 0;
		break;
	}
	default:
		ret = -ENODEV;
	}