From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: memoriaru@foxmail.com, RD Babiera <rdbabiera@google.com>
Cc: linux-usb@vger.kernel.org, badhri@google.com, gregkh@linuxfoundation.org
Subject: Re: [PATCH usb] usb: typec: tcpm: align SOP' Soft Reset handling with SOP
Date: Tue, 17 Nov 2026 12:27:06 +0100 [thread overview]
Message-ID: <avw6CtZkJqvwj4eL@black.igk.intel.com> (raw)
In-Reply-To: <tencent_E92BE5AC4B6F212D7B309853D803D54D270A@qq.com>
On Sat, Nov 14, 2026 at 06:20:54AM +0800, memoriaru@foxmail.com wrote:
> From: Zhang Hewei <memoriaru@foxmail.com>
>
> 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.
>
> Fixes: 6bd181ba60 ("usb: typec: tcpm: add control message support to sop'")
+RD
> Signed-off-by: Zhang Hewei <memoriaru@foxmail.com>
You should CC stable:
https://docs.kernel.org/process/submitting-patches.html#select-the-recipients-for-your-patch
Thanks,
> ---
> tcpm.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tcpm.c b/tcpm.c
> index bb90211..95f748d 100644
> --- a/tcpm.c
> +++ b/tcpm.c
> @@ -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);
> --
> 2.39.5 (Apple Git-154)
--
heikki
next prev parent reply other threads:[~2026-11-17 11:27 UTC|newest]
Thread overview: 3+ 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 [this message]
2026-11-17 11:36 ` [PATCH usb v2] " memoriaru
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=avw6CtZkJqvwj4eL@black.igk.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=badhri@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=memoriaru@foxmail.com \
--cc=rdbabiera@google.com \
/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.