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

Commit 1189ad27 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres
Browse files

iommu/arm-smmu: Add implementation specific CB initialization hook



Some SMMU implementations, such as the QSMMUV500 model, may
need to program a specific context bank, in addition to the
initial context bank programming. Thus, add support for
implementation specific context bank initialization, and
migrate the QSMMUV500 context bank initialization to use
the new hook.

Consequently, as there are no current users of the
arm_smmu_arch_init_context_bank() hook, remove it.

Change-Id: Ia89420cc8b669a142b37bf4250c09b6aa3646172
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 5b663004
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 = {
	.iova_to_phys_hard = qsmmuv500_iova_to_phys_hard,
	.init_context_bank = qsmmuv500_init_cb,
	.device_group = qsmmuv500_device_group,
	.tlb_sync_timeout = qsmmuv500_tlb_sync_timeout,
	.device_remove = qsmmuv500_device_remove,
@@ -860,6 +859,7 @@ struct arm_smmu_arch_ops qsmmuv500_arch_ops = {

static const struct arm_smmu_impl qsmmuv500_impl = {
	.cfg_probe = qsmmuv500_cfg_probe,
	.init_context_bank = qsmmuv500_init_cb,
};

struct arm_smmu_device *qsmmuv500_impl_init(struct arm_smmu_device *smmu)
+2 −13
Original line number Diff line number Diff line
@@ -350,18 +350,6 @@ static void arm_smmu_interrupt_selftest(struct arm_smmu_device *smmu)
}
#endif

static void arm_smmu_arch_init_context_bank(
		struct arm_smmu_domain *smmu_domain, struct device *dev)
{
	struct arm_smmu_device *smmu = smmu_domain->smmu;

	if (!smmu->arch_ops)
		return;
	if (!smmu->arch_ops->init_context_bank)
		return;
	return smmu->arch_ops->init_context_bank(smmu_domain, dev);
}

static int arm_smmu_arch_device_group(struct device *dev,
					struct iommu_group *group)
{
@@ -1818,7 +1806,8 @@ static int arm_smmu_setup_context_bank(struct arm_smmu_domain *smmu_domain,
		arm_smmu_write_context_bank(smmu, cfg->cbndx,
					    smmu_domain->attributes);

		arm_smmu_arch_init_context_bank(smmu_domain, dev);
		if (smmu->impl && smmu->impl->init_context_bank)
			smmu->impl->init_context_bank(smmu_domain, dev);

		if (smmu->version < ARM_SMMU_V2) {
			cfg->irptndx = atomic_inc_return(&smmu->irptndx);
+2 −6
Original line number Diff line number Diff line
@@ -502,6 +502,8 @@ struct arm_smmu_impl {
	int (*cfg_probe)(struct arm_smmu_device *smmu);
	int (*reset)(struct arm_smmu_device *smmu);
	int (*init_context)(struct arm_smmu_domain *smmu_domain);
	void (*init_context_bank)(struct arm_smmu_domain *smmu_domain,
				  struct device *dev);
};

static inline void __iomem *arm_smmu_page(struct arm_smmu_device *smmu, int n)
@@ -569,10 +571,6 @@ static inline void arm_smmu_writeq(struct arm_smmu_device *smmu, int page,
 * iova_to_phys_hard()
 * Provides debug information. May be called from the context fault irq handler.
 *
 * init_context_bank()
 * Hook for architecture-specific settings which require knowledge of the
 * dynamically allocated context bank number.
 *
 * device_group()
 * Hook for checking whether a device is compatible with a said group.
 *
@@ -590,8 +588,6 @@ struct arm_smmu_arch_ops {
	phys_addr_t (*iova_to_phys_hard)(struct arm_smmu_domain *domain,
					 dma_addr_t iova,
					 unsigned long trans_flags);
	void (*init_context_bank)(struct arm_smmu_domain *smmu_domain,
					struct device *dev);
	int (*device_group)(struct device *dev, struct iommu_group *group);
	void (*tlb_sync_timeout)(struct arm_smmu_device *smmu);
	void (*device_remove)(struct arm_smmu_device *smmu);