From: sashiko-bot@kernel.org
To: memoriaru@foxmail.com
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH usb v4] usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check
Date: Fri, 20 Nov 2026 19:41:01 +0000 [thread overview]
Message-ID: <sashiko-outbox-225943@kernel.org> (raw)
In-Reply-To: <tencent_D1222948818CA62395FED66DB7F2967B1809@qq.com>
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 <memoriaru@foxmail.com>
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().
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index bf7fd632d815e..6a657dbf4e7ae 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -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.
--
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_D1222948818CA62395FED66DB7F2967B1809@qq.com?part=1
prev parent reply other threads:[~2026-11-20 19:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 22:20 [PATCH usb] usb: typec: tcpm: align SOP' Soft Reset handling with SOP memoriaru
2026-11-17 11:27 ` Heikki Krogerus
2026-11-17 11:36 ` [PATCH usb v2] " memoriaru
2026-11-20 13:16 ` Heikki Krogerus
2026-11-20 18:34 ` memoriaru
2026-11-20 18:43 ` sashiko-bot
2026-11-20 19:25 ` memoriaru
[not found] ` <1795204200.cover.tcpm-v4@foxmail.com>
2026-11-20 19:25 ` [PATCH usb v4] usb: typec: tcpm: exempt Soft Reset from the SOP' MessageID duplicate check memoriaru
2026-11-20 19:41 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-225943@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=memoriaru@foxmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.