[PATCH 18/18] selftests/liveupdate: pci: Test ACS with pci=config_acs
From: David Matlack
Date: Tue Dec 01 2026 - 19:41:13 EST
Add a PCI Live Update test that configures different ACS controls in
each kernel with pci=config_acs=. The next kernel must keep the ACS
controls of the root port above the preserved endpoint, and apply its
own to the root port above the control endpoint, which the test checks
with -x acs.
Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>
---
.../testing/selftests/liveupdate/pci/acs.vmtest.sh | 14 ++++++++++++++
.../selftests/liveupdate/pci/luo_pci_test.c | 10 ++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/liveupdate/pci/acs.vmtest.sh
diff --git a/tools/testing/selftests/liveupdate/pci/acs.vmtest.sh b/tools/testing/selftests/liveupdate/pci/acs.vmtest.sh
new file mode 100644
index 000000000000..6bc7f0980cbd
--- /dev/null
+++ b/tools/testing/selftests/liveupdate/pci/acs.vmtest.sh
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Configure different ACS controls in each kernel. The next kernel must adopt
+# the ACS controls of bridges above a preserved endpoint, and apply its own to
+# the root port above the control endpoint.
+
+source "$test_dir/pci/pci_vmtest_lib.sh"
+
+pci_topology_root_ports
+
+# Bits, from most to least significant: DT EC UF CR RR TB SV
+TEST_ARGS+=(-x acs)
+TEST_CMDLINE_STAGE1="pci=config_acs=xx11101@pci:0:0"
+TEST_CMDLINE_STAGE2="pci=config_acs=xx00000@pci:0:0"
diff --git a/tools/testing/selftests/liveupdate/pci/luo_pci_test.c b/tools/testing/selftests/liveupdate/pci/luo_pci_test.c
index 4ee6f3a5f307..304f3b3ef1c9 100644
--- a/tools/testing/selftests/liveupdate/pci/luo_pci_test.c
+++ b/tools/testing/selftests/liveupdate/pci/luo_pci_test.c
@@ -12,8 +12,8 @@
* preserve.
* -x <reg>[,...] Optional. Registers that must change across the Live
* Update on bridges above the control endpoint (and not
- * above the preserved endpoint): "ari" for ARI Forwarding
- * Enable.
+ * above the preserved endpoint): "acs" for the ACS
+ * controls, "ari" for ARI Forwarding Enable.
* -m <bdf> Optional device whose config space is written to mark the
* phases of the test in a QEMU trace of config writes.
*
@@ -546,6 +546,12 @@ static void check_devices(const char *when, const struct pci_snapshot *taken)
check(!(now.command & PCI_COMMAND_MASTER),
"%s: Bus Master still enabled on control device",
dev->bdf);
+ if (dev->bridge && control_changes("acs")) {
+ check(dev->acs, "%s: No ACS capability", dev->bdf);
+ check(!dev->acs || now.acs_ctrl != dev->acs_ctrl,
+ "%s: ACS controls did not change (0x%04x)",
+ dev->bdf, now.acs_ctrl);
+ }
if (dev->bridge && control_changes("ari")) {
check(dev->pcie, "%s: Not a PCIe device", dev->bdf);
check(!dev->pcie ||
--
2.56.1.911.g883d8bcb20-goog