[RFC PATCH 09/15] iommu/vt-d: Add live update freeze callback

Samiullah Khawaja posted 15 patches 3 days, 2 hours ago
[RFC PATCH 09/15] iommu/vt-d: Add live update freeze callback
Posted by Samiullah Khawaja 3 days, 2 hours ago
The iommu_ser needs to be updated during freeze to set the physical
address of the iommu_units and devices array as the virtual addresses
will not be valid after kexec in the next kernel.

Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
---
 drivers/iommu/intel/liveupdate.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/iommu/intel/liveupdate.c b/drivers/iommu/intel/liveupdate.c
index fb214736aa3c..a7d9b07aaada 100644
--- a/drivers/iommu/intel/liveupdate.c
+++ b/drivers/iommu/intel/liveupdate.c
@@ -258,10 +258,21 @@ static void intel_liveupdate_finish(struct liveupdate_subsystem *handle, u64 dat
 	pr_warn("Not implemented\n");
 }
 
+static int intel_liveupdate_freeze(struct liveupdate_subsystem *handle, u64 *data)
+{
+	struct iommu_ser *ser = __va(*data);
+
+	ser->iommu_units_phys = __pa(ser->iommu_units);
+	ser->devices_phys = __pa(ser->devices);
+
+	return 0;
+}
+
 static struct liveupdate_subsystem_ops intel_liveupdate_subsystem_ops = {
 	.prepare = intel_liveupdate_prepare,
 	.finish = intel_liveupdate_finish,
 	.cancel = intel_liveupdate_cancel,
+	.freeze = intel_liveupdate_freeze,
 };
 
 static struct liveupdate_subsystem intel_liveupdate_subsystem = {
-- 
2.51.0.536.g15c5d4f767-goog
Re: [RFC PATCH 09/15] iommu/vt-d: Add live update freeze callback
Posted by Jason Gunthorpe 2 days, 5 hours ago
On Sun, Sep 28, 2025 at 07:06:17PM +0000, Samiullah Khawaja wrote:

> +static int intel_liveupdate_freeze(struct liveupdate_subsystem *handle, u64 *data)
> +{
> +	struct iommu_ser *ser = __va(*data);
> +
> +	ser->iommu_units_phys = __pa(ser->iommu_units);
> +	ser->devices_phys = __pa(ser->devices);

Why didn't this happen at an earlier stage? It makes no sense to some
hacky naked __pa

Jason