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

Commit 24edad3d authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

iommu/arm-smmu: Remove DOMAIN_ATTR_DEBUG



DOMAIN_ATTR_DEBUG is queried by the qsmmuv500_iova_to_phys()
function, which will move outside of arm-smmu.c, requiring
arm_smmu_domain_get_attr() to be exposed, which doesn't make
sense for only one attribute.

Thus, remove this domain attribute and inform the SMMU driver
that it is operating on a debug domain by introducing a new
marker in the msm_iommu_domain for debug domains. This patch
has no functional impact.

Change-Id: I86dfbadab0a74f9018acc602eea28b2a3a2c38b5
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent b5f2204f
Loading
Loading
Loading
Loading
+2 −19
Original line number Diff line number Diff line
@@ -3526,11 +3526,6 @@ static int arm_smmu_domain_get_attr(struct iommu_domain *domain,
					  smmu_domain->attributes);
		ret = 0;
		break;
	case DOMAIN_ATTR_DEBUG:
		*((int *)data) = test_bit(DOMAIN_ATTR_DEBUG,
					  smmu_domain->attributes);
		ret = 0;
		break;
	default:
		ret = -ENODEV;
		break;
@@ -3765,16 +3760,6 @@ static int __arm_smmu_domain_set_attr2(struct iommu_domain *domain,
		}
		break;
	}
	case DOMAIN_ATTR_DEBUG: {
		int is_debug_domain = *((int *)data);

		if (is_debug_domain)
			set_bit(DOMAIN_ATTR_DEBUG, smmu_domain->attributes);
		else
			clear_bit(DOMAIN_ATTR_DEBUG, smmu_domain->attributes);
		ret = 0;
		break;
	}
	default:
		ret = -ENODEV;
	}
@@ -5595,19 +5580,17 @@ static phys_addr_t qsmmuv500_iova_to_phys_hard(
{
	u16 sid;
	struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
	struct msm_iommu_domain *msm_domain = to_msm_iommu_domain(domain);
	struct arm_smmu_cfg *cfg = &smmu_domain->cfg;
	struct arm_smmu_device *smmu = smmu_domain->smmu;
	struct iommu_fwspec *fwspec;
	u32 frsynra;
	int is_debug_domain;

	arm_smmu_domain_get_attr(domain, DOMAIN_ATTR_DEBUG, &is_debug_domain);

	/* Check to see if the domain is associated with the test
	 * device. If the domain belongs to the test device, then
	 * pick the SID from fwspec.
	 */
	if (is_debug_domain) {
	if (msm_domain->is_debug_domain) {
		fwspec = dev_iommu_fwspec_get(smmu_domain->dev);
		sid    = (u16)fwspec->ids[0];
	} else {
+4 −2
Original line number Diff line number Diff line
@@ -209,8 +209,6 @@ static int iommu_debug_set_attrs(struct iommu_debug_device *ddev,
		iommu_domain_set_attr(domain,
			DOMAIN_ATTR_SECURE_VMID, &attrs->vmid);

	iommu_domain_set_attr(domain, DOMAIN_ATTR_DEBUG, &val);

	return 0;
}

@@ -237,6 +235,7 @@ static int iommu_debug_dma_reconfigure(struct iommu_debug_device *ddev,

	const struct iommu_ops *iommu;
	struct iommu_domain *domain;
	struct msm_iommu_domain *msm_domain;
	struct device *dev = ddev->dev;
	int is_fast;
	bool coherent;
@@ -276,6 +275,9 @@ static int iommu_debug_dma_reconfigure(struct iommu_debug_device *ddev,
		return -EINVAL;
	}

	msm_domain = to_msm_iommu_domain(domain);
	msm_domain->is_debug_domain = true;

	if (iommu_debug_set_attrs(ddev, domain, attrs)) {
		dev_err_ratelimited(dev, "Setting attrs failed\n");
		goto out_free_domain;
+2 −2
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ struct iommu_domain {

struct msm_iommu_domain {
	char name[IOMMU_DOMAIN_NAME_LEN];
	bool is_debug_domain;
	struct iommu_domain iommu_domain;
};

@@ -178,8 +179,7 @@ enum iommu_attr {
#define DOMAIN_ATTR_CB_STALL_DISABLE		(EXTENDED_ATTR_BASE + 16)
#define DOMAIN_ATTR_USE_LLC_NWA			(EXTENDED_ATTR_BASE + 17)
#define DOMAIN_ATTR_NO_CFRE			(EXTENDED_ATTR_BASE + 18)
#define DOMAIN_ATTR_DEBUG			(EXTENDED_ATTR_BASE + 19)
#define DOMAIN_ATTR_EXTENDED_MAX		(EXTENDED_ATTR_BASE + 20)
#define DOMAIN_ATTR_EXTENDED_MAX		(EXTENDED_ATTR_BASE + 19)

/* These are the possible reserved region types */
enum iommu_resv_type {