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

Commit fd61811d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iommu: arm-smmu: Fix dynamic domain context bank assignment"

parents 31ded8db e72526bb
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -3311,14 +3311,23 @@ static int arm_smmu_alloc_cb(struct iommu_domain *domain,
				struct device *dev)
{
	struct iommu_fwspec *fwspec = dev->iommu_fwspec;
	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
	u32 i, idx;
	int cb = -EINVAL;
	bool dynamic;

	/* Dynamic domains must set cbndx through domain attribute */
	/*
	 * Dynamic domains have already set cbndx through domain attribute.
	 * Verify that they picked a valid value.
	 */
	dynamic = is_dynamic_domain(domain);
	if (dynamic)
		return INVALID_CBNDX;
	if (dynamic) {
		cb = smmu_domain->cfg.cbndx;
		if (cb < smmu->num_context_banks)
			return cb;
		else
			return -EINVAL;
	}

	mutex_lock(&smmu->stream_map_mutex);
	for_each_cfg_sme(fwspec, i, idx) {