All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] r8169: fix DMA being used after buffer free if WoL is enabled
@ 2021-03-20 20:40 Heiner Kallweit
  2021-03-21  2:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2021-03-20 20:40 UTC (permalink / raw)
  To: Realtek linux nic maintainers, Jakub Kicinski, David Miller
  Cc: netdev, Paul Blazejowski

IOMMU errors have been reported if WoL is enabled and interface is
brought down. It turned out that the network chip triggers DMA
transfers after the DMA buffers have been freed. For WoL to work we
need to leave rx enabled, therefore simply stop the chip from being
a DMA busmaster.

Fixes: 567ca57faa62 ("r8169: add rtl8169_up")
Tested-by: Paul Blazejowski <paulb@blazebox.homeip.net>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index 8ea6ddc7d..0d7001303 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -4644,6 +4644,9 @@ static void rtl8169_down(struct rtl8169_private *tp)
 
 	rtl8169_update_counters(tp);
 
+	pci_clear_master(tp->pci_dev);
+	rtl_pci_commit(tp);
+
 	rtl8169_cleanup(tp, true);
 
 	rtl_prepare_power_down(tp);
@@ -4651,6 +4654,7 @@ static void rtl8169_down(struct rtl8169_private *tp)
 
 static void rtl8169_up(struct rtl8169_private *tp)
 {
+	pci_set_master(tp->pci_dev);
 	phy_resume(tp->phydev);
 	rtl8169_init_phy(tp);
 	napi_enable(&tp->napi);
@@ -5305,8 +5309,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	rtl_hw_reset(tp);
 
-	pci_set_master(pdev);
-
 	rc = rtl_alloc_irq(tp);
 	if (rc < 0) {
 		dev_err(&pdev->dev, "Can't allocate interrupt\n");
-- 
2.31.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] r8169: fix DMA being used after buffer free if WoL is enabled
  2021-03-20 20:40 [PATCH net] r8169: fix DMA being used after buffer free if WoL is enabled Heiner Kallweit
@ 2021-03-21  2:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-21  2:10 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: nic_swsd, kuba, davem, netdev, paulb

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sat, 20 Mar 2021 21:40:08 +0100 you wrote:
> IOMMU errors have been reported if WoL is enabled and interface is
> brought down. It turned out that the network chip triggers DMA
> transfers after the DMA buffers have been freed. For WoL to work we
> need to leave rx enabled, therefore simply stop the chip from being
> a DMA busmaster.
> 
> Fixes: 567ca57faa62 ("r8169: add rtl8169_up")
> Tested-by: Paul Blazejowski <paulb@blazebox.homeip.net>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net] r8169: fix DMA being used after buffer free if WoL is enabled
    https://git.kernel.org/netdev/net/c/f658b90977d2

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-21  2:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-20 20:40 [PATCH net] r8169: fix DMA being used after buffer free if WoL is enabled Heiner Kallweit
2021-03-21  2:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.