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

Commit 84af7c67 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

iommu/arm-smmu: Add support for implementation specific removal



Certain SMMU implementations may need to follow certain
procedures prior to having their devices removed, so
add support for implementation specific removals.

Also, migrate the QSMMUV500 device removal function to utilize
the newly added implementation specific removal hook. This makes
it so that there are no users of the device_remove() hook in the
arm_smmu_arch_ops structure, so remove it.

Change-Id: I6143fee5744ebec2090e74337f6fce99e23c5cf0
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent f715a4c1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -852,7 +852,6 @@ static int qsmmuv500_cfg_probe(struct arm_smmu_device *smmu)

struct arm_smmu_arch_ops qsmmuv500_arch_ops = {
	.device_group = qsmmuv500_device_group,
	.device_remove = qsmmuv500_device_remove,
};

static const struct arm_smmu_impl qsmmuv500_impl = {
@@ -860,6 +859,7 @@ static const struct arm_smmu_impl qsmmuv500_impl = {
	.init_context_bank = qsmmuv500_init_cb,
	.iova_to_phys_hard = qsmmuv500_iova_to_phys_hard,
	.tlb_sync_timeout = qsmmuv500_tlb_sync_timeout,
	.device_remove = qsmmuv500_device_remove,
};

struct arm_smmu_device *qsmmuv500_impl_init(struct arm_smmu_device *smmu)
+2 −10
Original line number Diff line number Diff line
@@ -363,15 +363,6 @@ static int arm_smmu_arch_device_group(struct device *dev,
	return smmu->arch_ops->device_group(dev, group);
}

static void arm_smmu_arch_device_remove(struct arm_smmu_device *smmu)
{
	if (!smmu->arch_ops)
		return;
	if (!smmu->arch_ops->device_remove)
		return;
	return smmu->arch_ops->device_remove(smmu);
}

static void arm_smmu_arch_write_sync(struct arm_smmu_device *smmu)
{
	u32 id;
@@ -4815,7 +4806,8 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
	arm_smmu_bus_init(NULL);
	iommu_device_unregister(&smmu->iommu);

	arm_smmu_arch_device_remove(smmu);
	if (smmu->impl && smmu->impl->device_remove)
		smmu->impl->device_remove(smmu);

	idr_destroy(&smmu->asid_idr);

+1 −5
Original line number Diff line number Diff line
@@ -508,6 +508,7 @@ struct arm_smmu_impl {
					 dma_addr_t iova,
					 unsigned long trans_flags);
	void (*tlb_sync_timeout)(struct arm_smmu_device *smmu);
	void (*device_remove)(struct arm_smmu_device *smmu);
};

static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n)
@@ -574,14 +575,9 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page,
/*
 * device_group()
 * Hook for checking whether a device is compatible with a said group.
 *
 * device_remove()
 * Hook for performing architecture-specific procedures prior to powering off
 * the SMMU.
 */
struct arm_smmu_arch_ops {
	int (*device_group)(struct device *dev, struct iommu_group *group);
	void (*device_remove)(struct arm_smmu_device *smmu);
};

struct arm_smmu_device *arm_smmu_impl_init(struct arm_smmu_device *smmu);