r8169: fix dmar pte write access is not set error
authorChunhao Lin <hau@realtek.com>
Mon, 26 Dec 2022 12:31:53 +0000 (20:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:24:31 +0000 (07:24 +0100)
commitaf0bedfbcb81412bb95738937267744f45358dee
tree576f717277f9ec6767f44d6fed9e052f301ef3bf
parent315a779c838d3dbc1a645069d6f028bc1e953f73
r8169: fix dmar pte write access is not set error

[ Upstream commit bb41c13c05c23d9bc46b4e37d8914078c6a40e3a ]

When close device, if wol is enabled, rx will be enabled. When open
device it will cause rx packet to be dma to the wrong memory address
after pci_set_master() and system log will show blow messages.

DMAR: DRHD: handling fault status reg 3
DMAR: [DMA Write] Request device [02:00.0] PASID ffffffff fault addr
ffdd4000 [fault reason 05] PTE Write access is not set

In this patch, driver disable tx/rx when close device. If wol is
enabled, only enable rx filter and disable rxdv_gate(if support) to
let hardware only receive packet to fifo but not to dma it.

Signed-off-by: Chunhao Lin <hau@realtek.com>
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/realtek/r8169_main.c