Skip to content

Commit 0d97174

Browse files
thierryredingwilldeacon
authored andcommitted
iommu/arm-smmu: Implement ->probe_finalize()
Implement a ->probe_finalize() callback that can be used by vendor implementations to perform extra programming necessary after devices have been attached to the SMMU. Signed-off-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20210603164632.1000458-4-thierry.reding@gmail.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 6efb943 commit 0d97174

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

drivers/iommu/arm/arm-smmu/arm-smmu.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,6 +1450,18 @@ static void arm_smmu_release_device(struct device *dev)
14501450
iommu_fwspec_free(dev);
14511451
}
14521452

1453+
static void arm_smmu_probe_finalize(struct device *dev)
1454+
{
1455+
struct arm_smmu_master_cfg *cfg;
1456+
struct arm_smmu_device *smmu;
1457+
1458+
cfg = dev_iommu_priv_get(dev);
1459+
smmu = cfg->smmu;
1460+
1461+
if (smmu->impl->probe_finalize)
1462+
smmu->impl->probe_finalize(smmu, dev);
1463+
}
1464+
14531465
static struct iommu_group *arm_smmu_device_group(struct device *dev)
14541466
{
14551467
struct arm_smmu_master_cfg *cfg = dev_iommu_priv_get(dev);
@@ -1569,6 +1581,7 @@ static struct iommu_ops arm_smmu_ops = {
15691581
.iova_to_phys = arm_smmu_iova_to_phys,
15701582
.probe_device = arm_smmu_probe_device,
15711583
.release_device = arm_smmu_release_device,
1584+
.probe_finalize = arm_smmu_probe_finalize,
15721585
.device_group = arm_smmu_device_group,
15731586
.enable_nesting = arm_smmu_enable_nesting,
15741587
.set_pgtable_quirks = arm_smmu_set_pgtable_quirks,

drivers/iommu/arm/arm-smmu/arm-smmu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ struct arm_smmu_impl {
439439
struct device *dev, int start);
440440
void (*write_s2cr)(struct arm_smmu_device *smmu, int idx);
441441
void (*write_sctlr)(struct arm_smmu_device *smmu, int idx, u32 reg);
442+
void (*probe_finalize)(struct arm_smmu_device *smmu, struct device *dev);
442443
};
443444

444445
#define INVALID_SMENDX -1

0 commit comments

Comments
 (0)