Re: [PATCH v11 09/13] PCI: liveupdate: Adopt ACS controls in incoming preserved devices

From: Pranjal Shrivastava

Date: Fri Nov 20 2026 - 10:17:41 EST


On Wed, Nov 18, 2026 at 10:37:00PM +0000, David Matlack wrote:
> Adopt Access Control Services (ACS) controls on all incoming preserved
> devices (endpoints and upstream bridges) during a Live Update.
>
> Adopting ACS controls avoids changing routing rules while memory
> transactions are in flight from preserved devices. It also keeps IOMMU
> groups from changing during or after Live Update.
>
> The adopted controls are recorded by the pci_save_state() call in
> pci_bus_add_device(), which runs before drivers bind, so they are
> reapplied by pci_restore_state() if the device is reset. Allocate the
> ACS save buffer for incoming preserved devices even if they match a
> device-specific ACS quirk, since their adopted controls live in the ACS
> capability, and panic if it could not be allocated.
>
> To simplify ACS adoption, reject preserving any devices that require
> quirks to enable ACS as those quirks would also have to take Live Update
> into account. If such a quirk matches an incoming preserved device
> anyway, e.g. because it was added in the new kernel, log a warning and
> adopt the device's ACS controls regardless, rather than reprogram a
> device in the path of a preserved device's memory transactions.
>
> Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
> ---
> drivers/pci/liveupdate.c | 75 ++++++++++++++++++++++++++++++++++++++++
> drivers/pci/liveupdate.h | 16 +++++++++
> drivers/pci/pci.c | 13 +++++--
> 3 files changed, 102 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c
> index 00d6fa5236e9..b99a88c2c199 100644
> --- a/drivers/pci/liveupdate.c
> +++ b/drivers/pci/liveupdate.c
> @@ -123,6 +123,9 @@
> *
> * * The device cannot be a Virtual Function (VF).
> *
> + * * The device cannot require device-specific quirks to enable Access
> + * Control Services (ACS).
> + *

[...]

> +#include "liveupdate.h"
> #include "pci.h"
>
> DEFINE_MUTEX(pci_slot_mutex);
> @@ -1071,9 +1073,13 @@ static void pci_allocate_acs_save_buffer(struct pci_dev *dev)
> /*
> * Devices that rely on device-specific quirks to enable an ACS
> * equivalent keep that configuration outside of the ACS Control
> - * register, so they are configured from scratch on restore.
> + * register, so they are configured from scratch on restore. The
> + * exception is devices preserved across a Live Update, which always
> + * adopt the ACS controls established by the previous kernel and need
> + * the buffer to keep them across resets.
> */
> - if (pci_need_dev_specific_enable_acs(dev))
> + if (pci_need_dev_specific_enable_acs(dev) &&
> + !pci_liveupdate_was_incoming(dev))
> return;
>

The ACS save buffer is forced for incoming devices that match an
enable_acs quirk, but neither existing quirk keeps its controls where
the generic code saves them (Intel PCH Root Ports have no ACS cap,
SPT/UPT has the Control register at +8, not +6). Is the intent that
such devices just lose their adopted controls if they ever lose config
state later? (e.g. a Root Port D3 cycle after pci_liveupdate_finish())
If so, maybe worth calling it out in a comment?

Apart from that:

Reviewed-by: Pranjal Shrivastava <praan@xxxxxxxxxx>

Thanks,
Praan