Skip to content

Commit a8e5f04

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu/io-pgtable: Remove non-strict quirk
IO_PGTABLE_QUIRK_NON_STRICT was never a very comfortable fit, since it's not a quirk of the pagetable format itself. Now that we have a more appropriate way to convey non-strict unmaps, though, this last of the non-quirk quirks can also go, and with the flush queue code also now enforcing its own ordering we can have a lovely cleanup all round. Signed-off-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/155b5c621cd8936472e273a8b07a182f62c6c20d.1628682049.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent 7a7c5ba commit a8e5f04

File tree

5 files changed

+4
-31
lines changed

5 files changed

+4
-31
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,9 +2174,6 @@ static int arm_smmu_domain_finalise(struct iommu_domain *domain,
21742174
.iommu_dev = smmu->dev,
21752175
};
21762176

2177-
if (!iommu_get_dma_strict(domain))
2178-
pgtbl_cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT;
2179-
21802177
pgtbl_ops = alloc_io_pgtable_ops(fmt, &pgtbl_cfg, smmu_domain);
21812178
if (!pgtbl_ops)
21822179
return -ENOMEM;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,9 +765,6 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain,
765765
.iommu_dev = smmu->dev,
766766
};
767767

768-
if (!iommu_get_dma_strict(domain))
769-
pgtbl_cfg.quirks |= IO_PGTABLE_QUIRK_NON_STRICT;
770-
771768
if (smmu->impl && smmu->impl->init_context) {
772769
ret = smmu->impl->init_context(smmu_domain, &pgtbl_cfg, dev);
773770
if (ret)

drivers/iommu/io-pgtable-arm-v7s.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -700,14 +700,7 @@ static size_t __arm_v7s_unmap(struct arm_v7s_io_pgtable *data,
700700
ARM_V7S_BLOCK_SIZE(lvl + 1));
701701
ptep = iopte_deref(pte[i], lvl, data);
702702
__arm_v7s_free_table(ptep, lvl + 1, data);
703-
} else if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT) {
704-
/*
705-
* Order the PTE update against queueing the IOVA, to
706-
* guarantee that a flush callback from a different CPU
707-
* has observed it before the TLBIALL can be issued.
708-
*/
709-
smp_wmb();
710-
} else {
703+
} else if (!gather->queued) {
711704
io_pgtable_tlb_add_page(iop, gather, iova, blk_size);
712705
}
713706
iova += blk_size;
@@ -791,8 +784,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
791784

792785
if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_NS |
793786
IO_PGTABLE_QUIRK_NO_PERMS |
794-
IO_PGTABLE_QUIRK_ARM_MTK_EXT |
795-
IO_PGTABLE_QUIRK_NON_STRICT))
787+
IO_PGTABLE_QUIRK_ARM_MTK_EXT))
796788
return NULL;
797789

798790
/* If ARM_MTK_4GB is enabled, the NO_PERMS is also expected. */

drivers/iommu/io-pgtable-arm.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -638,14 +638,7 @@ static size_t __arm_lpae_unmap(struct arm_lpae_io_pgtable *data,
638638
io_pgtable_tlb_flush_walk(iop, iova + i * size, size,
639639
ARM_LPAE_GRANULE(data));
640640
__arm_lpae_free_pgtable(data, lvl + 1, iopte_deref(pte, data));
641-
} else if (iop->cfg.quirks & IO_PGTABLE_QUIRK_NON_STRICT) {
642-
/*
643-
* Order the PTE update against queueing the IOVA, to
644-
* guarantee that a flush callback from a different CPU
645-
* has observed it before the TLBIALL can be issued.
646-
*/
647-
smp_wmb();
648-
} else {
641+
} else if (!gather->queued) {
649642
io_pgtable_tlb_add_page(iop, gather, iova + i * size, size);
650643
}
651644

@@ -825,7 +818,6 @@ arm_64_lpae_alloc_pgtable_s1(struct io_pgtable_cfg *cfg, void *cookie)
825818
bool tg1;
826819

827820
if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_NS |
828-
IO_PGTABLE_QUIRK_NON_STRICT |
829821
IO_PGTABLE_QUIRK_ARM_TTBR1 |
830822
IO_PGTABLE_QUIRK_ARM_OUTER_WBWA))
831823
return NULL;
@@ -929,7 +921,7 @@ arm_64_lpae_alloc_pgtable_s2(struct io_pgtable_cfg *cfg, void *cookie)
929921
typeof(&cfg->arm_lpae_s2_cfg.vtcr) vtcr = &cfg->arm_lpae_s2_cfg.vtcr;
930922

931923
/* The NS quirk doesn't apply at stage 2 */
932-
if (cfg->quirks & ~(IO_PGTABLE_QUIRK_NON_STRICT))
924+
if (cfg->quirks)
933925
return NULL;
934926

935927
data = arm_lpae_alloc_pgtable(cfg);

include/linux/io-pgtable.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ struct io_pgtable_cfg {
7373
* to support up to 35 bits PA where the bit32, bit33 and bit34 are
7474
* encoded in the bit9, bit4 and bit5 of the PTE respectively.
7575
*
76-
* IO_PGTABLE_QUIRK_NON_STRICT: Skip issuing synchronous leaf TLBIs
77-
* on unmap, for DMA domains using the flush queue mechanism for
78-
* delayed invalidation.
79-
*
8076
* IO_PGTABLE_QUIRK_ARM_TTBR1: (ARM LPAE format) Configure the table
8177
* for use in the upper half of a split address space.
8278
*
@@ -86,7 +82,6 @@ struct io_pgtable_cfg {
8682
#define IO_PGTABLE_QUIRK_ARM_NS BIT(0)
8783
#define IO_PGTABLE_QUIRK_NO_PERMS BIT(1)
8884
#define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3)
89-
#define IO_PGTABLE_QUIRK_NON_STRICT BIT(4)
9085
#define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5)
9186
#define IO_PGTABLE_QUIRK_ARM_OUTER_WBWA BIT(6)
9287
unsigned long quirks;

0 commit comments

Comments
 (0)