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

Commit aa7f0f8f authored by Mitchel Humpherys's avatar Mitchel Humpherys Committed by Matt Wagantall
Browse files

Revert "iommu/arm-smmu: Add support for page table donation"



This reverts commit e6e701ddb09b2b6b43ffc7ff788701eda03703b8.  This code
is about to be ripped out in favor of the generic io-pgtable code, so
leaving it in will only cause merged conflicts.

Don't revert the introduction of the DOMAIN_ATTR_SECURE_VMID attribute
to avoid unnecessary churn in client code.

Change-Id: I58af07686f11b14a82d44bd7999ba50127530f1f
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
parent 73c608f2
Loading
Loading
Loading
Loading
+2 −45
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@

#include <linux/amba/bus.h>
#include <soc/qcom/msm_tz_smmu.h>
#include <soc/qcom/secure_buffer.h>
#include <linux/msm_pcie.h>

#include <asm/pgalloc.h>
@@ -488,7 +487,6 @@ struct arm_smmu_domain {
	struct arm_smmu_cfg		cfg;
	struct mutex			lock;
	u32				attributes;
	int				secure_vmid;
};

static DEFINE_SPINLOCK(arm_smmu_devices_lock);
@@ -1260,18 +1258,6 @@ static void arm_smmu_destroy_domain_context(struct iommu_domain *domain)
	smmu_domain->smmu = NULL;
}

static int arm_smmu_assign_call(phys_addr_t addr, u64 size, int dest_vmid)
{
	int dest_vmids[2] = {VMID_HLOS, dest_vmid};
	int dest_perms[2] = {PERM_READ | PERM_WRITE, PERM_READ};

	if (dest_vmid == VMID_INVAL)
		return 0;

	return hyp_assign_phys(addr, size,
			dest_vmids, dest_perms, 2);
}

static int arm_smmu_domain_init(struct iommu_domain *domain)
{
	struct arm_smmu_domain *smmu_domain;
@@ -1290,7 +1276,6 @@ static int arm_smmu_domain_init(struct iommu_domain *domain)
	if (!pgd)
		goto out_free_domain;
	smmu_domain->cfg.pgd = pgd;
	smmu_domain->secure_vmid = VMID_INVAL;

	mutex_init(&smmu_domain->lock);
	domain->priv = smmu_domain;
@@ -1544,12 +1529,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
	} else {
		arm_smmu_enable_clocks(smmu);
	}
	ret = arm_smmu_assign_call(virt_to_phys(smmu_domain->cfg.pgd),
					PAGE_SIZE, smmu_domain->secure_vmid);
	if (ret) {
		mutex_unlock(&smmu->attach_lock);
		goto err_disable_clocks;
	}
	mutex_unlock(&smmu->attach_lock);

	/*
@@ -1663,7 +1642,6 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_domain *smmu_domain,
{
	pte_t *pte, *start;
	pteval_t pteval = ARM_SMMU_PTE_PAGE | ARM_SMMU_PTE_AF | ARM_SMMU_PTE_XN;
	int ret;

	if (pmd_none(*pmd)) {
		/* Allocate a new set of tables */
@@ -1676,12 +1654,6 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_domain *smmu_domain,
				PAGE_SIZE);
		pmd_populate(NULL, pmd, table);
		arm_smmu_flush_pgtable(smmu_domain, pmd, sizeof(*pmd));
		ret = arm_smmu_assign_call(virt_to_phys(page_address(table)),
					PAGE_SIZE, smmu_domain->secure_vmid);
		if (ret) {
			free_page((unsigned long)table);
			return ret;
		}
	}

	if (stage == 1) {
@@ -1792,12 +1764,7 @@ static int arm_smmu_alloc_init_pmd(struct arm_smmu_domain *smmu_domain,
		arm_smmu_flush_pgtable(smmu_domain, pmd, PAGE_SIZE);
		pud_populate(NULL, pud, pmd);
		arm_smmu_flush_pgtable(smmu_domain, pud, sizeof(*pud));
		ret = arm_smmu_assign_call(virt_to_phys(pmd), PAGE_SIZE,
						smmu_domain->secure_vmid);
		if (ret) {
			free_page((unsigned long)pmd);
			return ret;
		}

		pmd += pmd_index(addr);
	} else
#endif
@@ -1832,12 +1799,7 @@ static int arm_smmu_alloc_init_pud(struct arm_smmu_domain *smmu_domain,
		arm_smmu_flush_pgtable(smmu_domain, pud, PAGE_SIZE);
		pgd_populate(NULL, pgd, pud);
		arm_smmu_flush_pgtable(smmu_domain, pgd, sizeof(*pgd));
		ret = arm_smmu_assign_call(virt_to_phys(pud), PAGE_SIZE,
						smmu_domain->secure_vmid);
		if (ret) {
			free_page((unsigned long)pud);
			return ret;
		}

		pud += pud_index(addr);
	} else
#endif
@@ -2255,11 +2217,6 @@ static int arm_smmu_domain_set_attr(struct iommu_domain *domain,
				~(1 << DOMAIN_ATTR_COHERENT_HTW_DISABLE);
		return 0;
	}
	case DOMAIN_ATTR_SECURE_VMID:
	{
		smmu_domain->secure_vmid = *((int *)data);
		return 0;
	}
	default:
		return -ENODEV;
	}