Re: [RFC PATCH 05/15] iommu: Introduce API to preserve iommu domain
From: Jason Gunthorpe
Date: Mon Sep 29 2025 - 11:54:32 EST
On Sun, Sep 28, 2025 at 07:06:13PM +0000, Samiullah Khawaja wrote:
> Add an API that can be called by the iommu users to preserve iommu
> domain. Currently it only marks the iommu_domain as preserved.
Merge it with the previous path
> +#ifdef CONFIG_LIVEUPDATE
> + atomic_set(&domain->preserved, 0);
> +#endif
The memory is kzallocated, I don't think this is needed
> +int iommu_domain_preserve(struct iommu_domain *domain)
> +{
I expect this to accept some kind of luo pointer to signal what stream
the domain is part of.
Domains are linked to iommufd's which are linked to luo sessions. This
all needs to be carefully conveyed down to all the lower levels.
I also expect preserve to return some kind of handle that the caller
can hide away to deserialize.
> + lockdep_assert_held(&liveupdate_state_rwsem);
> + if (!domain->ops->preserve)
> + return -EOPNOTSUPP;
> +
> + ret = domain->ops->preserve(domain);
> + if (!ret)
> + atomic_set(&domain->preserved, 1);
And if we have a caller handle then there is probably no reason to
have this state tracking atomic.
Jason