usb: typec: tcpm: align SOP' Soft Reset handling with SOP
Subsystems (4)
PATCH 1/1 usb: typec: tcpm: align SOP' Soft Reset handling with SOP
From: Zhang Hewei <[email protected]>
The PD message duplicate-check and the SOFT_RESET state handling treat the SOP and SOP' channels differently:
- tcpm_pd_rx_handler() exempts PD_CTRL_SOFT_RESET from the MessageID duplicate check on the SOP path (the USB PD spec 6.6.1.2 note: a Soft_Reset Message always carries MessageID zero, so the duplicate check must not drop it), but the SOP' branch of the same switch has no such exemption. A cable that sends a second Soft Reset over SOP' (MessageID zero again) has that message silently dropped by the stale rx_msgid_prime comparison, and the cable-side re-negotiation stalls.
- run_state_machine()'s SOFT_RESET case resets message_id/rx_msgid but not message_id_prime/rx_msgid_prime, while the initiator path (SOFT_RESET_SEND, SOP_PRIME branch) resets both counter pairs. After a responder-side soft reset the prime counters stay stale.
Reset the prime counters together with the SOP counters and exempt Soft Reset from the SOP' duplicate check, aligning the SOP' handling with the SOP path.
Found by code inspection; a software TCPC stub was built for the responder path.
--- tcpm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tcpm.c +4 -1
@@ -4200,7 +4200,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;
@@ -6193,6 +6194,8 @@ static void run_state_machine(struct tcpm_port *port)case SOFT_RESET : port->message_id =0 ; port->rx_msgid =-1 ; + port->message_id_prime =0 ; + port->rx_msgid_prime =-1 ;/* remove existing capabilities */ tcpm_partner_source_caps_reset (port);tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP );
Signature · 1 line
2.39.5 (Apple Git-154)
Heikki Krogerus
maintainerQuoted 19 lines · On Sat, Nov 14, 2026 at 06:20:54AM +0800, [email protected] wrote:
From: Zhang Hewei <[email protected]>
The PD message duplicate-check and the
SOFT_RESETstate handling treat the SOP and SOP' channels differently:-
tcpm_pd_rx_handler()exemptsPD_CTRL_SOFT_RESETfrom the MessageID duplicate check on the SOP path (the USB PD spec 6.6.1.2 note: aSoft_ResetMessage always carries MessageID zero, so the duplicate check must not drop it), but the SOP' branch of the same switch has no such exemption. A cable that sends a second Soft Reset over SOP' (MessageID zero again) has that message silently dropped by the stalerx_msgid_primecomparison, and the cable-side re-negotiation stalls.- run_state_machine()'s
SOFT_RESETcase resets message_id/rx_msgid but not message_id_prime/rx_msgid_prime, while the initiator path (SOFT_RESET_SEND,SOP_PRIMEbranch) resets both counter pairs. After a responder-side soft reset the prime counters stay stale.
Quoted 8 lines
Reset the prime counters together with the SOP counters and exempt Soft Reset from the SOP' duplicate check, aligning the SOP' handling with the SOP path.
Found by code inspection; a software TCPC stub was built for the responder path.
Fixes 6bd181ba60 ("usb: typec: tcpm: add control message support to sop'")
+RD
Quoted 1 line
Signed-off-by Zhang Hewei <[email protected]>
You should CC stable:
https://docs.kernel.org/process/submitting-patches.html#select-the-recipients-for-your-patch
Thanks,
Quoted 29 lines
--- tcpm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tcpm.c +4
-1@@ -4200,7 +4200,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;@@ -6193,6 +6194,8 @@ static void run_state_machine(struct tcpm_port *port)case SOFT_RESET : port->message_id =0 ; port->rx_msgid =-1 ; + port->message_id_prime =0 ; + port->rx_msgid_prime =-1 ;/* remove existing capabilities */ tcpm_partner_source_caps_reset (port);tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP );Signature · 1 line
2.39.5 (Apple Git-154)
Signature · 1 line
heikki
PATCH v2 1/1 usb: typec: tcpm: align SOP' Soft Reset handling with SOP
From: Zhang Hewei <[email protected]>
The PD message duplicate-check and the SOFT_RESET state handling treat the SOP and SOP' channels differently:
- tcpm_pd_rx_handler() exempts PD_CTRL_SOFT_RESET from the MessageID duplicate check on the SOP path (the USB PD spec 6.6.1.2 note: a Soft_Reset Message always carries MessageID zero, so the duplicate check must not drop it), but the SOP' branch of the same switch has no such exemption. A cable that sends a second Soft Reset over SOP' (MessageID zero again) has that message silently dropped by the stale rx_msgid_prime comparison, and the cable-side re-negotiation stalls.
- run_state_machine()'s SOFT_RESET case resets message_id/rx_msgid but not message_id_prime/rx_msgid_prime, while the initiator path (SOFT_RESET_SEND, SOP_PRIME branch) resets both counter pairs. After a responder-side soft reset the prime counters stay stale.
Reset the prime counters together with the SOP counters and exempt Soft Reset from the SOP' duplicate check, aligning the SOP' handling with the SOP path.
Found by code inspection; a software TCPC stub was built for the responder path.
--- tcpm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tcpm.c +4 -1
@@ -4200,7 +4200,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;
@@ -6193,6 +6194,8 @@ static void run_state_machine(struct tcpm_port *port)case SOFT_RESET : port->message_id =0 ; port->rx_msgid =-1 ; + port->message_id_prime =0 ; + port->rx_msgid_prime =-1 ;/* remove existing capabilities */ tcpm_partner_source_caps_reset (port);tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP );
Signature · 1 line
2.39.5 (Apple Git-154)
Heikki Krogerus
maintainertcpm.c
Quoted 37 lines · On Tue, Nov 17, 2026 at 07:36:21PM +0800, [email protected] wrote:
From: Zhang Hewei <[email protected]>
The PD message duplicate-check and the
SOFT_RESETstate handling treat the SOP and SOP' channels differently:-
tcpm_pd_rx_handler()exemptsPD_CTRL_SOFT_RESETfrom the MessageID duplicate check on the SOP path (the USB PD spec 6.6.1.2 note: aSoft_ResetMessage always carries MessageID zero, so the duplicate check must not drop it), but the SOP' branch of the same switch has no such exemption. A cable that sends a second Soft Reset over SOP' (MessageID zero again) has that message silently dropped by the stalerx_msgid_primecomparison, and the cable-side re-negotiation stalls.- run_state_machine()'s
SOFT_RESETcase resets message_id/rx_msgid but not message_id_prime/rx_msgid_prime, while the initiator path (SOFT_RESET_SEND,SOP_PRIMEbranch) resets both counter pairs. After a responder-side soft reset the prime counters stay stale.Reset the prime counters together with the SOP counters and exempt Soft Reset from the SOP' duplicate check, aligning the SOP' handling with the SOP path.
Found by code inspection; a software TCPC stub was built for the responder path.
Fixes 6bd181ba60 ("usb: typec: tcpm: add control message support to sop'")Signed-off-by Zhang Hewei <[email protected]>--- tcpm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tcpm.c +0
-0
How did you prepare this patch? It doesn't apply.
I do hope you have actually compiled this at some point.
Thanks,
Quoted 21 lines
tcpm.c +4
-1@@ -4200,7 +4200,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;@@ -6193,6 +6194,8 @@ static void run_state_machine(struct tcpm_port *port)case SOFT_RESET : port->message_id =0 ; port->rx_msgid =-1 ; + port->message_id_prime =0 ; + port->rx_msgid_prime =-1 ;/* remove existing capabilities */ tcpm_partner_source_caps_reset (port);tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP );Signature · 1 line
2.39.5 (Apple Git-154)
Signature · 1 line
heikki
From: Zhang Hewei <[email protected]>
Resending as plain text -- the previous two copies went out in HTML format and were rejected by the vger list infrastructure. Please use this one and disregard the duplicates.
Hi Heikki,
Apologies -- you are right, and thanks for catching it. The patch doesn't apply because I generated the diff from inside drivers/usb/typec/tcpm/ and shipped it with the short paths (a/tcpm.c instead of a/drivers/usb/typec/tcpm/tcpm.c), so git apply fails at the root of the tree. I had not verified it with git apply --check from the top before sending. Lesson taken.
The base itself was the real tree: the index blob bb90211 in the v2 diff is the master tcpm.c blob, and the two hunks apply cleanly and build with the corrected paths. I've verified v3 end to end on a fresh master tree: git apply --check passes at the root (forward and reverse), and with CONFIG_TYPEC_TCPM=y the patched tcpm.c compiles clean (tcpm.o, zero warnings).
The rebased v3 below is content-identical to v2 (same index blob bb90211 -- the base was the real tree, only the paths were wrong):
From: Zhang Hewei <[email protected]>
Subject: [PATCH usb v3] usb: typec: tcpm: align SOP' Soft Reset handling with SOP
The PD message duplicate-check and the SOFT_RESET state handling treat the SOP and SOP' channels differently:
- tcpm_pd_rx_handler() exempts PD_CTRL_SOFT_RESET from the MessageID duplicate check on the SOP path (USB PD spec 6.6.1.2 note: a Soft_Reset message always carries MessageID zero, so the duplicate check must not drop it), but the SOP' branch of the same switch has no such exemption. A cable that sends a second Soft Reset over SOP' (MessageID zero again) has that message silently dropped by the stale rx_msgid_prime comparison, and the cable-side re-negotiation stalls.
- run_state_machine()'s SOFT_RESET case resets message_id/rx_msgid but not message_id_prime/rx_msgid_prime, while the initiator path (SOFT_RESET_SEND, SOP_PRIME branch) resets both counter pairs. After a responder-side soft reset the prime counters stay stale.
Reset the prime counters together with the SOP counters and exempt Soft Reset from the SOP' duplicate check, aligning the SOP' handling with the SOP path.
Found by code inspection; a software TCPC stub was built for the responder path.
--- drivers/usb/typec/tcpm/tcpm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/usb/typec/tcpm/tcpm.c +4 -1
@@ -4200,7 +4200,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;
@@ -6193,6 +6194,8 @@ static void run_state_machine(struct tcpm_port *port)case SOFT_RESET : port->message_id =0 ; port->rx_msgid =-1 ; + port->message_id_prime =0 ; + port->rx_msgid_prime =-1 ;/* remove existing capabilities */ tcpm_partner_source_caps_reset (port);tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP );
Signature · 1 line
2.39.5 (Apple Git-154)
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] usb: typec: tcpm: SOP' MessageID desync and broken SOP' reset in SOFT_RESET - [Low] usb: typec…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] usb: typec: tcpm: SOP' MessageID desync and broken SOP' reset in SOFT_RESET
- [Low] usb: typec: tcpm: malformed Fixes SHA, reply chatter, and wrong claim in log
--
commit dccd2b15acd9fd37db996886a0767a44d39c3adf
Author: Zhang Hewei <[email protected]>
Quoted 49 lines
usb: typec: tcpm: align SOP' Soft Reset handling with SOP
Resending as plain text -- the previous two copies went out in HTML format and were rejected by the vger list infrastructure. Please use this one and disregard the duplicates.
Hi Heikki,
Apologies -- you are right, and thanks for catching it. The patch doesn't apply because I generated the diff from inside
drivers/usb/typec/tcpm/and shipped it with the short paths (a/tcpm.cinstead ofa/drivers/usb/typec/tcpm/tcpm.c), so git apply fails at the root of the tree. I had not verified it withgit apply --checkfrom the top before sending. Lesson taken.The base itself was the real tree: the index blob bb90211 in the v2 diff is the master
tcpm.cblob, and the two hunks apply cleanly and build with the corrected paths. I've verified v3 end to end on a fresh master tree: git apply --check passes at the root (forward and reverse), and withCONFIG_TYPEC_TCPM=ythe patchedtcpm.ccompiles clean (tcpm.o, zero warnings).The rebased v3 below is content-identical to v2 (same index blob bb90211 -- the base was the real tree, only the paths were wrong):
From: Zhang Hewei <[email protected]>
Subject: [PATCH usb v3] usb: typec: tcpm: align SOP' Soft Reset handling with SOPThe PD message duplicate-check and the
SOFT_RESETstate handling treat the SOP and SOP' channels differently:-
tcpm_pd_rx_handler()exemptsPD_CTRL_SOFT_RESETfrom the MessageID duplicate check on the SOP path (USB PD spec 6.6.1.2 note: aSoft_Resetmessage always carries MessageID zero, so the duplicate check must not drop it), but the SOP' branch of the same switch has no such exemption. A cable that sends a second Soft Reset over SOP' (MessageID zero again) has that message silently dropped by the stalerx_msgid_primecomparison, and the cable-side re-negotiation stalls.- run_state_machine()'s
SOFT_RESETcase resets message_id/rx_msgid but not message_id_prime/rx_msgid_prime, while the initiator path (SOFT_RESET_SEND,SOP_PRIMEbranch) resets both counter pairs. After a responder-side soft reset the prime counters stay stale.Reset the prime counters together with the SOP counters and exempt Soft Reset from the SOP' duplicate check, aligning the SOP' handling with the SOP path.
Quoted 6 lines
Found by code inspection; a software TCPC stub was built for the responder path.
Fixes 6bd181ba60 ("usb: typec: tcpm: add control message support to sop'")Signed-off-by Zhang Hewei <[email protected]>
[Severity: Low]
The mailing-list reply notes and embedded From:/Subject: headers at the top belong below the "---" separator rather than in the commit changelog.
The Fixes tag also uses a 10-character SHA instead of at least 12 characters:
Also, is the description of SOFT_RESET_SEND accurate? In run_state_machine(), SOFT_RESET_SEND branches on port->tx_sop_type == TCPC_TX_SOP_PRIME and resets only message_id_prime/rx_msgid_prime for SOP' or only message_id/rx_msgid for SOP, not both counter pairs.
Quoted 15 lines
drivers/usb/typec/tcpm.c renamed from drivers/usb/typec/tcpm/tcpm.c +2
-1@@ -4206,7 +4206,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;
drivers/usb/typec/tcpm.c static void run_state_machine(struct tcpm_port *port) · line 6207
Quoted 8 lines
drivers/usb/typec/tcpm.c renamed from drivers/usb/typec/tcpm/tcpm.c +2
-0@@ -6199,6 +6200,8 @@ static void run_state_machine(struct tcpm_port *port)case SOFT_RESET : port->message_id =0 ; port->rx_msgid =-1 ; + port->message_id_prime =0 ; + port->rx_msgid_prime =-1 ;/* remove existing capabilities */ tcpm_partner_source_caps_reset (port);tcpm_pd_send_control (port,PD_CTRL_ACCEPT ,TCPC_TX_SOP );
[Severity: High]
Does unconditionally resetting port->message_id_prime and port->rx_msgid_prime in SOFT_RESET desynchronize SOP' MessageID counters with the cable plug during an SOP Soft Reset, while also mishandling an incoming SOP' Soft Reset as an SOP reset?
SOP and SOP' maintain independent MessageID counters per USB PD 3.0 sections 6.3.13 and 6.7.1. When the port partner sends an SOP PD_CTRL_SOFT_RESET, the cable plug does not process SOP packets and keeps its existing SOP' MessageID state. If the port already sent one SOP' VDM (such as CMD_DISCOVER_IDENT with MessageID 0, advancing port->message_id_prime to 1 and leaving the cable plug's stored MessageID at 0), resetting port->message_id_prime to 0 here causes the next SOP' message to be sent with MessageID 0 again and dropped by the cable plug as a duplicate.
Conversely, when PD_CTRL_SOFT_RESET arrives on TCPC_TX_SOP_PRIME, tcpm_pd_ctrl_request() ignores rx_sop_type and enters SOFT_RESET:
drivers/usb/typec/tcpm/tcpm.c:tcpm_pd_ctrl_request() {
...
case PD_CTRL_SOFT_RESET:
port->ams = SOFT_RESET_AMS;
tcpm_set_state(port, SOFT_RESET, 0);
break;
...
}SOFT_RESET then resets the SOP counters, clears partner source capabilities and port->explicit_contract, sends PD_CTRL_ACCEPT on TCPC_TX_SOP instead of TCPC_TX_SOP_PRIME, and restarts SOP power negotiation rather than acknowledging the cable plug on SOP' and returning to ready_state(port).
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
From: Zhang Hewei <[email protected]>
Hi Heikki,
Thanks for catching the broken v2/v3 submissions. The Sashiko review findings on the resend were all valid, and re-checking the tree showed my changelog misdescribed the initiator path as well:
- SOFT_RESET_SEND branches on the SOP* type and resets only the counters of the channel being reset (PD 3.0 sec 6.3.13, "targeted at a specific entity"), not both pairs as I wrote.
So v4 drops the second hunk: unconditionally resetting message_id_prime/rx_msgid_prime from the responder SOFT_RESET case is wrong for the same reason -- a SOP-channel soft reset must not clear cable-channel state.
That said, while re-checking I noticed the responder side of SOP' Soft Reset looks mis-handled overall in the current tree:
- tcpm_pd_handle_msg() has no SOP* type parameter, so the SOFT_RESET case cannot tell which channel the reset came from; it always resets the SOP counters and sends PD_CTRL_ACCEPT on TCPC_TX_SOP.
- A Soft_Reset received on SOP' therefore gets its ACCEPT sent on SOP, and its prime counters are not reset.
A complete fix would thread the SOP* type through tcpm_pd_handle_msg() and mirror the SOFT_RESET_SEND per-channel handling on the responder side. I'm happy to prepare that if you prefer -- it touches more call sites, so I did not fold it into this resend.
v4 below keeps only the duplicate-check exemption (first hunk), with the changelog facts corrected.
Thanks,
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v4 1/1 usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
From: Zhang Hewei <[email protected]>
The PD message duplicate-check and the SOFT_RESET state handling treat the SOP and SOP' channels differently:
tcpm_pd_rx_handler() exempts PD_CTRL_SOFT_RESET from the MessageID duplicate check on the SOP path (USB PD spec 6.6.1.2 note: a Soft_Reset message always carries MessageID zero, so the duplicate check must not drop it), but the SOP' branch of the same switch has no such exemption. A cable that sends a second Soft Reset over SOP' (MessageID zero again) has that message silently dropped by the rx_msgid_prime comparison, and the cable-side re-negotiation stalls.
Exempt Soft Reset on the SOP' path the same way the SOP path does.
Found by code inspection; a software TCPC stub was built for the responder path.
drivers/usb/typec/tcpm/tcpm.c +2 -1
@@ -4200,7 +4200,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;
Signature · 1 line
2.39.5 (Apple Git-154)
[email protected]
AI reviewRe: [PATCH usb v4] usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] usb: typec: tcpm: SOP' PD_CTRL_SOFT_RESET still resets SOP in SOFT_RESET --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] usb: typec: tcpm: SOP' PD_CTRL_SOFT_RESET still resets SOP in SOFT_RESET
--
commit 64dabb00274a597dc73a5939c6dcd78aa8aea76c
Author: Zhang Hewei <[email protected]>
usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
This commit exempts PD_CTRL_SOFT_RESET from the MessageID duplicate check on the SOP' receive path in tcpm_pd_rx_handler().
Quoted 5 lines
drivers/usb/typec/tcpm/tcpm.c +0
-0
drivers/usb/typec/tcpm/tcpm.c static void tcpm_pd_rx_handler(struct kthread_work *work) · line 4213
Quoted 9 lines
drivers/usb/typec/tcpm/tcpm.c +2
-1@@ -4206,7 +4206,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;
[Severity: Medium]
Does an incoming SOP' PD_CTRL_SOFT_RESET still reset the SOP channel instead of SOP'?
When a cable sends PD_CTRL_SOFT_RESET on TCPC_TX_SOP_PRIME, tcpm_pd_rx_handler() sets port->rx_msgid_prime = 0 and calls tcpm_pd_ctrl_request(port, msg, TCPC_TX_SOP_PRIME), which ignores rx_sop_type and enters SOFT_RESET:
drivers/usb/typec/tcpm/tcpm.c:tcpm_pd_ctrl_request() {
...
case PD_CTRL_SOFT_RESET:
port->ams = SOFT_RESET_AMS;
tcpm_set_state(port, SOFT_RESET, 0);
break;
...
}drivers/usb/typec/tcpm/tcpm.c:run_state_machine() {
...
case SOFT_RESET:
port->message_id = 0;
port->rx_msgid = -1;
/* remove existing capabilities */
tcpm_partner_source_caps_reset(port);
tcpm_pd_send_control(port, PD_CTRL_ACCEPT, TCPC_TX_SOP);
port->vdm_sm_running = false;
port->explicit_contract = false;
tcpm_ams_finish(port);
if (port->pwr_role == TYPEC_SOURCE) {
port->upcoming_state = SRC_SEND_CAPABILITIES;
tcpm_ams_start(port, POWER_NEGOTIATION);
} else {
tcpm_set_state(port, SNK_WAIT_CAPABILITIES, 0);
}
break;
...
}Because SOFT_RESET only resets the SOP state, port->message_id_prime is not zeroed, port->rx_msgid_prime stays at 0 (so the cable's next SOP' message with MessageID 0 is dropped as a duplicate), PD_CTRL_ACCEPT is sent on TCPC_TX_SOP to the port partner instead of the cable, and the SOP power contract is torn down.
The commit message also notes that "the PD message duplicate-check and the SOFT_RESET state handling treat the SOP and SOP' channels differently", so it looks like the tcpm_pd_ctrl_request() and SOFT_RESET changes were omitted from the patch.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Greg KH
maintainerRe: [PATCH usb v4] usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
In reply to [email protected]Quoted 40 lines · On Sat, Nov 21, 2026 at 03:25:35AM +0800, [email protected] wrote:
From: Zhang Hewei <[email protected]>
The PD message duplicate-check and the
SOFT_RESETstate handling treat the SOP and SOP' channels differently:
tcpm_pd_rx_handler()exemptsPD_CTRL_SOFT_RESETfrom the MessageID duplicate check on the SOP path (USB PD spec 6.6.1.2 note: aSoft_Resetmessage always carries MessageID zero, so the duplicate check must not drop it), but the SOP' branch of the same switch has no such exemption. A cable that sends a second Soft Reset over SOP' (MessageID zero again) has that message silently dropped by therx_msgid_primecomparison, and the cable-side re-negotiation stalls.Exempt Soft Reset on the SOP' path the same way the SOP path does.
Found by code inspection; a software TCPC stub was built for the responder path.
Fixes 6bd181ba60e1 ("usb: typec: tcpm: add control message support to sop'")Signed-off-by Zhang Hewei <[email protected]>drivers/usb/typec/tcpm/tcpm.c +2
-1@@ -4200,7 +4200,8 @@ static void tcpm_pd_rx_handler(struct kthread_work *work)*/ switch (rx_sop_type) {case TCPC_TX_SOP_PRIME : -if (msgid == port->rx_msgid_prime) +if (msgid == port->rx_msgid_prime && + type !=PD_CTRL_SOFT_RESET ) goto done; port->rx_msgid_prime = msgid;break ;Signature · 1 line
2.39.5 (Apple Git-154)
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/process/submitting-patches.rst for what needs to be done here to properly describe this.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH usb v4] usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
From: Zhang Hewei <[email protected]>
Hi Heikki,
Gentle ping on this one -- I understand things are busy.
Two small follow-ups from my side:
1. Greg's patch bot pointed out that the v4 patch mail lacked a version changelog below the "---" line; that feedback is valid and I'll include one in the next revision.
2. On scope: the responder-side SOP' Soft Reset handling still cannot tell which channel the reset arrived on (tcpm_pd_handle_msg() has no SOP* type parameter), so a complete fix is a slightly larger series than the current one-liner. Happy to prepare that, or a rebased minimal v5 with the changelog added -- whichever you prefer. If you would rather pick this up internally, that works for me too.
Thanks,
memoriaru
Greg KH
maintainerRe: [PATCH usb v4] usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
Quoted 5 lines · On Sat, Nov 28, 2026 at 03:17:00PM +0800, [email protected] wrote:
From: Zhang Hewei <[email protected]>
Hi Heikki,
Gentle ping on this one -- I understand things are busy.
There is no context here at all, please properly quote emails as many of us get 1000+ a day.
thanks,
greg k-h
Heikki Krogerus
maintainerRe: [PATCH usb v4] usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
In reply to [email protected]Quoted 12 lines · On Sat, Nov 28, 2026 at 03:17:00PM +0800, [email protected] wrote:
From: Zhang Hewei <[email protected]>
Hi Heikki,
Gentle ping on this one -- I understand things are busy.
Two small follow-ups from my side:
1. Greg's patch bot pointed out that the v4 patch mail lacked a version changelog below the "---" line; that feedback is valid and I'll include one in the next revision.
Quoted 6 lines
2. On scope: the responder-side SOP' Soft Reset handling still cannot tell which channel the reset arrived on (
tcpm_pd_handle_msg()has no SOP* type parameter), so a complete fix is a slightly larger series than the current one-liner. Happy to prepare that, or a rebased minimal v5 with the changelog added -- whichever you prefer. If you would rather pick this up internally, that works for me too.
It sounds like this patch needs more work. Please take your time, and prepare a complete solution.
Thanks,
Signature · 1 line
heikki
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH usb v4] usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
From: Zhang Hewei <[email protected]>
Quoted 2 lines · Greg KH
There is no context here at all, please properly quote emails as many of us get 1000+ a day.
Fair point, noted -- will properly quote going forward.
For the context that should have been inline: this was a gentle ping on the v4 series ("usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check", sent 11-21), which fixes the SOP' duplicate check dropping a second Soft_Reset on the cable channel. Heikki hasn't commented yet; the open question (from the cover letter) is whether the responder-side SOP' Soft Reset mis-handling (ACCEPT hardcoded to TCPC_TX_SOP and the prime counters never reset in the SOFT_RESET case) should be fixed fully by threading the SOP* type through tcpm_pd_handle_msg(), or minimally. No action needed from you unless the stable backport matters for the decision.
Thanks,
memoriaru