[PATCH net] net: via-velocity: Stop the device on shutdown
From: Roland Waltersson
Date: Thu Nov 19 2026 - 07:47:42 EST
The driver has no .shutdown hook, so on reboot, power off or kexec the
chip is left running after device_shutdown(): it keeps receiving
packets into its RX rings by DMA and raising its interrupt.
Since commit 38f34dba806a ("PM: ACPI: reboot: Reinstate S5 for
reboot"), the ACPI S5 preparation (_PTS(5), wakeup devices, all GPEs
disabled) also runs on reboot, after device_shutdown(). On a congatec
conga-EAF board (AMD G-series) with traffic on the velocity port, a
reboot now and then hangs after
ACPI: PM: Preparing to enter system sleep state S5
reboot: Restarting system
and the board is never reset. Not running the S5 preparation on reboot
avoids the hang.
Stop the device the same way commit 2ca1c94ce0b6 ("tg3: Disable tg3
device on system reboot to avoid triggering AER") did for tg3: add a
PCI .shutdown hook that detaches and closes the interface, which stops
the chip, masks its interrupts and frees the rings, and then disables
the PCI device, which turns off bus mastering.
An interface that is down needs nothing more: velocity_close() has
already stopped it, or it was never opened and probe left the chip in
D3hot.
Fixes: 38f34dba806a ("PM: ACPI: reboot: Reinstate S5 for reboot")
Signed-off-by: Roland Waltersson <rolwal@xxxxxxxxxxxxxx>
---
drivers/net/ethernet/via/via-velocity.c | 27 +++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c
index 6d7b6f3b4..3daf7a8dd 100644
--- a/drivers/net/ethernet/via/via-velocity.c
+++ b/drivers/net/ethernet/via/via-velocity.c
@@ -2942,6 +2942,32 @@ static void velocity_pci_remove(struct pci_dev *pdev)
pci_disable_device(pdev);
}
+/**
+ * velocity_pci_shutdown - stop the device on shutdown
+ * @pdev: PCI device
+ *
+ * Called on reboot, power off and kexec. Close the interface, which
+ * stops the chip and masks its interrupts, and disable the PCI device,
+ * which turns off bus mastering. Otherwise the chip keeps receiving
+ * packets into its rings by DMA and raising interrupts while the rest
+ * of the restart runs.
+ */
+static void velocity_pci_shutdown(struct pci_dev *pdev)
+{
+ struct net_device *netdev = pci_get_drvdata(pdev);
+
+ rtnl_lock();
+
+ netif_device_detach(netdev);
+
+ if (netif_running(netdev))
+ dev_close(netdev);
+
+ rtnl_unlock();
+
+ pci_disable_device(pdev);
+}
+
static int velocity_platform_probe(struct platform_device *pdev)
{
const struct velocity_info_tbl *info;
@@ -3241,6 +3267,7 @@ static struct pci_driver velocity_pci_driver = {
.id_table = velocity_pci_id_table,
.probe = velocity_pci_probe,
.remove = velocity_pci_remove,
+ .shutdown = velocity_pci_shutdown,
.driver = {
.pm = &velocity_pm_ops,
},
base-commit: a8aeac0b1883206cf72461258e6bfd991589049e