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

Commit 3c6359a1 authored by Mulu He's avatar Mulu He Committed by Gerrit - the friendly Code Review server
Browse files

coresight: tmc: Add SMMU S1 bypass support



Support configurate smmu bypass mode via dts.

Change-Id: Ia176392338b736c9aa6f826a7d8be0fad5121acf
Signed-off-by: default avatarMulu He <muluhe@codeaurora.org>
parent 89708a1a
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -450,6 +450,7 @@ static DEVICE_ATTR_RW(block_size);
static int tmc_iommu_init(struct tmc_drvdata *drvdata)
static int tmc_iommu_init(struct tmc_drvdata *drvdata)
{
{
	struct device_node *node = drvdata->dev->of_node;
	struct device_node *node = drvdata->dev->of_node;
	int s1_bypass;
	int ret = 0;
	int ret = 0;


	if (!of_property_read_bool(node, "iommus"))
	if (!of_property_read_bool(node, "iommus"))
@@ -463,6 +464,15 @@ static int tmc_iommu_init(struct tmc_drvdata *drvdata)
		goto iommu_map_err;
		goto iommu_map_err;
	}
	}


	s1_bypass = of_property_read_bool(node, "qcom,smmu-s1-bypass");
	ret = iommu_domain_set_attr(drvdata->iommu_mapping->domain,
			DOMAIN_ATTR_S1_BYPASS, &s1_bypass);
	if (ret) {
		dev_err(drvdata->dev, "IOMMU set s1 bypass (%d) failed (%d)\n",
			s1_bypass, ret);
		goto iommu_attach_fail;
	}

	ret = arm_iommu_attach_device(drvdata->dev, drvdata->iommu_mapping);
	ret = arm_iommu_attach_device(drvdata->dev, drvdata->iommu_mapping);
	if (ret) {
	if (ret) {
		dev_err(drvdata->dev, "Attach device failed, err = %d\n", ret);
		dev_err(drvdata->dev, "Attach device failed, err = %d\n", ret);
@@ -474,6 +484,7 @@ static int tmc_iommu_init(struct tmc_drvdata *drvdata)
iommu_attach_fail:
iommu_attach_fail:
	arm_iommu_release_mapping(drvdata->iommu_mapping);
	arm_iommu_release_mapping(drvdata->iommu_mapping);
iommu_map_err:
iommu_map_err:
	drvdata->iommu_mapping = NULL;
	return ret;
	return ret;
}
}