Skip to content

Commit cf39047

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu: Remove iommu_ops pgsize_bitmap from simple drivers
These drivers just have a constant value for their page size, move it into their domain_alloc_paging function before setting up the geometry. Reviewed-by: Kevin Tian <[email protected]> Acked-by: Niklas Schnelle <[email protected]> # for s390-iommu.c Signed-off-by: Jason Gunthorpe <[email protected]> Acked-by: Marek Szyprowski <[email protected]> # for exynos-iommu.c Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Acked-by: Thierry Reding <[email protected]> Acked-by: Chen-Yu Tsai <[email protected]> # sun50i-iommu.c Tested-by: Nicolin Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 8901812 commit cf39047

File tree

9 files changed

+17
-10
lines changed

9 files changed

+17
-10
lines changed

drivers/iommu/exynos-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ static struct iommu_domain *exynos_iommu_domain_alloc_paging(struct device *dev)
925925
spin_lock_init(&domain->pgtablelock);
926926
INIT_LIST_HEAD(&domain->clients);
927927

928+
domain->domain.pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE;
929+
928930
domain->domain.geometry.aperture_start = 0;
929931
domain->domain.geometry.aperture_end = ~0UL;
930932
domain->domain.geometry.force_aperture = true;
@@ -1477,7 +1479,6 @@ static const struct iommu_ops exynos_iommu_ops = {
14771479
.device_group = generic_device_group,
14781480
.probe_device = exynos_iommu_probe_device,
14791481
.release_device = exynos_iommu_release_device,
1480-
.pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE,
14811482
.of_xlate = exynos_iommu_of_xlate,
14821483
.default_domain_ops = &(const struct iommu_domain_ops) {
14831484
.attach_dev = exynos_iommu_attach_device,

drivers/iommu/ipmmu-vmsa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ static int ipmmu_domain_init_context(struct ipmmu_vmsa_domain *domain)
430430
* non-secure mode.
431431
*/
432432
domain->cfg.quirks = IO_PGTABLE_QUIRK_ARM_NS;
433-
domain->cfg.pgsize_bitmap = SZ_1G | SZ_2M | SZ_4K;
433+
domain->cfg.pgsize_bitmap = domain->io_domain.pgsize_bitmap;
434434
domain->cfg.ias = 32;
435435
domain->cfg.oas = 40;
436436
domain->cfg.tlb = &ipmmu_flush_ops;
@@ -571,6 +571,7 @@ static struct iommu_domain *ipmmu_domain_alloc_paging(struct device *dev)
571571
return NULL;
572572

573573
mutex_init(&domain->mutex);
574+
domain->io_domain.pgsize_bitmap = SZ_1G | SZ_2M | SZ_4K;
574575

575576
return &domain->io_domain;
576577
}
@@ -882,7 +883,6 @@ static const struct iommu_ops ipmmu_ops = {
882883
*/
883884
.device_group = IS_ENABLED(CONFIG_ARM) && !IS_ENABLED(CONFIG_IOMMU_DMA)
884885
? generic_device_group : generic_single_device_group,
885-
.pgsize_bitmap = SZ_1G | SZ_2M | SZ_4K,
886886
.of_xlate = ipmmu_of_xlate,
887887
.default_domain_ops = &(const struct iommu_domain_ops) {
888888
.attach_dev = ipmmu_attach_device,

drivers/iommu/mtk_iommu_v1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ static struct iommu_domain *mtk_iommu_v1_domain_alloc_paging(struct device *dev)
288288
if (!dom)
289289
return NULL;
290290

291+
dom->domain.pgsize_bitmap = MT2701_IOMMU_PAGE_SIZE;
292+
291293
return &dom->domain;
292294
}
293295

@@ -582,7 +584,6 @@ static const struct iommu_ops mtk_iommu_v1_ops = {
582584
.probe_finalize = mtk_iommu_v1_probe_finalize,
583585
.release_device = mtk_iommu_v1_release_device,
584586
.device_group = generic_device_group,
585-
.pgsize_bitmap = MT2701_IOMMU_PAGE_SIZE,
586587
.owner = THIS_MODULE,
587588
.default_domain_ops = &(const struct iommu_domain_ops) {
588589
.attach_dev = mtk_iommu_v1_attach_device,

drivers/iommu/omap-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,8 @@ static struct iommu_domain *omap_iommu_domain_alloc_paging(struct device *dev)
15841584

15851585
spin_lock_init(&omap_domain->lock);
15861586

1587+
omap_domain->domain.pgsize_bitmap = OMAP_IOMMU_PGSIZES;
1588+
15871589
omap_domain->domain.geometry.aperture_start = 0;
15881590
omap_domain->domain.geometry.aperture_end = (1ULL << 32) - 1;
15891591
omap_domain->domain.geometry.force_aperture = true;
@@ -1735,7 +1737,6 @@ static const struct iommu_ops omap_iommu_ops = {
17351737
.release_device = omap_iommu_release_device,
17361738
.device_group = generic_single_device_group,
17371739
.of_xlate = omap_iommu_of_xlate,
1738-
.pgsize_bitmap = OMAP_IOMMU_PGSIZES,
17391740
.default_domain_ops = &(const struct iommu_domain_ops) {
17401741
.attach_dev = omap_iommu_attach_dev,
17411742
.map_pages = omap_iommu_map,

drivers/iommu/rockchip-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,8 @@ static struct iommu_domain *rk_iommu_domain_alloc_paging(struct device *dev)
10811081
spin_lock_init(&rk_domain->dt_lock);
10821082
INIT_LIST_HEAD(&rk_domain->iommus);
10831083

1084+
rk_domain->domain.pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP;
1085+
10841086
rk_domain->domain.geometry.aperture_start = 0;
10851087
rk_domain->domain.geometry.aperture_end = DMA_BIT_MASK(32);
10861088
rk_domain->domain.geometry.force_aperture = true;
@@ -1171,7 +1173,6 @@ static const struct iommu_ops rk_iommu_ops = {
11711173
.probe_device = rk_iommu_probe_device,
11721174
.release_device = rk_iommu_release_device,
11731175
.device_group = generic_single_device_group,
1174-
.pgsize_bitmap = RK_IOMMU_PGSIZE_BITMAP,
11751176
.of_xlate = rk_iommu_of_xlate,
11761177
.default_domain_ops = &(const struct iommu_domain_ops) {
11771178
.attach_dev = rk_iommu_attach_device,

drivers/iommu/s390-iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ static struct iommu_domain *s390_domain_alloc_paging(struct device *dev)
557557
}
558558
zdev->end_dma = zdev->start_dma + aperture_size - 1;
559559

560+
s390_domain->domain.pgsize_bitmap = SZ_4K;
560561
s390_domain->domain.geometry.force_aperture = true;
561562
s390_domain->domain.geometry.aperture_start = 0;
562563
s390_domain->domain.geometry.aperture_end = max_tbl_size(s390_domain);
@@ -1158,7 +1159,6 @@ static struct iommu_domain blocking_domain = {
11581159
.domain_alloc_paging = s390_domain_alloc_paging, \
11591160
.probe_device = s390_iommu_probe_device, \
11601161
.device_group = generic_device_group, \
1161-
.pgsize_bitmap = SZ_4K, \
11621162
.get_resv_regions = s390_iommu_get_resv_regions, \
11631163
.default_domain_ops = &(const struct iommu_domain_ops) { \
11641164
.attach_dev = s390_iommu_attach_device, \

drivers/iommu/sprd-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ static struct iommu_domain *sprd_iommu_domain_alloc_paging(struct device *dev)
143143

144144
spin_lock_init(&dom->pgtlock);
145145

146+
dom->domain.pgsize_bitmap = SPRD_IOMMU_PAGE_SIZE;
147+
146148
dom->domain.geometry.aperture_start = 0;
147149
dom->domain.geometry.aperture_end = SZ_256M - 1;
148150
dom->domain.geometry.force_aperture = true;
@@ -410,7 +412,6 @@ static const struct iommu_ops sprd_iommu_ops = {
410412
.probe_device = sprd_iommu_probe_device,
411413
.device_group = generic_single_device_group,
412414
.of_xlate = sprd_iommu_of_xlate,
413-
.pgsize_bitmap = SPRD_IOMMU_PAGE_SIZE,
414415
.owner = THIS_MODULE,
415416
.default_domain_ops = &(const struct iommu_domain_ops) {
416417
.attach_dev = sprd_iommu_attach_device,

drivers/iommu/sun50i-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ sun50i_iommu_domain_alloc_paging(struct device *dev)
697697

698698
refcount_set(&sun50i_domain->refcnt, 1);
699699

700+
sun50i_domain->domain.pgsize_bitmap = SZ_4K;
701+
700702
sun50i_domain->domain.geometry.aperture_start = 0;
701703
sun50i_domain->domain.geometry.aperture_end = DMA_BIT_MASK(32);
702704
sun50i_domain->domain.geometry.force_aperture = true;
@@ -842,7 +844,6 @@ static int sun50i_iommu_of_xlate(struct device *dev,
842844

843845
static const struct iommu_ops sun50i_iommu_ops = {
844846
.identity_domain = &sun50i_iommu_identity_domain,
845-
.pgsize_bitmap = SZ_4K,
846847
.device_group = generic_single_device_group,
847848
.domain_alloc_paging = sun50i_iommu_domain_alloc_paging,
848849
.of_xlate = sun50i_iommu_of_xlate,

drivers/iommu/tegra-smmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ static struct iommu_domain *tegra_smmu_domain_alloc_paging(struct device *dev)
318318

319319
spin_lock_init(&as->lock);
320320

321+
as->domain.pgsize_bitmap = SZ_4K;
322+
321323
/* setup aperture */
322324
as->domain.geometry.aperture_start = 0;
323325
as->domain.geometry.aperture_end = 0xffffffff;
@@ -1002,7 +1004,6 @@ static const struct iommu_ops tegra_smmu_ops = {
10021004
.probe_device = tegra_smmu_probe_device,
10031005
.device_group = tegra_smmu_device_group,
10041006
.of_xlate = tegra_smmu_of_xlate,
1005-
.pgsize_bitmap = SZ_4K,
10061007
.default_domain_ops = &(const struct iommu_domain_ops) {
10071008
.attach_dev = tegra_smmu_attach_dev,
10081009
.map_pages = tegra_smmu_map,

0 commit comments

Comments
 (0)