From: Samiullah Khawaja <skhawaja@google.com>
To: Baolu Lu <baolu.lu@linux.intel.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Jason Gunthorpe <jgg@ziepe.ca>,
Robin Murphy <robin.murphy@arm.com>,
Kevin Tian <kevin.tian@intel.com>,
Alex Williamson <alex@shazbot.org>,
Shuah Khan <shuah@kernel.org>,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, Pratyush Yadav <pratyush@kernel.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
David Matlack <dmatlack@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Pranjal Shrivastava <praan@google.com>,
Vipin Sharma <vipinsh@google.com>
Subject: Re: [PATCH v4 07/18] iommu/vt-d: Implement device and iommu preserve/unpreserve ops
Date: Wed, 26 Aug 2026 20:46:47 +0000 [thread overview]
Message-ID: <ao9PE9gdOh3DXNvP@google.com> (raw)
In-Reply-To: <065b2be2-2ff1-42a0-99b1-ed81e783dca1@linux.intel.com>
On Wed, Aug 26, 2026 at 03:10:31PM +0800, Baolu Lu wrote:
>On 8/8/26 10:27, Samiullah Khawaja wrote:
>>Add implementation of the device and iommu presevation in a separate
>>file. Also set the device and iommu preserve/unpreserve ops in the
>>struct iommu_ops.
>
>This patch, on its own, does not fully implement the preserve operation.
>At this point, the callback preserves all root/context entries used for
>live update, but it does not yet clear non-preserved entries and
>invalidate the related caches; that cleanup is supposed to be done in
>the next patch.
>
>So I think we should either:
>
>- add a brief note here to make this dependency explicit, or
>- merge these two patches into a single patch for completeness.
>
>?
That is a good point. I kept the cleanup patch separate as it has to do
with shutdown and basically getting ready to go into kexec. This patch
mostly focuses on the "preservation of the memory" being used by various
IOMMU data structures.
But I agree, we should add a note about the cleanup here. I will do that
in the next revision.
>
>>
>>Signed-off-by: Samiullah Khawaja <skhawaja@google.com>
>>---
[snip]
>>+#else
>>+static inline int intel_iommu_preserve_device(struct device *dev,
>>+ struct iommu_device_ser *device_ser)
>>+{
>>+ return -EOPNOTSUPP;
>>+}
>>+
>>+static inline void intel_iommu_unpreserve_device(struct device *dev,
>>+ struct iommu_device_ser *device_ser)
>>+{
>>+}
>>+
>>+static inline int intel_iommu_preserve(struct iommu_device *iommu,
>>+ struct iommu_hw_ser *iommu_ser)
>>+{
>>+ return -EOPNOTSUPP;
>>+}
>>+
>>+static inline void intel_iommu_unpreserve(struct iommu_device *iommu,
>>+ struct iommu_hw_ser *iommu_ser)
>>+{
>>+}
>>+#endif
>
>I believe the #else ... #endif stubs are unnecessary and can be removed.
>
>Specially iommu core checks driver support via callback pointer
>presence:
>
> if (!iommu->iommu_dev->ops->preserve_device ||
> !iommu->iommu_dev->ops->unpreserve_device ||
> !iommu->iommu_dev->ops->preserve ||
> !iommu->iommu_dev->ops->unpreserve)
> return -EOPNOTSUPP
>
>So when CONFIG_IOMMU_LIVEUPDATE is disabled, simply not wiring these
>callbacks is sufficient.
Agreed. Will remove these.
>
>>+
>> #ifdef CONFIG_INTEL_IOMMU_SVM
>> void intel_svm_check(struct intel_iommu *iommu);
>> struct iommu_domain *intel_svm_domain_alloc(struct device *dev,
>>+
[snip]
>>+/**
>>+ * intel_iommu_unpreserve_device() - Intel IOMMU callback to unpreserve device state
>>+ * @dev: Target device
>>+ * @device_ser: Struct containing serialized device state
>>+ */
>>+void intel_iommu_unpreserve_device(struct device *dev,
>>+ struct iommu_device_ser *device_ser)
>>+{
>>+}
>
>Please add a comment explaining why this callback is intentionally
>empty.
Agreed. Will add in the next revision.
>
>>+
>>+/**
>>+ * intel_iommu_preserve() - Intel IOMMU callback to preserve hardware state
>>+ * @iommu_dev: Generic IOMMU device handle
>>+ * @ser: Struct to populate with serialized hardware state
>>+ *
>>+ * Return: 0 on success, or negative error code.
>>+ */
>>+int intel_iommu_preserve(struct iommu_device *iommu_dev,
>>+ struct iommu_hw_ser *ser)
>>+{
>>+ struct intel_iommu *iommu;
>>+ int ret;
>>+
[snip]
>> /**
>> * struct iommu_hw_ser - Serialized state of an IOMMU instance
>> * @hdr: Common object header
>> * @token: Unique token for the IOMMU
>> * @type: IOMMU type serialized state belongs to
>>+ * @intel: Intel specific serialization data
>> */
>> struct iommu_hw_ser {
>> struct iommu_hdr_ser hdr;
>> u64 token;
>> u64 type;
>>+ union {
>>+ struct iommu_intel_ser intel;
>>+ };
>> } __packed;
>> /**
>
>Thanks,
>baolu
Thanks,
Sami
next prev parent reply other threads:[~2026-08-26 20:46 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 2:27 [PATCH v4 00/18] iommu: Add live update state preservation Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 01/18] memfd: export memfd_get_seals() Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 02/18] iommu: Implement IOMMU Live update FLB callbacks Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 03/18] iommu/pages: Add APIs to preserve/unpreserve/restore iommu pages Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 04/18] iommupt: Implement preserve/unpreserve/restore callbacks Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 05/18] iommu: Implement IOMMU domain preservation Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 06/18] iommu: Implement device and IOMMU HW preservation Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 07/18] iommu/vt-d: Implement device and iommu preserve/unpreserve ops Samiullah Khawaja
2026-08-26 7:10 ` Baolu Lu
2026-08-26 20:46 ` Samiullah Khawaja [this message]
2026-08-08 2:27 ` [PATCH v4 08/18] iommu/vt-d: Clear unpreserved context entries during shutdown Samiullah Khawaja
2026-08-26 8:05 ` Baolu Lu
2026-08-26 12:30 ` Pranjal Shrivastava
2026-08-26 20:37 ` Samiullah Khawaja
2026-08-26 20:30 ` Samiullah Khawaja
2026-08-27 6:09 ` Baolu Lu
2026-08-27 18:57 ` Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 09/18] iommu: Add APIs to get iommu and device preserved state Samiullah Khawaja
2026-08-12 6:29 ` Ankit Soni
2026-08-12 23:23 ` Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 10/18] iommu/vt-d: Restore IOMMU state and reclaimed domain ids Samiullah Khawaja
2026-08-27 7:22 ` Baolu Lu
2026-08-27 18:47 ` Samiullah Khawaja
2026-08-28 1:36 ` Baolu Lu
2026-08-08 2:27 ` [PATCH v4 11/18] iommu: Restore and reattach preserved domains to devices Samiullah Khawaja
2026-08-14 16:59 ` Ankit Soni
2026-08-14 19:46 ` Samiullah Khawaja
2026-08-17 15:32 ` Ankit Soni
2026-08-08 2:27 ` [PATCH v4 12/18] iommu/vt-d: Handle reattach of the restored domain Samiullah Khawaja
2026-08-27 8:12 ` Baolu Lu
2026-08-27 17:52 ` Samiullah Khawaja
2026-08-28 1:42 ` Baolu Lu
2026-08-28 1:55 ` Baolu Lu
2026-08-28 14:35 ` Jason Gunthorpe
2026-08-08 2:27 ` [PATCH v4 13/18] iommu/vt-d: Preserve PASID table of preserved device Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 14/18] iommufd: Implement ioctl to mark HWPT for preservation Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 15/18] iommufd: Persist iommu hardware pagetables for live update Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 16/18] iommufd: Add APIs to preserve/unpreserve a vfio cdev Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 17/18] vfio/pci: Preserve the iommufd state of the " Samiullah Khawaja
2026-08-08 2:27 ` [PATCH v4 18/18] iommufd/selftest: Add test to verify iommufd preservation Samiullah Khawaja
2026-08-26 8:12 ` [PATCH v4 00/18] iommu: Add live update state preservation David Woodhouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ao9PE9gdOh3DXNvP@google.com \
--to=skhawaja@google.com \
--cc=akpm@linux-foundation.org \
--cc=alex@shazbot.org \
--cc=baolu.lu@linux.intel.com \
--cc=dmatlack@google.com \
--cc=dwmw2@infradead.org \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pasha.tatashin@soleen.com \
--cc=praan@google.com \
--cc=pratyush@kernel.org \
--cc=robin.murphy@arm.com \
--cc=shuah@kernel.org \
--cc=vipinsh@google.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox