[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250728-luo-pci-v1-18-955b078dd653@kernel.org>
Date: Mon, 28 Jul 2025 01:24:48 -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 18/25] PCI/LUO: Restore pci_dev fields during probe
From: Jason Miu <jasonmiu@...gle.com>
- pci_intx_mask_broken flag:
This is a flag showing the PCI_COMMAND_INTX_DISABLE writability. Some
devices PCI_COMMAND_INTX_DISABLE register is not writable, and this
flag is used to report this capability. This flag is also updated in
the driver/pci/quirks.c for fixing some devices, but those flags are
static as the checking and udpating are being done for each device
model, so we only restore the flag value from liveupdate in the PCI
device setup.
- pref_window and pref_64_window flags:
Restore the pref_window and pref_64_window flags for a bridge
device. These flags are managed by the function
`pci_read_bridge_windows()` during the PCI device setup. Since we
cannot write the PCI_PREF memory after a liveupdate reboot, so we
restore the saved state from liveupdate.
It is expected the following patches will skip the bridge device Pref
window test in a liveupdate boot.
- hotplug_user_indicators flags:
Restore the hotplug_user_indicators flag for a PCI device. This flag
is for managing platform-specific indicators, so during setting up the
PCI device, restore this information from the Liveupdate.
For the flag usage, see more in 576243b3f9ea.
- ignore_hotplug flag:
The flag ignore_hotplug is managed by the function
`pci_ignore_hotplug()`, which is used by PCI drivers during a suspend
operation. We restore this flag when a PCI device is setting up, to
preserve the device state.
Tested: QEMU VM boot test
Signed-off-by: Chris Li <chrisl@...nel.org>
---
drivers/pci/probe.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 7dd2cf9f9e110636f8998df22a333638cce25e6b..d8b80e1c4fb35289208d7c953fb5c1e137a5c1a8 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2059,7 +2059,24 @@ int pci_setup_device(struct pci_dev *dev)
}
}
- dev->broken_intx_masking = pci_intx_mask_broken(dev);
+ /*
+ * Restore PCI device fields:
+ * - Broken INTx masking and can't be used
+ * - Ignore hotplug events
+ * - Have the SlotCtl indicators controlled exclusively by user sysfs
+ * - Pref mem window availiblity of a bridge device
+ * - Pref mem window is 64-bit
+ */
+ dev->broken_intx_masking = PCI_SER_GET(dev, broken_intx_masking,
+ pci_intx_mask_broken(dev));
+ dev->ignore_hotplug = PCI_SER_GET(dev, ignore_hotplug,
+ dev->ignore_hotplug);
+ dev->hotplug_user_indicators = PCI_SER_GET(dev, hotplug_user_indicators,
+ dev->hotplug_user_indicators);
+ dev->pref_window = PCI_SER_GET(dev, pref_window,
+ dev->pref_window);
+ dev->pref_64_window = PCI_SER_GET(dev, pref_64_window,
+ dev->pref_64_window);
switch (dev->hdr_type) { /* header type */
case PCI_HEADER_TYPE_NORMAL: /* standard header */
--
2.50.1.487.gc89ff58d15-goog
Powered by blists - more mailing lists