mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Charkov <alchark@gmail.com>
To: Kevin Brace <kevinbrace@bracecomputerlab.com>,
	 Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	 Alexey Charkov <alchark@gmail.com>,
	Rob Herring <robh@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net] net: via-rhine: Stop the NIC on platform device shutdown
Date: Fri, 13 Nov 2026 17:01:05 +0400	[thread overview]
Message-ID: <20261113-vt8500-rhine-shutdown-v1-1-9448ea9548ec@gmail.com> (raw)

Close a running interface on platform device shutdown, so that the chip
stops its receive DMA before kexec hands its memory to the next kernel.
Do it in the driver, as the platform (OF) variant lacks a .shutdown
callback and nothing else stops it, unlike for PCI, where the core
clears bus mastering ahead of kexec.

Keep incoming frames from landing in receive buffers the old kernel had
allocated: on a WonderMedia WM8950 board, broadcast traffic alone
corrupts the next kernel at random points as it decompresses and boots,
hanging about a third of kexec attempts early on, e.g. with
"unrecognized/unsupported processor variant".

Fixes: 2d283862dc62 ("net: via-rhine: add OF bus binding")
Signed-off-by: Alexey Charkov <alchark@gmail.com>
---
 drivers/net/ethernet/via/via-rhine.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index e56ebbdd428d..dbbbaf7f20ac 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -2461,6 +2461,17 @@ static void rhine_remove_one_platform(struct platform_device *pdev)
 	free_netdev(dev);
 }
 
+static void rhine_shutdown_platform(struct platform_device *pdev)
+{
+	struct net_device *dev = platform_get_drvdata(pdev);
+
+	rtnl_lock();
+	netif_device_detach(dev);
+	if (netif_running(dev))
+		dev_close(dev);
+	rtnl_unlock();
+}
+
 static void rhine_shutdown_pci(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
@@ -2580,6 +2591,7 @@ static struct pci_driver rhine_driver_pci = {
 static struct platform_driver rhine_driver_platform = {
 	.probe		= rhine_init_one_platform,
 	.remove		= rhine_remove_one_platform,
+	.shutdown	= rhine_shutdown_platform,
 	.driver = {
 		.name	= DRV_NAME,
 		.of_match_table	= rhine_of_tbl,

---
base-commit: ead6fa9a0ab194f02a2f36d634b193e9c5f9a1c6
change-id: 20261113-vt8500-rhine-shutdown-b2ac8a702688

Best regards,
--  
Alexey Charkov <alchark@gmail.com>


             reply	other threads:[~2026-11-13 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 13:01 Alexey Charkov [this message]
2026-11-19  0:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113-vt8500-rhine-shutdown-v1-1-9448ea9548ec@gmail.com \
    --to=alchark@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kevinbrace@bracecomputerlab.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®