* [PATCH v1] iommu/apple-dart: Report TLB flush failures from iotlb_sync_map
@ 2026-10-22 16:33 Yuho Choi
0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-10-22 16:33 UTC (permalink / raw)
To: Sven Peter, Janne Grunau, Joerg Roedel, Will Deacon
Cc: Neal Gompa, Robin Murphy, asahi, linux-arm-kernel, iommu,
linux-kernel, Yuho Choi
apple_dart_iotlb_sync_map() flushes the TLBs of every DART the domain
is attached to after a new mapping has been written. The
invalidate_tlb() callbacks return -ETIMEDOUT when the busy bit does not
clear in time, but apple_dart_domain_flush_tlb() drops the result and
the callback always returns 0, so iommu_map() reports success although
the flush did not complete.
Since commit fa4c4507099f ("iommu: Allow .iotlb_sync_map to fail and
handle s390's -ENOMEM return"), iommu_map() unmaps the range and fails
when .iotlb_sync_map() returns an error. Return the error from
apple_dart_domain_flush_tlb(), after still flushing every DART of the
domain.
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
The unmap path is not changed, as .iotlb_sync() and
.flush_iotlb_all() cannot report a failure.
drivers/iommu/apple-dart.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index b160fb464c5f..1119769f9f51 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -494,9 +494,9 @@ static int apple_dart_hw_reset(struct apple_dart *dart)
return dart->hw->invalidate_tlb(&stream_map);
}
-static void apple_dart_domain_flush_tlb(struct apple_dart_domain *domain)
+static int apple_dart_domain_flush_tlb(struct apple_dart_domain *domain)
{
- int i, j;
+ int i, j, ret = 0;
struct apple_dart_atomic_stream_map *domain_stream_map;
struct apple_dart_stream_map stream_map;
@@ -506,8 +506,11 @@ static void apple_dart_domain_flush_tlb(struct apple_dart_domain *domain)
for (j = 0; j < BITS_TO_LONGS(stream_map.dart->num_streams); j++)
stream_map.sidmap[j] = atomic_long_read(&domain_stream_map->sidmap[j]);
- stream_map.dart->hw->invalidate_tlb(&stream_map);
+ /* Flush every DART even if one of them fails. */
+ ret = stream_map.dart->hw->invalidate_tlb(&stream_map) ?: ret;
}
+
+ return ret;
}
static void apple_dart_flush_iotlb_all(struct iommu_domain *domain)
@@ -524,8 +527,7 @@ static void apple_dart_iotlb_sync(struct iommu_domain *domain,
static int apple_dart_iotlb_sync_map(struct iommu_domain *domain,
unsigned long iova, size_t size)
{
- apple_dart_domain_flush_tlb(to_dart_domain(domain));
- return 0;
+ return apple_dart_domain_flush_tlb(to_dart_domain(domain));
}
static phys_addr_t apple_dart_iova_to_phys(struct iommu_domain *domain,
base-commit: c03c1a14507dfaf8b856c2608f9ac216021fc222
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-22 16:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 16:33 [PATCH v1] iommu/apple-dart: Report TLB flush failures from iotlb_sync_map Yuho Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®