Re: [PATCH 01/14] iommu: Implement IOMMU LU FLB callbacks

Samiullah Khawaja
2026-03-13T16:58:23Z

On Fri, Mar 13, 2026 at 03:36:33PM +0000, Pranjal Shrivastava wrote:
>On Thu, Mar 12, 2026 at 04:43:00PM +0000, Samiullah Khawaja wrote:
>> On Wed, Mar 11, 2026 at 09:07:00PM +0000, Pranjal Shrivastava wrote:
>> > On Tue, Feb 03, 2026 at 10:09:35PM +0000, Samiullah Khawaja wrote:
>> > > Add liveupdate FLB for IOMMU state preservation. Use KHO preserve memory
>> > > alloc/free helper functions to allocate memory for the IOMMU LU FLB
>> > > object and the serialization structs for device, domain and iommu.
>> > >
>> > > During retrieve, walk through the preserved objs nodes and restore each
>> > > folio. Also recreate the FLB obj.
>> > >
>> > > Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
>> > > ---
>> > > drivers/iommu/Kconfig | 11 +++
>> > > drivers/iommu/Makefile | 1 +
>> > > drivers/iommu/liveupdate.c | 177 ++++++++++++++++++++++++++++++++++
>> > > include/linux/iommu-lu.h | 17 ++++
>> > > include/linux/kho/abi/iommu.h | 119 +++++++++++++++++++++++
>> > > 5 files changed, 325 insertions(+)
>> > > create mode 100644 drivers/iommu/liveupdate.c
>> > > create mode 100644 include/linux/iommu-lu.h
>> > > create mode 100644 include/linux/kho/abi/iommu.h
>> > >
>> > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
>> > > index f86262b11416..fdcfbedee5ed 100644
>> > > --- a/drivers/iommu/Kconfig
>> > > +++ b/drivers/iommu/Kconfig
>> > > @@ -11,6 +11,17 @@ config IOMMUFD_DRIVER
>> > > bool
>> > > default n
>> > >
>
>[ snip ---- >8 -----]
>
>> >
>> > > +enum iommu_lu_type {
>> > > + IOMMU_INVALID,
>> > > + IOMMU_INTEL,
>> > > +};
>> > > +
>> > > +struct iommu_obj_ser {
>> > > + u32 idx;
>> > > + u32 ref_count;
>> > > + u32 deleted:1;
>> > > + u32 incoming:1;
>> > > +} __packed;
>> > > +
>> > > +struct iommu_domain_ser {
>> > > + struct iommu_obj_ser obj;
>> > > + u64 top_table;
>> > > + u64 top_level;
>> > > + struct iommu_domain *restored_domain;
>> > > +} __packed;
>> > > +
>> > > +struct device_domain_iommu_ser {
>> > > + u32 did;
>> > > + u64 domain_phys;
>> > > + u64 iommu_phys;
>> > > +} __packed;
>> > > +
>> > > +struct device_ser {
>> > > + struct iommu_obj_ser obj;
>> > > + u64 token;
>> > > + u32 devid;
>> > > + u32 pci_domain;
>> > > + struct device_domain_iommu_ser domain_iommu_ser;
>> > > + enum iommu_lu_type type;
>> > > +} __packed;
>> > > +
>> > > +struct iommu_intel_ser {
>> > > + u64 phys_addr;
>> > > + u64 root_table;
>> > > +} __packed;
>> > > +
>
>One more thing here, let's add the "intel" stuff with the intel patches

Agreed. Will move these to intel specific patches.
>
>Thanks,
>Praan
>
>> > > +struct iommu_ser {
>> > > + struct iommu_obj_ser obj;
>> > > + u64 token;
>> > > + enum iommu_lu_type type;
>> > > + union {
>> > > + struct iommu_intel_ser intel;
>> > > + };
>> > > +} __packed;
>> > > +
>> > > +struct iommu_objs_ser {
>> > > + u64 next_objs;
>> > > + u64 nr_objs;
>> > > +} __packed;
>> > > +
>> > > +struct iommus_ser {
>> > > + struct iommu_objs_ser objs;
>> > > + struct iommu_ser iommus[];
>> > > +} __packed;
>> > > +
>> > > +struct iommu_domains_ser {
>> > > + struct iommu_objs_ser objs;
>> > > + struct iommu_domain_ser iommu_domains[];
>> > > +} __packed;
>> > > +
>> > > +struct devices_ser {
>> > > + struct iommu_objs_ser objs;
>> > > + struct device_ser devices[];
>> > > +} __packed;
>> > > +
>
>Thanks,
>Praan

Thanks,
Sami