iommu/sprd: Add support for reattaching an existing domain
authorChunyan Zhang <chunyan.zhang@unisoc.com>
Fri, 31 Mar 2023 03:31:24 +0000 (11:31 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 31 Mar 2023 08:13:02 +0000 (10:13 +0200)
commit816c698c052471f525bea92ff0aeeda8a5844a85
tree8dd59abafac4f7cc013255c912b913579f050f1b
parent9afea57384d4ae7b2034593eac7fa76c7122762a
iommu/sprd: Add support for reattaching an existing domain

This IOMMU driver should allow a domain to be attached more than once.

If IOMMU is reattaching to the same domain which is attached, there's
nothing to be done.

If reattching to a previously-used domain, do not alloc DMA buffer
again which stores address mapping table to avoid memory leak.

Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Link: https://lore.kernel.org/r/20230331033124.864691-3-zhang.lyra@gmail.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/sprd-iommu.c