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

Commit 5c2bfc5a authored by Patrick Daly's avatar Patrick Daly
Browse files

treewide: Rename customized iommu initialization functions



Certain functionality is being deprecatated in favor of a more
upstream friendly approach. Rename the functions to discourage
future users during the phase-out process.

Change-Id: Iac6f2581f43ecda2325e51be6b2d57a049cb960a
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent e55d8c32
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
		reg-names = "core_base";

		iommus = <&apps_smmu 0x0 0x0>;
		qcom,iommu-dma = "disabled";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
+11 −8
Original line number Diff line number Diff line
@@ -32,34 +32,37 @@ struct dma_iommu_mapping {
#ifdef CONFIG_ARM64_DMA_USE_IOMMU

struct dma_iommu_mapping *
arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size);
__depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base,
				size_t size);

void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);
void __depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping);

int arm_iommu_attach_device(struct device *dev,
int __depr_arm_iommu_attach_device(struct device *dev,
					struct dma_iommu_mapping *mapping);
void arm_iommu_detach_device(struct device *dev);
void __depr_arm_iommu_detach_device(struct device *dev);

void arm_iommu_put_dma_cookie(struct iommu_domain *domain);
#else  /* !CONFIG_ARM64_DMA_USE_IOMMU */

static inline struct dma_iommu_mapping *
arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size)
__depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base,
				size_t size)
{
	return NULL;
}

static inline void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping)
static inline void
__depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping)
{
}

static inline int arm_iommu_attach_device(struct device *dev,
static inline int __depr_arm_iommu_attach_device(struct device *dev,
			struct dma_iommu_mapping *mapping)
{
	return -ENODEV;
}

static inline void arm_iommu_detach_device(struct device *dev)
static inline void __depr_arm_iommu_detach_device(struct device *dev)
{
}

+9 −8
Original line number Diff line number Diff line
@@ -1158,7 +1158,8 @@ static void arm_iommu_setup_dma_ops(struct device *dev, u64 dma_base, u64 size)
 * to calling arm_iommu_attach_device() to complete initialization.
 */
struct dma_iommu_mapping *
arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size)
__depr_arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base,
				size_t size)
{
	unsigned int bits = size >> PAGE_SHIFT;
	struct dma_iommu_mapping *mapping;
@@ -1184,7 +1185,7 @@ arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size)
	kfree(mapping);
	return ERR_PTR(-ENOMEM);
}
EXPORT_SYMBOL(arm_iommu_create_mapping);
EXPORT_SYMBOL(__depr_arm_iommu_create_mapping);

/*
 * DEPRECATED
@@ -1194,7 +1195,7 @@ EXPORT_SYMBOL(arm_iommu_create_mapping);
 * Frees all resources associated with the iommu mapping.
 * The device associated with this mapping must be in the 'detached' state
 */
void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping)
void __depr_arm_iommu_release_mapping(struct dma_iommu_mapping *mapping)
{
	if (!mapping)
		return;
@@ -1204,7 +1205,7 @@ void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping)

	kfree(mapping);
}
EXPORT_SYMBOL(arm_iommu_release_mapping);
EXPORT_SYMBOL(__depr_arm_iommu_release_mapping);

/**
 * DEPRECATED
@@ -1219,7 +1220,7 @@ EXPORT_SYMBOL(arm_iommu_release_mapping);
 *
 * Only configures dma_ops for a single device in the iommu_group.
 */
int arm_iommu_attach_device(struct device *dev,
int __depr_arm_iommu_attach_device(struct device *dev,
			    struct dma_iommu_mapping *mapping)
{
	int err;
@@ -1265,7 +1266,7 @@ int arm_iommu_attach_device(struct device *dev,
	pr_debug("Attached IOMMU controller to %s device.\n", dev_name(dev));
	return 0;
}
EXPORT_SYMBOL(arm_iommu_attach_device);
EXPORT_SYMBOL(__depr_arm_iommu_attach_device);

/**
 * DEPRECATED
@@ -1275,7 +1276,7 @@ EXPORT_SYMBOL(arm_iommu_attach_device);
 * Detaches the provided device from a previously attached map.
 * This voids the dma operations (dma_map_ops pointer)
 */
void arm_iommu_detach_device(struct device *dev)
void __depr_arm_iommu_detach_device(struct device *dev)
{
	struct iommu_domain *domain;
	int s1_bypass = 0;
@@ -1307,7 +1308,7 @@ void arm_iommu_detach_device(struct device *dev)

	pr_debug("Detached IOMMU controller from %s device.\n", dev_name(dev));
}
EXPORT_SYMBOL(arm_iommu_detach_device);
EXPORT_SYMBOL(__depr_arm_iommu_detach_device);

#else /*!CONFIG_ARM64_DMA_USE_IOMMU */

+6 −5
Original line number Diff line number Diff line
@@ -457,7 +457,7 @@ static int tmc_iommu_init(struct tmc_drvdata *drvdata)
	if (!of_property_read_bool(node, "iommus"))
		return 0;

	drvdata->iommu_mapping = arm_iommu_create_mapping(&amba_bustype,
	drvdata->iommu_mapping = __depr_arm_iommu_create_mapping(&amba_bustype,
							0, (SZ_1G * 4ULL));
	if (IS_ERR_OR_NULL(drvdata->iommu_mapping)) {
		dev_err(drvdata->dev, "Create mapping failed, err = %d\n", ret);
@@ -474,7 +474,8 @@ static int tmc_iommu_init(struct tmc_drvdata *drvdata)
		goto iommu_attach_fail;
	}

	ret = arm_iommu_attach_device(drvdata->dev, drvdata->iommu_mapping);
	ret = __depr_arm_iommu_attach_device(drvdata->dev,
					     drvdata->iommu_mapping);
	if (ret) {
		dev_err(drvdata->dev, "Attach device failed, err = %d\n", ret);
		goto iommu_attach_fail;
@@ -483,7 +484,7 @@ static int tmc_iommu_init(struct tmc_drvdata *drvdata)
	return ret;

iommu_attach_fail:
	arm_iommu_release_mapping(drvdata->iommu_mapping);
	__depr_arm_iommu_release_mapping(drvdata->iommu_mapping);
iommu_map_err:
	drvdata->iommu_mapping = NULL;
	return ret;
@@ -494,8 +495,8 @@ static void tmc_iommu_deinit(struct tmc_drvdata *drvdata)
	if (!drvdata->iommu_mapping)
		return;

	arm_iommu_detach_device(drvdata->dev);
	arm_iommu_release_mapping(drvdata->iommu_mapping);
	__depr_arm_iommu_detach_device(drvdata->dev);
	__depr_arm_iommu_release_mapping(drvdata->iommu_mapping);

	drvdata->iommu_mapping = NULL;
}
+10 −10
Original line number Diff line number Diff line
@@ -2372,7 +2372,7 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc)
		clk_disable_unprepare(mdwc->sleep_clk);

		if (mdwc->iommu_map) {
			arm_iommu_detach_device(mdwc->dev);
			__depr_arm_iommu_detach_device(mdwc->dev);
			dev_dbg(mdwc->dev, "IOMMU detached\n");
		}
	}
@@ -2518,7 +2518,7 @@ static int dwc3_msm_resume(struct dwc3_msm *mdwc)
		u32 tmp;

		if (mdwc->iommu_map) {
			ret = arm_iommu_attach_device(mdwc->dev,
			ret = __depr_arm_iommu_attach_device(mdwc->dev,
					mdwc->iommu_map);
			if (ret)
				dev_err(mdwc->dev, "IOMMU attach failed (%d)\n",
@@ -3091,7 +3091,7 @@ static int dwc3_msm_init_iommu(struct dwc3_msm *mdwc)
	if (!of_property_read_bool(node, "iommus"))
		return 0;

	mdwc->iommu_map = arm_iommu_create_mapping(&platform_bus_type,
	mdwc->iommu_map = __depr_arm_iommu_create_mapping(&platform_bus_type,
			SMMU_BASE, SMMU_SIZE);
	if (IS_ERR_OR_NULL(mdwc->iommu_map)) {
		ret = PTR_ERR(mdwc->iommu_map) ?: -ENODEV;
@@ -3118,7 +3118,7 @@ static int dwc3_msm_init_iommu(struct dwc3_msm *mdwc)
		goto release_mapping;
	}

	ret = arm_iommu_attach_device(mdwc->dev, mdwc->iommu_map);
	ret = __depr_arm_iommu_attach_device(mdwc->dev, mdwc->iommu_map);
	if (ret) {
		dev_err(mdwc->dev, "IOMMU attach failed (%d)\n", ret);
		goto release_mapping;
@@ -3128,7 +3128,7 @@ static int dwc3_msm_init_iommu(struct dwc3_msm *mdwc)
	return 0;

release_mapping:
	arm_iommu_release_mapping(mdwc->iommu_map);
	__depr_arm_iommu_release_mapping(mdwc->iommu_map);
	mdwc->iommu_map = NULL;
	return ret;
}
@@ -3555,7 +3555,7 @@ static int dwc3_msm_probe(struct platform_device *pdev)

	/* IOMMU will be reattached upon each resume/connect */
	if (mdwc->iommu_map)
		arm_iommu_detach_device(mdwc->dev);
		__depr_arm_iommu_detach_device(mdwc->dev);

	/*
	 * Clocks and regulators will not be turned on until the first time
@@ -3606,8 +3606,8 @@ static int dwc3_msm_probe(struct platform_device *pdev)

uninit_iommu:
	if (mdwc->iommu_map) {
		arm_iommu_detach_device(mdwc->dev);
		arm_iommu_release_mapping(mdwc->iommu_map);
		__depr_arm_iommu_detach_device(mdwc->dev);
		__depr_arm_iommu_release_mapping(mdwc->iommu_map);
	}
	of_platform_depopulate(&pdev->dev);
err:
@@ -3687,8 +3687,8 @@ static int dwc3_msm_remove(struct platform_device *pdev)

	if (mdwc->iommu_map) {
		if (!atomic_read(&dwc->in_lpm))
			arm_iommu_detach_device(mdwc->dev);
		arm_iommu_release_mapping(mdwc->iommu_map);
			__depr_arm_iommu_detach_device(mdwc->dev);
		__depr_arm_iommu_release_mapping(mdwc->iommu_map);
	}

	return 0;