iommu/dart: Remove iommu_flush_ops
Subsystems (2)
PATCH 1/1 iommu/dart: Remove iommu_flush_ops
apple_dart_tlb_flush_{all,walk} expect to get a struct apple_dart_domain but instead get a struct iommu_domain right now. This breaks those two functions and can lead to kernel panics like the one below. DART can only invalidate the entire TLB and apple_dart_iotlb_sync will already flush everything. There's no need to do that again inside those two functions. Let's just drop them.
pci 0000:03:00.0: Removing from iommu group 1
Unable to handle kernel paging request at virtual address 0000000100000023 [...] Call trace: _raw_spin_lock_irqsave+0x54/0xbc apple_dart_hw_stream_command.constprop.0+0x2c/0x130 apple_dart_tlb_flush_all+0x48/0x90 free_io_pgtable_ops+0x40/0x70 apple_dart_domain_free+0x2c/0x44 iommu_group_release+0x68/0xac kobject_cleanup+0x4c/0x1fc kobject_cleanup+0x14c/0x1fc kobject_put+0x64/0x84 iommu_group_remove_device+0x110/0x180 iommu_release_device+0x50/0xa0 [...]
--- drivers/iommu/apple-dart.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/iommu/apple-dart.c +0 -18
@@ -181,7 +181,6 @@ struct apple_dart_master_cfg {static struct platform_driver apple_dart_driver;static const struct iommu_ops apple_dart_iommu_ops; -static const struct iommu_flush_ops apple_dart_tlb_ops;static struct apple_dart_domain *to_dart_domain (struct iommu_domain *dom) {
@@ -336,22 +335,6 @@ static void apple_dart_iotlb_sync_map(struct iommu_domain *domain,apple_dart_domain_flush_tlb (to_dart_domain (domain)); } -static void apple_dart_tlb_flush_all (void *cookie) -{ -apple_dart_domain_flush_tlb (cookie); -} - -static void apple_dart_tlb_flush_walk (unsigned long iova,size_t size, -size_t granule,void *cookie) -{ -apple_dart_domain_flush_tlb (cookie); -} - -static const struct iommu_flush_ops apple_dart_tlb_ops = { - .tlb_flush_all = apple_dart_tlb_flush_all, - .tlb_flush_walk = apple_dart_tlb_flush_walk, -}; -static phys_addr_t apple_dart_iova_to_phys (struct iommu_domain *domain,dma_addr_t iova) {
@@ -433,7 +416,6 @@ static int apple_dart_finalize_domain(struct iommu_domain *domain, .ias = 32, .oas = 36, .coherent_walk = 1, - .tlb = &apple_dart_tlb_ops, .iommu_dev = dart->dev, };
Signature · 1 line
2.25.1
Quoted 25 lines · Sven Peter
apple_dart_tlb_flush_{all,walk} expect to get a struct
apple_dart_domainbut instead get a structiommu_domainright now. This breaks those two functions and can lead to kernel panics like the one below. DART can only invalidate the entire TLB andapple_dart_iotlb_syncwill already flush everything. There's no need to do that again inside those two functions. Let's just drop them.pci 0000:03:00.0: Removing from iommu group 1
Unable to handle kernel paging request at virtual address 0000000100000023 [...] Call trace: _raw_spin_lock_irqsave+0x54/0xbc apple_dart_hw_stream_command.constprop.0+0x2c/0x130 apple_dart_tlb_flush_all+0x48/0x90 free_io_pgtable_ops+0x40/0x70 apple_dart_domain_free+0x2c/0x44 iommu_group_release+0x68/0xac kobject_cleanup+0x4c/0x1fc kobject_cleanup+0x14c/0x1fc kobject_put+0x64/0x84 iommu_group_remove_device+0x110/0x180 iommu_release_device+0x50/0xa0 [...]
Quoted 3 lines
Fixes 46d1fb072e76b161 ("iommu/dart: Add DART iommu driver")Reported-by Marc Zyngier <[email protected]>Signed-off-by Sven Peter <[email protected]>
Thanks for addressing this so quickly.
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Joerg Roedel
maintainerQuoted 6 lines · Sven Peter
Fixes 46d1fb072e76b161 ("iommu/dart: Add DART iommu driver")Reported-by Marc Zyngier <[email protected]>Signed-off-by Sven Peter <[email protected]>--- drivers/iommu/apple-dart.c | 18 ------------------ 1 file changed, 18 deletions(-)
Applied for v5.15, thanks Sven.