summaryrefslogtreecommitdiff
path: root/include/linux/iommu.h
diff options
context:
space:
mode:
authorLu Baolu <baolu.lu@linux.intel.com>2024-03-05 15:21:17 +0300
committerJoerg Roedel <jroedel@suse.de>2024-03-06 19:35:56 +0300
commit0061ffe289e19caabeea8103e69cb0f1896e34d8 (patch)
tree5466b6d065c9294e9f71422351a1ec6cbcb2ae99 /include/linux/iommu.h
parent80a9b50c0b9e297669a8a400eb35468cd87a9aed (diff)
downloadlinux-0061ffe289e19caabeea8103e69cb0f1896e34d8.tar.xz
iommu: Add static iommu_ops->release_domain
The current device_release callback for individual iommu drivers does the following: 1) Silent IOMMU DMA translation: It detaches any existing domain from the device and puts it into a blocking state (some drivers might use the identity state). 2) Resource release: It releases resources allocated during the device_probe callback and restores the device to its pre-probe state. Step 1 is challenging for individual iommu drivers because each must check if a domain is already attached to the device. Additionally, if a deferred attach never occurred, the device_release should avoid modifying hardware configuration regardless of the reason for its call. To simplify this process, introduce a static release_domain within the iommu_ops structure. It can be either a blocking or identity domain depending on the iommu hardware. The iommu core will decide whether to attach this domain before the device_release callback, eliminating the need for repetitive code in various drivers. Consequently, the device_release callback can focus solely on the opposite operations of device_probe, including releasing all resources allocated during that callback. Co-developed-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/20240305013305.204605-2-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'include/linux/iommu.h')
-rw-r--r--include/linux/iommu.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 1ea2a820e1eb..a0a07e1680a2 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -487,6 +487,7 @@ struct iommu_ops {
struct module *owner;
struct iommu_domain *identity_domain;
struct iommu_domain *blocked_domain;
+ struct iommu_domain *release_domain;
struct iommu_domain *default_domain;
};