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

Commit e3a5c714 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

iommu/arm-smmu: Wire up io-pgtable-fast for domains that request it



An io-pgtable implementation for fast 4K mappings was recently added,
and we've now implemented all of the domain attributes necessary to use
it.  Wire it up.

CRs-Fixed: 997751
Change-Id: I9ddd2dd2cad91ac3d3ccce7c0cd0abb37cd57075
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent d41b13f5
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -1562,6 +1562,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
	enum io_pgtable_fmt fmt;
	struct arm_smmu_domain *smmu_domain = domain->priv;
	struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
	bool is_fast = smmu_domain->attributes & (1 << DOMAIN_ATTR_FAST);

	if (smmu_domain->smmu)
		goto out;
@@ -1658,6 +1659,9 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
		};
	}

	if (is_fast)
		fmt = ARM_V8L_FAST;

	cfg->asid = cfg->cbndx + 1;
	cfg->vmid = cfg->cbndx + 2;
	pgtbl_ops = alloc_io_pgtable_ops(fmt, &smmu_domain->pgtbl_cfg,
@@ -2873,6 +2877,11 @@ static int arm_smmu_domain_get_attr(struct iommu_domain *domain,
				    & (1 << DOMAIN_ATTR_S1_BYPASS));
		ret = 0;
		break;
	case DOMAIN_ATTR_FAST:
		*((int *)data) = !!(smmu_domain->attributes
					& (1 << DOMAIN_ATTR_FAST));
		ret = 0;
		break;
	default:
		ret = -ENODEV;
		break;
@@ -2996,6 +3005,11 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
		ret = 0;
		break;
	}
	case DOMAIN_ATTR_FAST:
		if (*((int *)data))
			smmu_domain->attributes |= 1 << DOMAIN_ATTR_FAST;
		ret = 0;
		break;
	default:
		ret = -ENODEV;
		break;