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

Commit b28a099e authored by Neeti Desai's avatar Neeti Desai
Browse files

msm: iommu: Add support for updating mask register for smmu



For some of the smmus's the number of unique stream
ids is more than the number of Stream Mapping
Table entries. The mask field of the SMRn register
needs to updated to handle the correct mapping
behaviour.

Change-Id: I72a2ffe538a6078320c65575d1b007e4114401a4
Signed-off-by: default avatarNeeti Desai <neetid@codeaurora.org>
parent f98fc1b2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ Optional properties:
  the same property except this is for IOMMU with LPAE support.
- qcom,iommu-lpae-bfb-data : See description for qcom,iommu-bfb-data. This is
  the same property except this is for IOMMU with LPAE support.
- qcom,iommu-sid-mask : List of mask values to map the unique stream ids to
  the Stream Mapping Table entries.

Example:

@@ -92,6 +94,7 @@ Example:
			reg = <0xfda6c000 0x1000>;
			interrupts = <0 70 0>;
			qcom,iommu-ctx-sids = <0 2>;
			qcom,iommu-sid-mask = <0 0xf>;
			label = "ctx_0";
		};
		qcom,iommu-ctx@fda6d000 {
+2 −1
Original line number Diff line number Diff line
@@ -653,6 +653,7 @@ static int program_m2v_table(struct device *dev, void __iomem *base)
{
	struct msm_iommu_ctx_drvdata *ctx_drvdata = dev_get_drvdata(dev);
	u32 *sids = ctx_drvdata->sids;
	u32 *sid_mask = ctx_drvdata->sid_mask;
	unsigned int ctx = ctx_drvdata->num;
	int num = 0, i, smt_size;
	int len = ctx_drvdata->nsid;
@@ -666,7 +667,7 @@ static int program_m2v_table(struct device *dev, void __iomem *base)
		BUG_ON(num >= smt_size);

		SET_SMR_VALID(base, num, 1);
		SET_SMR_MASK(base, num, 0);
		SET_SMR_MASK(base, num, sid_mask[i]);
		SET_SMR_ID(base, num, sids[i]);

		SET_S2CR_N(base, num, 0);
+21 −0
Original line number Diff line number Diff line
@@ -491,6 +491,7 @@ static int msm_iommu_ctx_parse_dt(struct platform_device *pdev,
	int irq = 0, ret = 0;
	struct msm_iommu_drvdata *drvdata;
	u32 nsid;
	u32 n_sid_mask;
	unsigned long cb_offset;

	drvdata = dev_get_drvdata(pdev->dev.parent);
@@ -566,6 +567,26 @@ static int msm_iommu_ctx_parse_dt(struct platform_device *pdev,
	ctx_drvdata->nsid = nsid;

	ctx_drvdata->asid = -1;

	if (!of_get_property(pdev->dev.of_node, "qcom,iommu-sid-mask",
						&n_sid_mask)) {
		memset(ctx_drvdata->sid_mask, 0, MAX_NUM_SMR);
		goto out;
	}

	if (n_sid_mask != nsid) {
		ret = -EINVAL;
		goto out;
	}

	if (of_property_read_u32_array(pdev->dev.of_node, "qcom,iommu-sid-mask",
				ctx_drvdata->sid_mask,
				n_sid_mask / sizeof(*ctx_drvdata->sid_mask))) {
		ret = -EINVAL;
		goto out;
	}
	ctx_drvdata->n_sid_mask = n_sid_mask;

out:
	return ret;
}
+2 −0
Original line number Diff line number Diff line
@@ -197,6 +197,8 @@ struct msm_iommu_ctx_drvdata {
	unsigned int secure_context;
	int asid;
	int attach_count;
	u32 sid_mask[MAX_NUM_SMR];
	unsigned int n_sid_mask;
};

enum dump_reg {