Commit 6f87d4e6 authored by Sven Peter's avatar Sven Peter Committed by Joerg Roedel

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
  [...]

Fixes: 46d1fb07 ("iommu/dart: Add DART iommu driver")
Reported-by: default avatarMarc Zyngier <maz@kernel.org>
Signed-off-by: default avatarSven Peter <sven@svenpeter.dev>
Acked-by: default avatarMarc Zyngier <maz@kernel.org>
Tested-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210921153934.35647-1-sven@svenpeter.devSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 5816b3e6
......@@ -183,7 +183,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)
{
......@@ -338,22 +337,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)
{
......@@ -435,7 +418,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,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment