* [PATCH 1/2] iommu/msm: Hook up iotlb_sync_map
@ 2021-01-27 16:29 Robin Murphy
2021-01-27 16:29 ` [PATCH 2/2] iommu/io-pgtable: Remove TLBI_ON_MAP quirk Robin Murphy
2021-01-28 21:07 ` [PATCH 1/2] iommu/msm: Hook up iotlb_sync_map Will Deacon
0 siblings, 2 replies; 3+ messages in thread
From: Robin Murphy @ 2021-01-27 16:29 UTC (permalink / raw)
To: will
Cc: joro, iommu, linux-arm-kernel, linux-arm-msm, sricharan, architt,
srinivas.kandagatla, bjorn.andersson
The core API can now accommodate invalidate-on-map style behaviour in a
single efficient call, so hook that up instead of having io-pgatble do
it piecemeal.
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
Just a little quick cleanup on top of the Mediatek TLB patches now
queued - CC'ing a bunch of folks from the Git history in the hope that
someone can still test MSM... :)
drivers/iommu/msm_iommu.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c
index 040e85f70861..f0ba6a09b434 100644
--- a/drivers/iommu/msm_iommu.c
+++ b/drivers/iommu/msm_iommu.c
@@ -343,7 +343,6 @@ static int msm_iommu_domain_config(struct msm_priv *priv)
spin_lock_init(&priv->pgtlock);
priv->cfg = (struct io_pgtable_cfg) {
- .quirks = IO_PGTABLE_QUIRK_TLBI_ON_MAP,
.pgsize_bitmap = msm_iommu_ops.pgsize_bitmap,
.ias = 32,
.oas = 32,
@@ -490,6 +489,14 @@ static int msm_iommu_map(struct iommu_domain *domain, unsigned long iova,
return ret;
}
+static void msm_iommu_sync_map(struct iommu_domain *domain, unsigned long iova,
+ size_t size)
+{
+ struct msm_priv *priv = to_msm_priv(domain);
+
+ __flush_iotlb_range(iova, size, SZ_4K, false, priv);
+}
+
static size_t msm_iommu_unmap(struct iommu_domain *domain, unsigned long iova,
size_t len, struct iommu_iotlb_gather *gather)
{
@@ -680,6 +687,7 @@ static struct iommu_ops msm_iommu_ops = {
* kick starting the other master.
*/
.iotlb_sync = NULL,
+ .iotlb_sync_map = msm_iommu_sync_map,
.iova_to_phys = msm_iommu_iova_to_phys,
.probe_device = msm_iommu_probe_device,
.release_device = msm_iommu_release_device,
base-commit: 0954d61a59e3c014e52b8d938bc12dc5a2e4949c
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] iommu/io-pgtable: Remove TLBI_ON_MAP quirk
2021-01-27 16:29 [PATCH 1/2] iommu/msm: Hook up iotlb_sync_map Robin Murphy
@ 2021-01-27 16:29 ` Robin Murphy
2021-01-28 21:07 ` [PATCH 1/2] iommu/msm: Hook up iotlb_sync_map Will Deacon
1 sibling, 0 replies; 3+ messages in thread
From: Robin Murphy @ 2021-01-27 16:29 UTC (permalink / raw)
To: will
Cc: joro, iommu, linux-arm-kernel, linux-arm-msm, sricharan, architt,
srinivas.kandagatla, bjorn.andersson
IO_PGTABLE_QUIRK_TLBI_ON_MAP is now fully superseded by the
core API's iotlb_sync_map callback.
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
---
drivers/iommu/io-pgtable-arm-v7s.c | 8 +-------
include/linux/io-pgtable.h | 5 -----
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c
index 1d92ac948db7..3a92f06aad43 100644
--- a/drivers/iommu/io-pgtable-arm-v7s.c
+++ b/drivers/iommu/io-pgtable-arm-v7s.c
@@ -535,12 +535,7 @@ static int arm_v7s_map(struct io_pgtable_ops *ops, unsigned long iova,
* Synchronise all PTE updates for the new mapping before there's
* a chance for anything to kick off a table walk for the new iova.
*/
- if (iop->cfg.quirks & IO_PGTABLE_QUIRK_TLBI_ON_MAP) {
- io_pgtable_tlb_flush_walk(iop, iova, size,
- ARM_V7S_BLOCK_SIZE(2));
- } else {
- wmb();
- }
+ wmb();
return ret;
}
@@ -759,7 +754,6 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
if (cfg->quirks & ~(IO_PGTABLE_QUIRK_ARM_NS |
IO_PGTABLE_QUIRK_NO_PERMS |
- IO_PGTABLE_QUIRK_TLBI_ON_MAP |
IO_PGTABLE_QUIRK_ARM_MTK_EXT |
IO_PGTABLE_QUIRK_NON_STRICT))
return NULL;
diff --git a/include/linux/io-pgtable.h b/include/linux/io-pgtable.h
index 2a5686ca2ba3..06753323a15e 100644
--- a/include/linux/io-pgtable.h
+++ b/include/linux/io-pgtable.h
@@ -68,10 +68,6 @@ struct io_pgtable_cfg {
* hardware which does not implement the permissions of a given
* format, and/or requires some format-specific default value.
*
- * IO_PGTABLE_QUIRK_TLBI_ON_MAP: If the format forbids caching invalid
- * (unmapped) entries but the hardware might do so anyway, perform
- * TLB maintenance when mapping as well as when unmapping.
- *
* IO_PGTABLE_QUIRK_ARM_MTK_EXT: (ARM v7s format) MediaTek IOMMUs extend
* to support up to 34 bits PA where the bit32 and bit33 are
* encoded in the bit9 and bit4 of the PTE respectively.
@@ -88,7 +84,6 @@ struct io_pgtable_cfg {
*/
#define IO_PGTABLE_QUIRK_ARM_NS BIT(0)
#define IO_PGTABLE_QUIRK_NO_PERMS BIT(1)
- #define IO_PGTABLE_QUIRK_TLBI_ON_MAP BIT(2)
#define IO_PGTABLE_QUIRK_ARM_MTK_EXT BIT(3)
#define IO_PGTABLE_QUIRK_NON_STRICT BIT(4)
#define IO_PGTABLE_QUIRK_ARM_TTBR1 BIT(5)
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] iommu/msm: Hook up iotlb_sync_map
2021-01-27 16:29 [PATCH 1/2] iommu/msm: Hook up iotlb_sync_map Robin Murphy
2021-01-27 16:29 ` [PATCH 2/2] iommu/io-pgtable: Remove TLBI_ON_MAP quirk Robin Murphy
@ 2021-01-28 21:07 ` Will Deacon
1 sibling, 0 replies; 3+ messages in thread
From: Will Deacon @ 2021-01-28 21:07 UTC (permalink / raw)
To: Robin Murphy
Cc: catalin.marinas, kernel-team, Will Deacon, iommu, architt, joro,
sricharan, linux-arm-msm, srinivas.kandagatla, bjorn.andersson,
linux-arm-kernel
On Wed, 27 Jan 2021 16:29:28 +0000, Robin Murphy wrote:
> The core API can now accommodate invalidate-on-map style behaviour in a
> single efficient call, so hook that up instead of having io-pgatble do
> it piecemeal.
Applied to arm64 (for-joerg/mtk), thanks!
[1/2] iommu/msm: Hook up iotlb_sync_map
https://git.kernel.org/arm64/c/c867c78acae9
[2/2] iommu/io-pgtable: Remove TLBI_ON_MAP quirk
https://git.kernel.org/arm64/c/3d5eab41451f
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-28 21:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 16:29 [PATCH 1/2] iommu/msm: Hook up iotlb_sync_map Robin Murphy
2021-01-27 16:29 ` [PATCH 2/2] iommu/io-pgtable: Remove TLBI_ON_MAP quirk Robin Murphy
2021-01-28 21:07 ` [PATCH 1/2] iommu/msm: Hook up iotlb_sync_map Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).