[RFC PATCH v2 10/32] iommu: Add iommu_domain ops to preserve, unpreserve and restore

From: Samiullah Khawaja
Date: Tue Dec 02 2025 - 18:05:32 EST


These domain ops can be implemented by the iommu drivers if they support
iommu domain preservation across liveupdate.

Signed-off-by: Samiullah Khawaja <skhawaja@xxxxxxxxxx>
---
include/linux/iommu.h | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 8c66284a91a8..f681d4d27d6e 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -14,6 +14,7 @@
#include <linux/err.h>
#include <linux/of.h>
#include <linux/iova_bitmap.h>
+#include <linux/kho/abi/iommu.h>
#include <uapi/linux/iommufd.h>

#define IOMMU_READ (1 << 0)
@@ -749,6 +750,11 @@ struct iommu_ops {
* specific mechanisms.
* @set_pgtable_quirks: Set io page table quirks (IO_PGTABLE_QUIRK_*)
* @free: Release the domain after use.
+ * @preserve: Preserve the iommu domain for liveupdate.
+ * Returns 0 on success, a negative errno on failure.
+ * @unpreserve: Unpreserve the iommu domain that was preserved earlier.
+ * @restore: Restore the iommu domain after liveupdate.
+ * Returns 0 on success, a negative errno on failure.
*/
struct iommu_domain_ops {
int (*attach_dev)(struct iommu_domain *domain, struct device *dev,
@@ -779,6 +785,9 @@ struct iommu_domain_ops {
unsigned long quirks);

void (*free)(struct iommu_domain *domain);
+ int (*preserve)(struct iommu_domain *domain, struct iommu_domain_ser *ser);
+ void (*unpreserve)(struct iommu_domain *domain, struct iommu_domain_ser *ser);
+ int (*restore)(struct iommu_domain *domain, struct iommu_domain_ser *ser);
};

/**
--
2.52.0.158.g65b55ccf14-goog