All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3 0/2] fix dmar pte write access is not set error
@ 2022-12-26 12:31 Chunhao Lin
  2022-12-26 12:31 ` [PATCH net v3 1/2] r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down() Chunhao Lin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chunhao Lin @ 2022-12-26 12:31 UTC (permalink / raw)
  To: hkallweit1; +Cc: netdev, nic_swsd, Chunhao Lin

This series fixes dmar pte write access is not set error.

Chunhao Lin (2):
  r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down()
  r8169: fix dmar pte write access is not set error

v2:
-update commit message
-adjust the code according to current kernel code
v3:
-update title and commit message
-split the patch

 drivers/net/ethernet/realtek/r8169_main.c | 58 +++++++++++------------
 1 file changed, 29 insertions(+), 29 deletions(-)

-- 
2.25.1


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

* [PATCH net v3 1/2] r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down()
  2022-12-26 12:31 [PATCH net v3 0/2] fix dmar pte write access is not set error Chunhao Lin
@ 2022-12-26 12:31 ` Chunhao Lin
  2022-12-26 12:47   ` Heiner Kallweit
  2022-12-26 12:31 ` [PATCH net v3 2/2] r8169: fix dmar pte write access is not set error Chunhao Lin
  2022-12-28 12:00 ` [PATCH net v3 0/2] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Chunhao Lin @ 2022-12-26 12:31 UTC (permalink / raw)
  To: hkallweit1; +Cc: netdev, nic_swsd, Chunhao Lin

There is no functional change. Moving these two functions for following
patch "r8169: fix dmar pte write access is not set error".

Signed-off-by: Chunhao Lin <hau@realtek.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 44 +++++++++++------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index a9dcc98b6af1..acc2500342ca 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2210,28 +2210,6 @@ static int rtl_set_mac_address(struct net_device *dev, void *p)
 	return 0;
 }
 
-static void rtl_wol_enable_rx(struct rtl8169_private *tp)
-{
-	if (tp->mac_version >= RTL_GIGA_MAC_VER_25)
-		RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) |
-			AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
-}
-
-static void rtl_prepare_power_down(struct rtl8169_private *tp)
-{
-	if (tp->dash_type != RTL_DASH_NONE)
-		return;
-
-	if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
-	    tp->mac_version == RTL_GIGA_MAC_VER_33)
-		rtl_ephy_write(tp, 0x19, 0xff64);
-
-	if (device_may_wakeup(tp_to_dev(tp))) {
-		phy_speed_down(tp->phydev, false);
-		rtl_wol_enable_rx(tp);
-	}
-}
-
 static void rtl_init_rxcfg(struct rtl8169_private *tp)
 {
 	switch (tp->mac_version) {
@@ -2455,6 +2433,28 @@ static void rtl_enable_rxdvgate(struct rtl8169_private *tp)
 	rtl_wait_txrx_fifo_empty(tp);
 }
 
+static void rtl_wol_enable_rx(struct rtl8169_private *tp)
+{
+	if (tp->mac_version >= RTL_GIGA_MAC_VER_25)
+		RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) |
+			AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
+}
+
+static void rtl_prepare_power_down(struct rtl8169_private *tp)
+{
+	if (tp->dash_type != RTL_DASH_NONE)
+		return;
+
+	if (tp->mac_version == RTL_GIGA_MAC_VER_32 ||
+	    tp->mac_version == RTL_GIGA_MAC_VER_33)
+		rtl_ephy_write(tp, 0x19, 0xff64);
+
+	if (device_may_wakeup(tp_to_dev(tp))) {
+		phy_speed_down(tp->phydev, false);
+		rtl_wol_enable_rx(tp);
+	}
+}
+
 static void rtl_set_tx_config_registers(struct rtl8169_private *tp)
 {
 	u32 val = TX_DMA_BURST << TxDMAShift |
-- 
2.25.1


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

* [PATCH net v3 2/2] r8169: fix dmar pte write access is not set error
  2022-12-26 12:31 [PATCH net v3 0/2] fix dmar pte write access is not set error Chunhao Lin
  2022-12-26 12:31 ` [PATCH net v3 1/2] r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down() Chunhao Lin
@ 2022-12-26 12:31 ` Chunhao Lin
  2022-12-26 12:47   ` Heiner Kallweit
  2022-12-28 12:00 ` [PATCH net v3 0/2] " patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Chunhao Lin @ 2022-12-26 12:31 UTC (permalink / raw)
  To: hkallweit1; +Cc: netdev, nic_swsd, Chunhao Lin

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>
---
 drivers/net/ethernet/realtek/r8169_main.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index acc2500342ca..24592d972523 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -2438,6 +2438,9 @@ static void rtl_wol_enable_rx(struct rtl8169_private *tp)
 	if (tp->mac_version >= RTL_GIGA_MAC_VER_25)
 		RTL_W32(tp, RxConfig, RTL_R32(tp, RxConfig) |
 			AcceptBroadcast | AcceptMulticast | AcceptMyPhys);
+
+	if (tp->mac_version >= RTL_GIGA_MAC_VER_40)
+		rtl_disable_rxdvgate(tp);
 }
 
 static void rtl_prepare_power_down(struct rtl8169_private *tp)
@@ -3872,7 +3875,7 @@ static void rtl8169_tx_clear(struct rtl8169_private *tp)
 	netdev_reset_queue(tp->dev);
 }
 
-static void rtl8169_cleanup(struct rtl8169_private *tp, bool going_down)
+static void rtl8169_cleanup(struct rtl8169_private *tp)
 {
 	napi_disable(&tp->napi);
 
@@ -3884,9 +3887,6 @@ static void rtl8169_cleanup(struct rtl8169_private *tp, bool going_down)
 
 	rtl_rx_close(tp);
 
-	if (going_down && tp->dev->wol_enabled)
-		goto no_reset;
-
 	switch (tp->mac_version) {
 	case RTL_GIGA_MAC_VER_28:
 	case RTL_GIGA_MAC_VER_31:
@@ -3907,7 +3907,7 @@ static void rtl8169_cleanup(struct rtl8169_private *tp, bool going_down)
 	}
 
 	rtl_hw_reset(tp);
-no_reset:
+
 	rtl8169_tx_clear(tp);
 	rtl8169_init_ring_indexes(tp);
 }
@@ -3918,7 +3918,7 @@ static void rtl_reset_work(struct rtl8169_private *tp)
 
 	netif_stop_queue(tp->dev);
 
-	rtl8169_cleanup(tp, false);
+	rtl8169_cleanup(tp);
 
 	for (i = 0; i < NUM_RX_DESC; i++)
 		rtl8169_mark_to_asic(tp->RxDescArray + i);
@@ -4605,7 +4605,7 @@ static void rtl8169_down(struct rtl8169_private *tp)
 	pci_clear_master(tp->pci_dev);
 	rtl_pci_commit(tp);
 
-	rtl8169_cleanup(tp, true);
+	rtl8169_cleanup(tp);
 	rtl_disable_exit_l1(tp);
 	rtl_prepare_power_down(tp);
 }
-- 
2.25.1


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

* Re: [PATCH net v3 1/2] r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down()
  2022-12-26 12:31 ` [PATCH net v3 1/2] r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down() Chunhao Lin
@ 2022-12-26 12:47   ` Heiner Kallweit
  0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2022-12-26 12:47 UTC (permalink / raw)
  To: Chunhao Lin; +Cc: netdev, nic_swsd

On 26.12.2022 13:31, Chunhao Lin wrote:
> There is no functional change. Moving these two functions for following
> patch "r8169: fix dmar pte write access is not set error".
> 
> Signed-off-by: Chunhao Lin <hau@realtek.com>
> ---
>  drivers/net/ethernet/realtek/r8169_main.c | 44 +++++++++++------------
>  1 file changed, 22 insertions(+), 22 deletions(-)
> 
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>

Note: This series doesn't apply on kernel versions older than 5.15


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

* Re: [PATCH net v3 2/2] r8169: fix dmar pte write access is not set error
  2022-12-26 12:31 ` [PATCH net v3 2/2] r8169: fix dmar pte write access is not set error Chunhao Lin
@ 2022-12-26 12:47   ` Heiner Kallweit
  0 siblings, 0 replies; 6+ messages in thread
From: Heiner Kallweit @ 2022-12-26 12:47 UTC (permalink / raw)
  To: Chunhao Lin; +Cc: netdev, nic_swsd

On 26.12.2022 13:31, Chunhao Lin wrote:
> 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>


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

* Re: [PATCH net v3 0/2] fix dmar pte write access is not set error
  2022-12-26 12:31 [PATCH net v3 0/2] fix dmar pte write access is not set error Chunhao Lin
  2022-12-26 12:31 ` [PATCH net v3 1/2] r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down() Chunhao Lin
  2022-12-26 12:31 ` [PATCH net v3 2/2] r8169: fix dmar pte write access is not set error Chunhao Lin
@ 2022-12-28 12:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-28 12:00 UTC (permalink / raw)
  To: Chunhao Lin; +Cc: hkallweit1, netdev, nic_swsd

Hello:

This series was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Mon, 26 Dec 2022 20:31:51 +0800 you wrote:
> This series fixes dmar pte write access is not set error.
> 
> Chunhao Lin (2):
>   r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down()
>   r8169: fix dmar pte write access is not set error
> 
> v2:
> -update commit message
> -adjust the code according to current kernel code
> v3:
> -update title and commit message
> -split the patch
> 
> [...]

Here is the summary with links:
  - [net,v3,1/2] r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down()
    https://git.kernel.org/netdev/net/c/ad425666a1f0
  - [net,v3,2/2] r8169: fix dmar pte write access is not set error
    https://git.kernel.org/netdev/net/c/bb41c13c05c2

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] 6+ messages in thread

end of thread, other threads:[~2022-12-28 12:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26 12:31 [PATCH net v3 0/2] fix dmar pte write access is not set error Chunhao Lin
2022-12-26 12:31 ` [PATCH net v3 1/2] r8169: move rtl_wol_enable_rx() and rtl_prepare_power_down() Chunhao Lin
2022-12-26 12:47   ` Heiner Kallweit
2022-12-26 12:31 ` [PATCH net v3 2/2] r8169: fix dmar pte write access is not set error Chunhao Lin
2022-12-26 12:47   ` Heiner Kallweit
2022-12-28 12:00 ` [PATCH net v3 0/2] " 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.