summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2023-06-05 21:59:43 -0300
committerJoerg Roedel <jroedel@suse.de>2023-07-14 16:14:14 +0200
commitaa0958570f24f562422afa41fefd1b3a1fe0f6d0 (patch)
treeb51a0ffee6be58c50ec4c2d4a4ba1bbc35140ab3 /Makefile
parentdf15d76dcacac2126a4d20ba06c9d7e4b18bad8e (diff)
downloadlinux-stable-aa0958570f24f562422afa41fefd1b3a1fe0f6d0.tar.gz
linux-stable-aa0958570f24f562422afa41fefd1b3a1fe0f6d0.tar.bz2
linux-stable-aa0958570f24f562422afa41fefd1b3a1fe0f6d0.zip
iommu: Add iommu_init/deinit_device() paired functions
Move the driver init and destruction code into two logically paired functions. There is a subtle ordering dependency in how the group's domains are freed, the current code does the kobject_put() on the group which will hopefully trigger the free of the domains before the module_put() that protects the domain->ops. Reorganize this to be explicit and documented. The domains are cleaned up by iommu_deinit_device() if it is the last device to be deinit'd from the group. This must be done in a specific order - after ops->release_device() and before the module_put(). Make it very clear and obvious by putting the order directly in one function. Leave WARN_ON's in case the refcounting gets messed up somehow. This also moves the module_put() and dev_iommu_free() under the group->mutex to keep the code simple. Building paired functions like this helps ensure that error cleanup flows in __iommu_probe_device() are correct because they share the same code that handles the normal flow. These details become relavent as following patches add more error unwind into __iommu_probe_device(), and ultimately a following series adds fine-grained locking to __iommu_probe_device(). Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/r/5-v3-328044aa278c+45e49-iommu_probe_jgg@nvidia.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions