From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.70 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792894776; b=YPKgRTsZLp1OVK2LYesNaYKBpovvddifWvynIo9gRHtGL+sl4bhgIN4XV038xi9Cmu65 FEKSaAloNjfiCdbUzf9HlAGqbjGvm2zXt2wW8Zib6a756SaU0BGI65nJW8rtG6AgKlUWk 75c2KYKiZS7KAhuZzfBNiwlRoTQi5dNCQLbbTx5PKYFJGklNg8Ma1mRcbZ9bIGQkhijVu TEjNCpGJlIz4dIy4O5ZpfzLXgams/Mx5hvzOuxX/K6OgyOtyQnHdLG50yhobOdrhicUIx bKEIG5SA01MqsXsiFSpAlRNbGXtbvI81IrAbDdL/hQtqgkO6pVCDmhf8LohyTh+dO5A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792894776; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:Mime-Version: X-Mailer:Message-ID:Subject:From:To:Cc:Content-Type; bh=1vMKXcWahSYmCNkIu3kbDZNXp2fJW15YMv5/ImSxqLs=; b=uxqDKnLuungxj36GR0rbR5p7WtkzM0zyKCnAmtHN96ERis9ofKqQsOrm2RbGunK/831v AHS35vW+bbFuu38d+MGBxVWDttEMz3DrBJ/qgygQK6a5zsYqDy+l7TeHduU6PGqpu5c0d OwWSmlMSCeLkOfrhRtC7kH5T6x9oLi8XIAbsCF6pYCmywxIPDVh3b5TmSmebTdsqfk5co AxRXucbWm5DGowS/3M2z0vdG/IC+lZTlYjIzFXQ1cBmpDYPAgxHqkfio5coO17ityngQT F4au6WN/2Nj6Scbvtq2ukh6xde2Ra2KI92Pf8kiGsPjL6HCWpoK+Snm7K9CcJHr4uag== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--skhawaja.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=D+67PpDz; arc=none smtp.remote-ip=209.85.216.70 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2388F606A32E for ; Sun, 25 Oct 2026 02:19:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2388F606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--skhawaja.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20251104 header.b=D+67PpDz Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-3ac7a4ba546so2173156a91.0 for ; Sat, 24 Oct 2026 19:19:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1792894774; x=1793499574; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=1vMKXcWahSYmCNkIu3kbDZNXp2fJW15YMv5/ImSxqLs=; b=D+67PpDzvkf1vsNz+zW8C3/DyGpgjjAr94KylFFm5SaDTu/BHWCidKd3hd16fcXOfF k5O/3NHzEoKA+uEFs2QshWeamrJoE0qAwOlaK33xXlpaJYF2JnRayBO+8DKGYTizibhO nSR0tgAiiyXFIg2aqGs4fiF32KJckhrrlgRjGUEfoEVSGtS/ccmdfbGyKjkGe+lcd1oA 9je/1Ypa4e1qCljWNyS0zLFbDUUKxojKreWrWAoMa5xVEDTyMOPiXbvfjJTY6ZCAJZRG Ynu5O4Zuo8UTAxeIrAllCFJoa4J0lM+tyjuRO9NoaQ2o7spFcp4E7swsHqtoG0EePa/5 fCmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792894774; x=1793499574; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=1vMKXcWahSYmCNkIu3kbDZNXp2fJW15YMv5/ImSxqLs=; b=sY0laGlf3yJ85LwpXBPSanYPdSfsIw+IVtJF6ssbVqplR7BES/ldyE+gusTFOy1fVP j1aZpHl+OVDYHQbVZFo+E+BHe5+fvnsleHQR2jX/T4SrijHGlByQmtYnCrIfTrb46Gej IO4wPolzuDAWyLWfr04ZPctyYiWCb1oaoNquuskSm+Sgij3Bi91JWW8W6FK3e5tFz7EM DHN3ZXvvDMajYV1fINPs44mB8XiddYntnTMgZLjG9DiXAeJvkenXJXJmg9Et1W3zQHyk p60qH7TdGdsiSh7MXGv9XNC4vdV4ZuSHssQAoYgBw4B4gokGDo3zPqDWW/WOaX3HSGz6 ak0Q== X-Forwarded-Encrypted: i=1; AKwUvBxwLwHEpPCtlq95aM+Exz0cHgPnS85e8f1hIZFCCzW1oF9uhoQ9z7Es5Sf4QsAGsQ+xJq8BJNCjCT5lvI0=@vger.kernel.org X-Gm-Message-State: AFq9FYIAEWatBSNmVTbFiSbvng+L3tUykCZtCHljt0/yIerPhACQfLxN pIFwpKXtAMx0TnRko+aX0tPDBI3MZVAhxp35NWQ3O2dBIKmzvfDAVwTR3qv3uZQwn0B29uwWiY/ 9Ch5Ck7Q1fjiGRQ== X-Received: from pgby8-n2.prod.google.com ([2002:a05:6a02:6508:20b0:cc7:e9a5:4d0f]) (user=skhawaja job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:3c05:b0:3ac:36c7:c144 with SMTP id 98e67ed59e1d1-3adeb5e3aa7mr1730001a91.28.1792894774147; Sat, 24 Oct 2026 19:19:34 -0700 (PDT) Date: Sun, 25 Oct 2026 02:19:11 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 X-Mailer: git-send-email 2.56.0.257.gf7497c7d27-goog Message-ID: <20261025021930.674647-1-skhawaja@google.com> Subject: [PATCH v6 00/18] iommu: Add live update state preservation From: Samiullah Khawaja To: Joerg Roedel , Will Deacon , Lu Baolu , Jason Gunthorpe , David Woodhouse Cc: Samiullah Khawaja , Robin Murphy , Kevin Tian , Alex Williamson , Shuah Khan , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Pratyush Yadav , Pasha Tatashin , David Matlack , Andrew Morton , Pranjal Shrivastava , Vipin Sharma , Ankit Soni , Nicolin Chen , John Starks Content-Type: text/plain; charset="UTF-8" Hi, This patch series introduces a mechanism for IOMMU state preservation across live update, including the Intel VT-d driver support implementation. Please take a look at the following LWN article to learn about KHO and Live Update Orchestrator: https://lwn.net/Articles/1033364/ This work depends on, - VFIO CDEV preservation series (v5): https://lore.kernel.org/kvm/20260714151505.3466855-1-vipinsh@google.com/ - PCI base device preservation series (v10): https://lore.kernel.org/all/20261013162529.1928093-1-dmatlack@google.com/ - Patch adding LUO internal API to get incoming/outgoing files. This patch is needed as this series is rebased on iommu/next. https://lore.kernel.org/all/20260723202912.1467112-1-skhawaja@google.com/ The kernel tree with all dependencies is uploaded to the following Github location: https://github.com/samikhawaja/linux/tree/iommu/phase1-v6 The series is targeting IOMMU tree. Overall Goals: The goal of this effort is to preserve the IOMMU domains, managed by iommufd, attached to devices preserved through VFIO cdev. This allows DMA mappings and IOMMU context of a device assigned to a VM to be maintained across a kexec live update. This is achieved by preserving IOMMU page tables using Generic Page Table support, IOMMU root table and the relevant context entries across live update. The functionality in the previously sent RFC is split into two phases and this series implements the Phase 1. Phase 1 implements the following functionality: - Foundational work in IOMMU core and VT-d driver to preserve and restore IOMMU translation units, IOMMU domains and devices across liveupdate kexec. - The preservation is triggered by preserving vfio cdev FD and bound iommufd FD into a live update session. - An HWPT (and backing IOMMU domain) is only preserved if it contains only file type DMA mappings. Also the memfd behind such a mapping must have been preserved already. - During live update boot, the state of preserved Intel VT-d, IOMMU domain and devices is restored. - The restored IOMMU domains are reattached to the preserved devices during early boot. - The DMA ownership of restored devices is also claimed during live update boot. This means that any attempt to bind a non-vfio driver with them or binding a new iommufd with them will fail. Architectural Overview: The target architecture for IOMMU state preservation across a live update involves coordination between the Live Update Orchestrator, iommufd, and the IOMMU drivers. The core design uses the Live Update Orchestrator's file descriptor preservation mechanism to preserve iommufd file descriptors. The user marks the iommufd HWPTs for preservation using a new ioctl added in this series. Once done, the preservation of iommufd inside an LUO session is triggered using LUO ioctls. During preservation, the LUO preserve callback for an iommufd walks through the HWPTs it manages to identify the ones that need to be preserved. Once identified, a new IOMMU core API is used to preserve the iommu domain. The IOMMU core uses Generic Page Table to preserve the page tables of these domains. The domains are then marked as preserved. When the user triggers the preservation of a VFIO cdev that is attached to an iommufd that is preserved, the device attachment state of that VFIO cdev is also preserved using an API exported by iommufd. IOMMUFD fetches all the information that needs to be preserved and calls the IOMMU core API to preserve the device state. The IOMMU core also preserves state of IOMMU that is associated with this device. The IOMMU core has LUO FLB registered with the iommufd LUO file handler so the preserved iommu domain and iommu hardware unit state is available during boot for early restore in the next kernel. During boot the driver fetches the preserved state from the IOMMU core and restores the state of preserved IOMMUs. Later when IOMMU core goes through the devices and probes them, the iommu domains of preserved devices are restored and the preserved devices are attached to them. During attachment, the DMA ownership of these devices is also claimed. Tested: The new iommufd_liveupdate_kexec_test selftest was used to verify the preservation logic. It was tested using QEMU with virtual IOMMU (VT-d) support with virtio pcie device bound to the vfio-pci driver. Also Tested on an Intel machine with DSA device bound to vfio-pci driver. Note that preservation is refused for devices where ATS is supported, so the machine must be booted with pci=noats. Following steps were followed for verification, - Bind the test device with vfio-pci driver - Run test on the machine by running ./iommufd_liveupdate_kexec_test - Trigger Kexec. - After reboot, try binding the device to a non-vfio pci driver, echo > /sys/bus/pci/drivers/pci-pf-stub/bind - This should fail with "Device or resource busy". - Bind the device with vfio-pci driver and run the test again. ./iommufd_liveupdate_kexec_test -s 2 - Test verifies that the device cannot be bound with a new iommufd and the session cannot be finished. Future and in progress work: - Phase 2 with IOMMUFD restore to reclaim the preserved vfio cdev and restore the preserved HWPTs. - Full support for PASID preservation, i.e. non-zero PASIDs. - Nested IOMMU preservation. - Extend support to other IOMMU architectures (e.g., AMD-Vi). - DMA Alloc preservation support, buddy allocator only. https://lore.kernel.org/all/20260708234854.4044652-1-skhawaja@google.com/ - Arm sMMUv3 preservation support https://github.com/pran005/linux/tree/wip-arm-smmu-lu Roadmap: The doc below gives a break down of the overall work into Patch series needed to complete Liveupdate feature from IOMMU perspective: https://docs.google.com/document/d/1enDn-uPE9U77U-xHEnzn6HHGKiePSAtMIP8EDU3NO0M High-Level Sequence Flow: The following diagrams illustrate the high-level interactions during the preservation phase. Note that function names in the diagram are kept abbreviated to save horizontal space. Preserve: Before live update the PREPARE event of Liveupdate Orchestrator invokes callbacks of the registered file and subsystem handlers. Userspace (VMM) | LUO Core | iommufd | IOMMU Core | IOMMU Driver -----------------|----------|---------------|---------------|------------- | | | | MARK_HWPT | | | | ---------------------------> | | | | Mark HWPT for | | | | preservation | | | | | | PRESERVE | | | | iommufd_fd | | | | -----------------> | | | | preserve | | | |----------> | | | | For each HWPT | | | |--------------> | | | | domain_presrv | | | |--------------> | | | | gpt(preserve) | | |<--------------| | |<--------------| | |<---------| | | | | | | ... | | | | | | | | PRESERVE, | | | | vfio_cdev_fd | | | | -----------------> | | | | preserve | | | |----------> | | | | | | | | iommu_preserv | | | | _device() | | | |--------------> | | | | preserve | | | | (iommu_hw) | | | |--------------> | | | | preserve(root) | | |<--------------| | | | | | | | preserve | | | | _device(dev) | | | |--------------> | | | | preserve(pasid) | | |<--------------| | |<--------------| | |<---------| | | Restore: After a live update, the preserved state is restored during boot. Userspace (VMM) | LUO Core | iommufd | IOMMU Core | IOMMU Driver -----------------|----------|---------------|---------------|------------- | | | | | | | | Restore | | | | Root, DIDs | | | | | | | | Register | | | probe devices | | | | | | | | restore | | | | domain | | | |--------------> | | | | restore | | | reattach | | | | domain | | | |--------------> | | | | Looking forward to your feedback on this. Changelog: v6: - Add size, features and reserved fields to the KHO ABI to manage compatibility. - Use KHO block for preservation of KHO data structures. - Drop "memfd: export memfd_get_seals()" and the memfd seal requirement as it is not reliable because memfd can still have holes punched after sealing. - Split the disable_dmar_iommu()/free_dmar_iommu() merge into a separate patch. - Move the PASID table preservation patch before the domain reattach patch. - Move iommu_phys from the device attachment into iommu_device_ser. - Rename vasz to max_vasz_lg2, and IOMMU_INVALID/IOMMU_INTEL to IOMMU_SER_TYPE_INVALID/IOMMU_SER_TYPE_INTEL. - Check the FLB version in retrieve before restoring the serialized objects. - Use _ser suffix consistently for serialized objects. - Rework iommu_for_each_dev() to remove redundant arguments. - Sanity check scalable mode changes across kexec. - Use context_tables_bitmap as the source of truth during restore. - Reuse reserve_domain_id() to reclaim the preserved domain IDs. - Drop the IOMMU restored flag and panic if DRHD unit restore fails. - Rename intel_iommu_restore_device() to intel_iommu_attach_restored_device(), and the domain reattach/detach helpers to domain_attach_restored_iommu()/domain_detach_restored_iommu(). - Drop the cache tag and IOPF setup for the restored domain. - Rename nr_preserved_domains, nr_hwpts and nr_liveupdate_preserved to num_preserved_domains, num_hwpts and num_liveupdate_preserved. - Update the selftest to use an unsealed memfd and verify that a hole-punched mapping is rejected. v5: - Rebased on top of PCI preservation v9 and VFIO preservation v5. - Do not preserve devices that share iommu groups. - Save the DMA owner (iommufd) token in the serialized device state. - Use READ_ONCE/WRITE_ONCE for dev->iommu->device_ser. - Refuse preservation of devices where ATS is supported. Also drop PRE disable as it depends on ATS. - Drop the fallback stubs for the preserve/unpreserve ops. - Clear the present bit and flush before clearing the context entry. - Add comments on global invalidation and why the IOMMU lock is not needed during shutdown. - Treat -ENODATA, -ENOENT and -EOPNOTSUPP as absent FLB during retrieve and fail only on other errors. - Reclaim DID by first checking if the DID is already reclaimed by another preserved device. - Handle release device by doing teardown and reattach of restored domain to restored devices. - Validate the domain physical address, the restored domain identity and the IOMMU identity before reattaching. v4: - Add kdocs. - Add 64BIT Kconfig dependency. - Add FLB version into the serialized state. - Replace bitfield in KHO state with u8 and padding. - Add fallback stub for intel_iommu_unpreserve_device. - Reject real DMA subdevices with -EOPNOTSUPP. - Add VTD_PRESERVED_BITMAP_LONGS macro for context tables. - Disable PRE in preserved context entries during shutdown. - Unify DMAR free and disable into release_dmar_iommu. - Move Intel IOMMU domain reattach logic into separate function and file. - Rename intel_pasid_try_restore_table to intel_pasid_restore_table. - Use __aligned_u64 for hwpt_token in UAPI struct. - Reject PRI usage in HWPT preservation. - Remove liveupdate_preserve bitfield from hwpt_paging. - Convert liveupdate_preserved bitfield to bool. - Replace group-level boolean with per-device flag and group refcount. - Check device_array in pasid attachment before preserving. - Collect reviews and acks. v3: - Add Reviewed-by tags. - Export memfd_get_seals for iommufd module usage. - Move iommu_flb_obj to liveupdate.c. - Replace bitfields with u32 flags. - Move callbacks from iommu_domain_ops to pt_iommu_ops. - Fix DYNAMIC_TOP support by saving range.max_vasz_lg2. - Replace BUG_ON with iommu_restore_pages helper. - Update to use IOMMU_SER_FLAG_INCOMING and IOMMU_SER_FLAG_DELETED. - Split out shutdown context-entry clearing logic into separate patch. - Add context_tables_bitmap to track and preserve only active tables. - Skip iommu_set_root_entry if restored. - Fix array iteration bug by splitting macros. - Move restore logic into caller instead of iommu_alloc_root_entry. - Add robust IS_ERR checks for iommu_ser. - Add safety checks for array traversal and domain physical address. - Remove pasid_cleanup_preserved_table. - Update handle_pd to dynamically iterate over valid PDE entries. - Link liveupdate.o into iommufd.o to resolve modpost errors. - Refactor liveupdate_immutable into nr_preserved_domains counter. - Save actual number of preserved HWPTs to TOCTOU. v2: - Move IOMMU_LIVEUPDATE under IOMMU_SUPPORT dependencies. - Update copyright year to 2026. - Add Kernel-doc for FLB struct. - Add an ASCII diagram for FLB memory layout. - Change compatibility to iommu-liveupdate-v1. - Rename structs to more reasonable names. - Add comment explaining the rationale for BUG_ON during restoration. - Rename 'did' to 'attachment_id'. - Use phys_to_virt() and virt_to_phys() consistently. - Create separate functions for FLB unpreserve and folio_put. - Return the virtual address from the restore_array function. - Free serialized state on finish without checking for NULL. - Rename 'iommu-lu.h' to 'iommu-liveupdate.h'. - Suffix max with _per_page (iommu_max_objs_per_page). - Move unused helpers to the patches that actually need them. - Rename reserve_obj_ser to alloc_object_ser. - Only allow vfio drivers to use preserve_device APIs. - Move ops declarations under CONFIG_IOMMU_LIVEUPDATE guards. - Add lockdep_assert_held() validations in locked functions. - Rename device_ser_match to match_device_ser. - Create iommu_folio_update_stats(folio, nr_pages) helper. - Explicitly set incoherent flag to false for restored pages. - Do not use unpreserve_pages() function for error handling. - Preserve vasz and sign_extend of a domain. - Make the restored domain free-only. - Ignore error of pt_descend() during restore as it should never fail (dead code). - On domain restore, clear all features except the preserved. - Add a KUnit test to verify that a restored domain can be freed with zeroed features. - Bypass paging_domain_compatible() checks for restored domains. - Use an explicit if-check for preserved state to clear the context entries. - Rename clean_context to clear_unpreserved_context_entries. - Use "DMAR:" in pr_fmt instead of "iommu:". - Pass ROOT_ENTRY_NR directly into unpreserve functions. - Remove IOMMU lock during preserve as not needed. - Iterate all devices when clearing context entries instead of just PCIe devices. - Do not populate empty unpreserve_device callbacks if not needed. - Rename unpreserve_iommu_context to unpreserve_iommu_context_table. - Check the associated IOMMU in _restore_used_domain_id. - Add a comment that MMIO base is used as token for identifying IOMMU. - Add a comment in _restore_used_domain_ids that IDA allocation can safely fail. - Mark IOMMU state restored after restoring to prevent double restoration and UAF. - Fix domain leak in iommu_restore_domain error path. - Check DID start range before allocation. - Add lockdep_assert_held in group domain restoration path. - Add WARN_ON to catch unexpected group ownership during device probe. - Add comment explaining group ownership setup and reclaim during device probe. - Cleanup the full PASID directory instead of only 4K. - Rename ioctl to IOMMU_HWPT_LIVEUPDATE_MARK_PRESERVE. - Use XArray to save the HWPT liveupdate marks. - Add the ioctl struct to ucmd_buffer. - Make the ioctl 64-bit aligned (struct padding). - Add UAPI documentation stating that HWPTs cannot be unmarked. - Add UAPI documentation stating that only file-based mappings are allowed. - Rename structs to use "liveupdate" instead of "lu". - Rework HWPT preservation to prevent TOCTOU and mutex lock inside XA spin lock. - Check preserved pages at the IOPT level, not the HWPT level. - Return -EOPNOTSUPP if there are PASID attachments. - Do not allow detach (or attach) once the device is preserved. - Add MODULE_IMPORT_NS("IOMMUFD") in vfio_pci_liveupdate.c. - Make token u64. - Modify selftest to use live update kexec_test pattern. - Use helper macros in test instead of repeating ksft_assert - Rename setup_cdev to open_cdev. - Define constants (tokens) as u64 to avoid ABI warnings. v5: https://lore.kernel.org/all/20260921004834.2601285-1-skhawaja@google.com/ v4: https://lore.kernel.org/kvm/20260808022723.3893618-1-skhawaja@google.com/ v3: https://lore.kernel.org/all/20260614233728.2212104-1-skhawaja@google.com/ v2: https://lore.kernel.org/all/20260427175633.1978233-1-skhawaja@google.com/ v1: https://lore.kernel.org/all/20260203220948.2176157-1-skhawaja@google.com/ rfcv2: https://lore.kernel.org/all/20251202230303.1017519-1-skhawaja@google.com/ rfcv1: https://lore.kernel.org/all/20250928190624.3735830-1-skhawaja@google.com/ Samiullah Khawaja (16): iommu: Implement IOMMU Live update FLB callbacks iommu/pages: Add APIs to preserve/unpreserve/restore iommu pages iommupt: Implement preserve/unpreserve/restore callbacks iommu: Implement IOMMU domain preservation iommu: Implement device and IOMMU HW preservation iommu/vt-d: Implement device and iommu preserve/unpreserve ops iommu/vt-d: Clear unpreserved context entries during shutdown iommu: Add APIs to get iommu and device preserved state iommu/vt-d: Combine disable_dmar_iommu() and free_dmar_iommu() iommu/vt-d: Restore IOMMU state and reclaimed domain ids iommu/vt-d: Preserve PASID table of preserved device iommu: Restore and reattach preserved domains to devices iommu/vt-d: Handle reattach of the restored domain iommufd: Add APIs to preserve/unpreserve a vfio cdev vfio/pci: Preserve the iommufd state of the vfio cdev iommufd/selftest: Add test to verify iommufd preservation YiFei Zhu (2): iommufd: Implement ioctl to mark HWPT for preservation iommufd: Persist iommu hardware pagetables for live update MAINTAINERS | 19 + drivers/iommu/Kconfig | 12 + drivers/iommu/Makefile | 1 + drivers/iommu/generic_pt/iommu_pt.h | 155 ++++ drivers/iommu/generic_pt/kunit_iommu_pt.h | 30 + drivers/iommu/intel/Makefile | 1 + drivers/iommu/intel/iommu.c | 162 ++-- drivers/iommu/intel/iommu.h | 46 ++ drivers/iommu/intel/liveupdate.c | 766 ++++++++++++++++++ drivers/iommu/intel/pasid.c | 10 +- drivers/iommu/intel/pasid.h | 8 + drivers/iommu/iommu-pages.c | 109 ++- drivers/iommu/iommu-pages.h | 30 + drivers/iommu/iommu-priv.h | 2 + drivers/iommu/iommu.c | 185 ++++- drivers/iommu/iommufd/Makefile | 1 + drivers/iommu/iommufd/device.c | 156 ++++ drivers/iommu/iommufd/io_pagetable.c | 24 + drivers/iommu/iommufd/iommufd_private.h | 39 + drivers/iommu/iommufd/liveupdate.c | 399 +++++++++ drivers/iommu/iommufd/main.c | 19 +- drivers/iommu/liveupdate.c | 743 +++++++++++++++++ drivers/vfio/device_cdev.c | 10 + drivers/vfio/pci/vfio_pci_liveupdate.c | 28 +- include/linux/generic_pt/iommu.h | 30 + include/linux/iommu-liveupdate.h | 224 +++++ include/linux/iommu.h | 38 + include/linux/iommufd.h | 29 + include/linux/kho/abi/iommu.h | 234 ++++++ include/linux/kho/abi/iommufd.h | 56 ++ include/uapi/linux/iommufd.h | 27 + tools/testing/selftests/iommu/Makefile | 12 + .../iommu/iommufd_liveupdate_kexec_test.c | 262 ++++++ 33 files changed, 3797 insertions(+), 70 deletions(-) create mode 100644 drivers/iommu/intel/liveupdate.c create mode 100644 drivers/iommu/iommufd/liveupdate.c create mode 100644 drivers/iommu/liveupdate.c create mode 100644 include/linux/iommu-liveupdate.h create mode 100644 include/linux/kho/abi/iommu.h create mode 100644 include/linux/kho/abi/iommufd.h create mode 100644 tools/testing/selftests/iommu/iommufd_liveupdate_kexec_test.c base-commit: 7b7429c28ac01c8a2952225a4b8a742eec7359c3 -- 2.56.0.257.gf7497c7d27-goog