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

Commit 7ac121f5 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

iommu/arm-smmu: Mark S1 bypass domains as UNMANAGED domains



Mark IOMMU domains with S1 bypass enabled as UNMANAGED domains.
This prevents the IOMMU framework from allocating and using
unnecessary resources (e.g. IOVA structures) for these domains,
and ensures that the right set of operations are used when
mapping memory for devices that belong to such domains.

Change-Id: Ifd72d16e865e65e6d5605ae81caab416f4aa7bf4
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent d3d6e9be
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -430,6 +430,8 @@ static int arm_smmu_setup_default_domain(struct device *dev,
				struct iommu_domain *domain);
static int __arm_smmu_domain_set_attr(struct iommu_domain *domain,
				    enum iommu_attr attr, void *data);
static int arm_smmu_domain_get_attr(struct iommu_domain *domain,
				    enum iommu_attr attr, void *data);

static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom)
{
@@ -2866,6 +2868,7 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
	struct arm_smmu_device *smmu;
	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
	int atomic_domain = smmu_domain->attributes & (1 << DOMAIN_ATTR_ATOMIC);
	int s1_bypass = 0;

	if (!fwspec || fwspec->ops != &arm_smmu_ops) {
		dev_err(dev, "cannot attach to SMMU, is it on the same bus?\n");
@@ -2894,6 +2897,11 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
	if (ret < 0)
		goto out_power_off;

	ret = arm_smmu_domain_get_attr(domain, DOMAIN_ATTR_S1_BYPASS,
					&s1_bypass);
	if (s1_bypass)
		domain->type = IOMMU_DOMAIN_UNMANAGED;

	/* Do not modify the SIDs, HW is still running */
	if (is_dynamic_domain(domain)) {
		ret = 0;