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

Commit 8e9d3d41 authored by Vipin Deep Kaur's avatar Vipin Deep Kaur
Browse files

slimbus: slim-msm: Add support to enable IOMMU in atomic context



Add support to enable iommu in atomic context for slimbus driver.

Change-Id: Iaf202ac1be1df62b999e2fe9652cc5b94e2b9719
Signed-off-by: default avatarVipin Deep Kaur <vkaur@codeaurora.org>
parent fccbfd18
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ Optional property:
		 can be resumed after subsytem restart. By default slimbus driver
		 register with ADSP subsystem.
 - qcom,iommu-s1-bypass: Boolean flag to bypass IOMMU stage 1 translation.
 - qcom,iommu-atomic-ctx: Boolean flag to enable IOMMU in atomic context

Optional subnodes:
qcom,iommu_slim_ctrl_cb : Child node representing the Slimbus controller
+3 −0
Original line number Diff line number Diff line
@@ -1881,6 +1881,9 @@ static int ngd_slim_probe(struct platform_device *pdev)
		dev->iommu_desc.s1_bypass = of_property_read_bool(
							pdev->dev.of_node,
							"qcom,iommu-s1-bypass");
		dev->iommu_desc.atomic_ctx = of_property_read_bool(
							pdev->dev.of_node,
							"qcom,iommu-atomic-ctx");
		ret = of_platform_populate(pdev->dev.of_node, ngd_slim_dt_match,
					   NULL, &pdev->dev);
		if (ret) {
+12 −10
Original line number Diff line number Diff line
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -173,7 +173,7 @@ static int msm_slim_iommu_attach(struct msm_slim_ctrl *ctrl_dev)
	struct dma_iommu_mapping *iommu_map;
	dma_addr_t va_start = MSM_SLIM_VA_START;
	size_t va_size = MSM_SLIM_VA_SIZE;
	int bypass = 1;
	int bypass = 1, atomic_ctx = 1;
	struct device *dev;

	if (unlikely(!ctrl_dev))
@@ -197,15 +197,17 @@ static int msm_slim_iommu_attach(struct msm_slim_ctrl *ctrl_dev)
		return PTR_ERR(iommu_map);
	}

	if (ctrl_dev->iommu_desc.s1_bypass) {
		if (iommu_domain_set_attr(iommu_map->domain,
					DOMAIN_ATTR_S1_BYPASS, &bypass)) {
			dev_err(dev, "%s Can't bypass s1 translation\n",
	if ((ctrl_dev->iommu_desc.s1_bypass &&
			iommu_domain_set_attr(iommu_map->domain,
				DOMAIN_ATTR_S1_BYPASS, &bypass)) ||
		(ctrl_dev->iommu_desc.atomic_ctx &&
			iommu_domain_set_attr(iommu_map->domain,
				DOMAIN_ATTR_ATOMIC, &atomic_ctx))) {
		dev_err(dev, "%s Can't set IOMMU attribute\n",
			__func__);
		arm_iommu_release_mapping(iommu_map);
		return -EIO;
	}
	}

	if (arm_iommu_attach_device(dev, iommu_map)) {
		dev_err(dev, "%s can't arm_iommu_attach_device\n", __func__);
+1 −0
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ struct msm_slim_iommu {
	struct device			*cb_dev;
	struct dma_iommu_mapping	*iommu_map;
	bool				s1_bypass;
	bool				atomic_ctx;
};

struct msm_slim_ctrl {