From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: memoriaru@foxmail.com
Cc: linux-usb@vger.kernel.org, badhri@google.com,
gregkh@linuxfoundation.org, stable@vger.kernel.org
Subject: Re: [PATCH usb v2] usb: typec: tcpm: align SOP' Soft Reset handling with SOP
Date: Fri, 20 Nov 2026 14:16:54 +0100 [thread overview]
Message-ID: <awBIRnc9lBkdVhEK@black.igk.intel.com> (raw)
In-Reply-To: <tencent_443620EAE95525A375BB2D8A653406630A07@qq.com>
On Tue, Nov 17, 2026 at 07:36:21PM +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'")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zhang Hewei <memoriaru@foxmail.com>
> ---
> 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
How did you prepare this patch? It doesn't apply.
I do hope you have actually compiled this at some point.
Thanks,
> @@ -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
prev parent reply other threads:[~2026-11-20 13:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <avw6CtZkJqvwj4eL@black.igk.intel.com>
2026-11-17 11:36 ` [PATCH usb v2] usb: typec: tcpm: align SOP' Soft Reset handling with SOP memoriaru
2026-11-20 13:16 ` Heikki Krogerus [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=awBIRnc9lBkdVhEK@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=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox