Skip to contentSkip to conversation

net: ipa: HOLB register write fixes

PATCH Applied Alex Elder 2 participants 4 messages Nov 12, 2021 – Nov 15, 2021

Subsystems (3)
lore
Share & tools
lore

Alex Elder

author
#0 lore raw

cover net: ipa: HOLB register write fixes

This small series fixes two recently identified bugs related to the way two registers must be written. The registers define whether and when to drop packets if a head-of-line blocking condition is encountered. The "enable" (dropping packets) register must be written twice for newer versions of hardware. And the timer register must not be written while dropping is enabled.

-Alex

Alex Elder (2):
net: ipa: HOLB register sometimes must be written twice
net: ipa: disable HOLB drop when updating timer

 drivers/net/ipa/ipa_endpoint.c | 5 +++++
 1 file changed, 5 insertions(+)
Signature · 1 line
2.32.0
author
#1 lore raw

PATCH 1/2 net: ipa: HOLB register sometimes must be written twice

Starting with IPA v4.5, the HOL_BLOCK_EN register must be written twice when enabling head-of-line blocking avoidance.

Fixes 84f9bd12d46db ("soc: qcom: ipa: IPA endpoints")
---
 drivers/net/ipa/ipa_endpoint.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ipa/ipa_endpoint.c +3 -0
index 5528d97110d56..006da4642a0ba 100644
@@ -868,6 +868,9 @@ ipa_endpoint_init_hol_block_enable(struct ipa_endpoint *endpoint, bool enable)
 	val = enable ? HOL_BLOCK_EN_FMASK : 0;
 	offset = IPA_REG_ENDP_INIT_HOL_BLOCK_EN_N_OFFSET(endpoint_id);
 	iowrite32(val, endpoint->ipa->reg_virt + offset);
+	/* When enabling, the register must be written twice for IPA v4.5+ */
+	if (enable && endpoint->ipa->version >= IPA_VERSION_4_5)
+		iowrite32(val, endpoint->ipa->reg_virt + offset);
 }
 
 void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa)
Signature · 1 line
2.32.0
author
#2 lore raw

PATCH 2/2 net: ipa: disable HOLB drop when updating timer

In reply to Alex Elder

The head-of-line blocking timer should only be modified when head-of-line drop is disabled.

One of the steps in recovering from a modem crash is to enable dropping of packets with timeout of 0 (immediate). We don't know how the modem configured its endpoints, so before we program the timer, we need to ensure HOL_BLOCK is disabled.

Fixes 84f9bd12d46db ("soc: qcom: ipa: IPA endpoints")
---
 drivers/net/ipa/ipa_endpoint.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ipa/ipa_endpoint.c +2 -0
index 006da4642a0ba..ef790fd0ab56a 100644
@@ -853,6 +853,7 @@ static void ipa_endpoint_init_hol_block_timer(struct ipa_endpoint *endpoint,
 	u32 offset;
 	u32 val;
 
+	/* This should only be changed when HOL_BLOCK_EN is disabled */
 	offset = IPA_REG_ENDP_INIT_HOL_BLOCK_TIMER_N_OFFSET(endpoint_id);
 	val = hol_block_timer_val(ipa, microseconds);
 	iowrite32(val, ipa->reg_virt + offset);
@@ -883,6 +884,7 @@ void ipa_endpoint_modem_hol_block_clear_all(struct ipa *ipa)
 		if (endpoint->toward_ipa || endpoint->ee_id != GSI_EE_MODEM)
 			continue;
 
+		ipa_endpoint_init_hol_block_enable(endpoint, false);
 		ipa_endpoint_init_hol_block_timer(endpoint, 0);
 		ipa_endpoint_init_hol_block_enable(endpoint, true);
 	}
Signature · 1 line
2.32.0
#3 lore raw
In reply to Alex Elder
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Quoted 8 lines · On Fri, 12 Nov 2021 16:22:08 -0600 you wrote:

This small series fixes two recently identified bugs related to the way two registers must be written. The registers define whether and when to drop packets if a head-of-line blocking condition is encountered. The "enable" (dropping packets) register must be written twice for newer versions of hardware. And the timer register must not be written while dropping is enabled.

[...]

Here is the summary with links:
- [net,1/2] net: ipa: HOLB register sometimes must be written twice

    https://git.kernel.org/netdev/net/c/6e228d8cbb1c
  - [net,2/2] net: ipa: disable HOLB drop when updating timer
    https://git.kernel.org/netdev/net/c/816316cacad2

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html