[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250728-luo-pci-v1-13-955b078dd653@kernel.org>
Date: Mon, 28 Jul 2025 01:24:43 -0700
From: chrisl@...nel.org
To: Bjorn Helgaas <bhelgaas@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>, Danilo Krummrich <dakr@...nel.org>,
Len Brown <lenb@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
linux-acpi@...r.kernel.org, David Matlack <dmatlack@...gle.com>,
Pasha Tatashin <tatashin@...gle.com>, Jason Miu <jasonmiu@...gle.com>,
Vipin Sharma <vipinsh@...gle.com>, Saeed Mahameed <saeedm@...dia.com>,
Adithya Jayachandran <ajayachandra@...dia.com>,
Parav Pandit <parav@...dia.com>, William Tu <witu@...dia.com>,
Mike Rapoport <rppt@...nel.org>, Chris Li <chrisl@...nel.org>,
Jason Gunthorpe <jgg@...pe.ca>, Leon Romanovsky <leon@...nel.org>
Subject: [PATCH RFC 13/25] PCI/LUO: Check the device function numbers in
restoration
From: Jason Miu <jasonmiu@...gle.com>
After liveupdate reboot, the device BDF shouldn't be changed from the
previous kernel. If this happens, the saved LUO device state cannot be
used, and panic the kernel.
Signed-off-by: Chris Li <chrisl@...nel.org>
---
drivers/pci/liveupdate.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c
index 6b1c14d70fd16b0919ca22faae788069f3743708..ec2d7917441ceb4e3d7cd8becae41ca215cba7c3 100644
--- a/drivers/pci/liveupdate.c
+++ b/drivers/pci/liveupdate.c
@@ -393,6 +393,15 @@ static void pci_dev_do_restore(struct pci_dev *dev, struct pci_dev_ser *s)
pci_info(dev, "liveupdate restore [%s] driver: %s data: [%llx] num_vfs: %d\n",
s->requested ? "requested" : "depended",
s->driver_name, s->driver_data, s->num_vfs);
+
+ /*
+ * The devfn got changed since reboot. We cannot restore device
+ * info preserved by liveupdate
+ */
+ if (s->devfn != dev->devfn)
+ panic("%s: Device and function numbers are changed from 0x%40x to 0x%40x\n",
+ __func__, s->devfn, dev->devfn);
+
list_move_tail(&dev->dev.lu.lu_next, &probe_devices);
}
--
2.50.1.487.gc89ff58d15-goog
Powered by blists - more mailing lists