From: David Matlack <dmatlack@google.com>
To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, linux-pci@vger.kernel.org
Cc: "Adithya Jayachandran" <ajayachandra@nvidia.com>,
"Alexander Graf" <graf@amazon.com>,
"Alex Williamson" <alex@shazbot.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"David Matlack" <dmatlack@google.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Jacob Pan" <jacob.pan@linux.microsoft.com>,
"Jason Gunthorpe" <jgg@nvidia.com>,
"Josh Hilke" <jrhilke@google.com>,
"Leon Romanovsky" <leonro@nvidia.com>,
"Logan Gunthorpe" <logang@deltatee.com>,
"Lukas Wunner" <lukas@wunner.de>,
"Mike Rapoport" <rppt@kernel.org>,
"Parav Pandit" <parav@nvidia.com>,
"Pasha Tatashin" <pasha.tatashin@soleen.com>,
"Pranjal Shrivastava" <praan@google.com>,
"Pratyush Yadav" <pratyush@kernel.org>,
"Saeed Mahameed" <saeedm@nvidia.com>,
"Samiullah Khawaja" <skhawaja@google.com>,
"Vipin Sharma" <vipinsh@google.com>,
"William Tu" <witu@nvidia.com>
Subject: [PATCH 00/10] PCI: liveupdate: Keep preserved devices accessible across Live Update
Date: Mon, 19 Oct 2026 21:30:44 +0000 [thread overview]
Message-ID: <20261019213054.3157159-1-dmatlack@google.com> (raw)
This series can be found on GitHub:
https://github.com/dmatlack/linux/tree/liveupdate/pci/p2pdma/v1
This series builds on the PCI core support for Live Update [1] to allow
memory transactions targeting preserved PCI devices to proceed
uninterrupted across a Live Update. The base series allows preserved
devices to perform DMA to system memory across a Live Update, but the
next kernel still sizes, probes, and may reassign the BARs and bridge
windows of preserved devices during enumeration, which disables
decoding or moves address ranges out from under anything that is still
accessing them.
Use cases include:
- P2PDMA between preserved devices, e.g. between devices assigned to
the same VM via VFIO.
- MMIO from Orphaned VMs [2], whose vCPUs keep running in guest mode
on dedicated CPUs during kexec, and therefore keep accessing the
BARs of devices assigned to them throughout the Live Update.
To support this, the BAR addresses and bridge windows of preserved
devices must not change across a Live Update, and the next kernel must
not disable decoding or forwarding on preserved devices or on the
bridges above them while enumerating them and assigning resources.
[1] https://lore.kernel.org/linux-pci/20261013162529.1928093-1-dmatlack@google.com/
[2] https://lore.kernel.org/kvm/20260920193650.3373435-1-pasha.tatashin@soleen.com/
Series Overview
---------------
This series implements the following:
1. Avoid sizing the BARs of incoming preserved devices. Sizing a BAR
requires disabling decoding. Instead, have the previous kernel
pass the BAR masks (the values the BARs return when read after
writing all 1s) and decode the BARs from those (patches 1-2).
2. Avoid probing which windows incoming preserved bridges implement,
which temporarily disables the prefetchable window. Instead, add a
generic mechanism for passing the results of probes that require
writing to the device, and use it to pass which windows each
bridge implements (patches 3-4).
3. Skip programming bridge windows that already contain the values
being written, so that pci_setup_bridge() does not temporarily
disable the windows of preserved bridges. This applies to all
bridges, not only preserved ones (patch 5).
4. Claim the BARs and bridge windows of incoming preserved devices,
as programmed by the previous kernel, while scanning and before
anything sizes or assigns resources, regardless of how the host
bridge driver sets up resources. Panic if they cannot be claimed,
since that means something else may be decoding the same address
range (patch 6).
5. Prevent the PCI core from assigning, releasing, or realigning the
resources of incoming preserved devices (patches 7-9).
6. Avoid enabling INTx on incoming preserved devices, both while
probing whether INTx masking works and when the device is enabled
(patch 10).
All new behavior applies only to incoming preserved devices, i.e. only
after a Live Update and only until pci_liveupdate_finish(), except for
patch 5, which avoids redundant writes for all bridges.
ABI Changes
-----------
This series uses the optional feature flags added to struct pci_ser in
v10 of the base series to append new fields to struct pci_dev_ser:
- PCI_SER_OPTIONAL_BAR_MASKS: @bar_masks and @rom_mask.
- PCI_SER_OPTIONAL_PROBED: @probed_supported and @probed, a bitmask
of probe results (which windows a bridge implements, and whether
INTx masking is broken).
The ABI only contains hardware state (register values and the results
of probing hardware), not kernel-internal state such as IORESOURCE_*
flags. If the previous kernel did not pass a field, the next kernel
falls back to sizing or probing the device as before.
Merge Plan
----------
This series applies on top of v10 of the PCI core support for Live
Update series [1], which is targeting Linux 7.5. This series is
targeting Linux 7.6, or 7.5 if feasible.
Both series will be merged through liveupdate.git, matching the
agreed-upon tree in the MAINTAINERS entry for PCI LIVE UPDATE.
Testing
-------
This series was tested in conjunction with v5 of the VFIO PCI driver
series:
https://lore.kernel.org/kvm/20260714151505.3466855-1-vipinsh@google.com/
The full set of patches used for testing can be found on GitHub.
https://github.com/dmatlack/linux/tree/liveupdate/pci/p2pdma/v1-with-vfio
Testing was performed using vfio_pci_liveupdate_kexec_test with the igb
selftest driver, which keeps the device performing DMA while kexec
happens. QEMU traced every PCI config write, and each run checked that
the next kernel did not write to the BAR, ROM, bridge window, or bus
number registers of the preserved device or any bridge upstream of it,
did not change their decode or Bus Master Enable bits, and did not
enable INTx on them, and that their BARs and windows had the same
values before and after kexec. The following configurations were
tested:
- x86 (q35): igb behind a root port.
- x86 (q35): igb behind a PCIe switch (root port, upstream port,
downstream port), with a non-preserved device on another downstream
port of the same switch.
- arm64 (virt, SMMUv3, generic ECAM host bridge): igb behind a root
port. This exercises the path where bridge windows are not read
from hardware during scanning.
Future Work
-----------
Please see the PCI core Live Update Roadmap:
https://lore.kernel.org/linux-pci/20261001232133.560284-1-dmatlack@google.com/
David Matlack (10):
PCI: Factor out BAR sizing from pci_read_bases()
PCI: liveupdate: Avoid sizing BARs of incoming devices
PCI: Factor out bridge window probing from pci_read_bridge_windows()
PCI: liveupdate: Avoid probing windows of incoming bridges
PCI: Skip programming bridge windows that are already programmed
PCI: liveupdate: Claim resources of incoming devices during scanning
PCI: liveupdate: Never assign resources of incoming devices
PCI: liveupdate: Prevent releasing resource windows of incoming
bridges
PCI: liveupdate: Don't realign resources of incoming devices
PCI: liveupdate: Avoid enabling INTx on incoming devices
drivers/pci/liveupdate.c | 363 +++++++++++++++++++++++++++++++++++-
drivers/pci/liveupdate.h | 26 +++
drivers/pci/pci.c | 18 ++
drivers/pci/probe.c | 110 ++++++++---
drivers/pci/setup-bus.c | 62 ++++--
include/linux/kho/abi/pci.h | 52 +++++-
6 files changed, 589 insertions(+), 42 deletions(-)
base-commit: 312200e9211ede3f9a03cc17d094805e06e4674e
--
2.56.0.212.g129ede20d9-goog
next reply other threads:[~2026-10-19 21:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 21:30 David Matlack [this message]
2026-10-19 21:30 ` [PATCH 01/10] PCI: Factor out BAR sizing from pci_read_bases() David Matlack
2026-10-19 21:30 ` [PATCH 02/10] PCI: liveupdate: Avoid sizing BARs of incoming devices David Matlack
2026-10-19 21:30 ` [PATCH 03/10] PCI: Factor out bridge window probing from pci_read_bridge_windows() David Matlack
2026-10-19 21:30 ` [PATCH 04/10] PCI: liveupdate: Avoid probing windows of incoming bridges David Matlack
2026-10-19 21:30 ` [PATCH 05/10] PCI: Skip programming bridge windows that are already programmed David Matlack
2026-10-19 21:30 ` [PATCH 06/10] PCI: liveupdate: Claim resources of incoming devices during scanning David Matlack
2026-10-19 21:30 ` [PATCH 07/10] PCI: liveupdate: Never assign resources of incoming devices David Matlack
2026-10-19 21:30 ` [PATCH 08/10] PCI: liveupdate: Prevent releasing resource windows of incoming bridges David Matlack
2026-10-19 21:30 ` [PATCH 09/10] PCI: liveupdate: Don't realign resources of incoming devices David Matlack
2026-10-19 21:30 ` [PATCH 10/10] PCI: liveupdate: Avoid enabling INTx on " David Matlack
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=20261019213054.3157159-1-dmatlack@google.com \
--to=dmatlack@google.com \
--cc=ajayachandra@nvidia.com \
--cc=alex@shazbot.org \
--cc=bhelgaas@google.com \
--cc=graf@amazon.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jacob.pan@linux.microsoft.com \
--cc=jgg@nvidia.com \
--cc=jrhilke@google.com \
--cc=kexec@lists.infradead.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=lukas@wunner.de \
--cc=parav@nvidia.com \
--cc=pasha.tatashin@soleen.com \
--cc=praan@google.com \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=saeedm@nvidia.com \
--cc=skhawaja@google.com \
--cc=vipinsh@google.com \
--cc=witu@nvidia.com \
/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
all inboxes | Powered by JetHome®