Commit e67df2da authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Jason Zeng
Browse files

Revert "iommu/arm-smmu: Convert to domain_alloc_paging()"

mainline inclusion
from mainline-v6.8-rc6
commit b419c5e2d9787a98c1410dbe1d4a25906b96f000
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I938E2
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b419c5e2d9787a98c1410dbe1d4a25906b96f000



--------------------------------

This reverts commit 9b3febc3a3da ("iommu/arm-smmu: Convert to
domain_alloc_paging()"). It breaks Qualcomm MSM8996 platform. Calling
arm_smmu_write_context_bank() from new codepath results in the platform
being reset because of the unclocked hardware access.

Fixes: 9b3febc3a3da ("iommu/arm-smmu: Convert to domain_alloc_paging()")
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Acked-by: default avatarRobin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20240213-iommu-revert-domain-alloc-v1-1-325ff55dece4@linaro.org


Signed-off-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarJason Zeng <jason.zeng@intel.com>
parent 2568e71d
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -864,10 +864,14 @@ static void arm_smmu_destroy_domain_context(struct arm_smmu_domain *smmu_domain)
	arm_smmu_rpm_put(smmu);
}

static struct iommu_domain *arm_smmu_domain_alloc_paging(struct device *dev)
static struct iommu_domain *arm_smmu_domain_alloc(unsigned type)
{
	struct arm_smmu_domain *smmu_domain;

	if (type != IOMMU_DOMAIN_UNMANAGED) {
		if (using_legacy_binding || type != IOMMU_DOMAIN_DMA)
			return NULL;
	}
	/*
	 * Allocate the domain and initialise some of its data structures.
	 * We can't really do anything meaningful until we've added a
@@ -880,15 +884,6 @@ static struct iommu_domain *arm_smmu_domain_alloc_paging(struct device *dev)
	mutex_init(&smmu_domain->init_mutex);
	spin_lock_init(&smmu_domain->cb_lock);

	if (dev) {
		struct arm_smmu_master_cfg *cfg = dev_iommu_priv_get(dev);

		if (arm_smmu_init_domain_context(smmu_domain, cfg->smmu, dev)) {
			kfree(smmu_domain);
			return NULL;
		}
	}

	return &smmu_domain->domain;
}

@@ -1623,7 +1618,7 @@ static struct iommu_ops arm_smmu_ops = {
	.identity_domain	= &arm_smmu_identity_domain,
	.blocked_domain		= &arm_smmu_blocked_domain,
	.capable		= arm_smmu_capable,
	.domain_alloc_paging	= arm_smmu_domain_alloc_paging,
	.domain_alloc		= arm_smmu_domain_alloc,
	.probe_device		= arm_smmu_probe_device,
	.release_device		= arm_smmu_release_device,
	.probe_finalize		= arm_smmu_probe_finalize,