Message ID | 20231116083221.1201892-1-guanyulin@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp3067083vqg; Thu, 16 Nov 2023 00:33:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGiP6VMvU7IjmZzE9ifcn9nNsUX6AstIIaUs8FlY8RajSti4gUtSqQvEb4z3Y5Ip7nCZKZm X-Received: by 2002:a05:6a00:2149:b0:68e:3eb6:d45 with SMTP id o9-20020a056a00214900b0068e3eb60d45mr11468092pfk.30.1700123584171; Thu, 16 Nov 2023 00:33:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700123584; cv=none; d=google.com; s=arc-20160816; b=BazKW6RtNyGAWeta1yG6QhEp+EbgTHEnZHoN4dAjR3JRdJe09fUBLuQch40wRn8pB+ LO3WqxygvfQRQFVcxEy4PCNBRPMk7CRx8IBq1DglGFsuJCCL7YoPuvAhq9/BpVN99dRX f/esLFhO8koFVA078ImDh89V/ow+/jNNpea/pvj/oF7HDtLLdiI6coOASnbtkBZHsqlg n08QJLuTKT3Xr9KSwpjAgZh88yPv3yfWWuTSVsJUytwBd1Y+Ne795+O57DL35J1XHIoh VUBNgbY4uKMKOaGoYjROkPPJq1yfTWEUPVx9QtTgbXgxKTOHSVRNbfoqxRGqhQU1nhGy gE7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=31bn3B5X8I0gch6WfMuHeSex2F8MyGxZRscHzn524C8=; fh=s/Ua4OwN0jkvvIg1CtPBVOiHbyKgqWOAvbpZFrAkRjU=; b=UYCnOyBm9BHSb7VvfbLonE7/BpcRXb6d1DcGTjMwW0laChzWsu7Zo7OP8DdApBwfO5 hM3XIEWMS9GYtM9QGBcWaG6N7UEXW/fUUe/fVfpKeKJY5oTkOOaDL+0rm0Vv/bOf6RQM g+Z3mx/1ZZW9QH6NPRZvufbRYehdM2C280qEjTUT3A1MifIz5qcWywTp4oaT0w0wIBrs 7akiCtFy1we9Lke7lXE/AS7+VOlpRDc7K+2EPM4TdKV8qmA/2Gd3Ld/fcXGzE5Ppwm0N aX4yhwtm11MUhUsF5m3oyks5MR6bjwCCRIc9kmK0CF5O9IEY2zGvBluDkb8+o6eiKcXN 2Zyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Xz4ssHLT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id fc26-20020a056a002e1a00b006826c8d5a31si12139381pfb.21.2023.11.16.00.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 00:33:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Xz4ssHLT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 44CB481890BE; Thu, 16 Nov 2023 00:33:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344958AbjKPIcy (ORCPT <rfc822;jaysivo@gmail.com> + 29 others); Thu, 16 Nov 2023 03:32:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234762AbjKPIcw (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 16 Nov 2023 03:32:52 -0500 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC8C1B3 for <linux-kernel@vger.kernel.org>; Thu, 16 Nov 2023 00:32:47 -0800 (PST) Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-5bdfc1bb3eeso1808012a12.1 for <linux-kernel@vger.kernel.org>; Thu, 16 Nov 2023 00:32:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1700123567; x=1700728367; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=31bn3B5X8I0gch6WfMuHeSex2F8MyGxZRscHzn524C8=; b=Xz4ssHLTUhOVFxm8GT+WxnZh2sFM3LwE91GD+RtCGakdgX7qGmpqvhbLAo0dlWnmnU HP6uV5kTqR0NwmbtGDm2ZhhPRi5rMyf++bGwn9hATh41ILDdlyQYZtOAMm6h1HWT1d8S IEnKoZfoL0ED10jgvlRYZ8q9G1XSC4+Ju89VpgGWGaJm8IcnZzFDKBJe2g+iB06S7LUy aWScEL7LOEZ/J85E+8CZQAt53wtsBhs9t9O4oGSd2J3csxjX1LIGm/x5PDmWJcG+8jtf 5C7TeJyF+toucHvTQ0fw3Spm3mfBxJADAQWx3KGaGfyYXGOlVxkgtbJ1CYrHlqy2Z5DU WpGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700123567; x=1700728367; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=31bn3B5X8I0gch6WfMuHeSex2F8MyGxZRscHzn524C8=; b=tXFE4LWPHs67Dfm6ex3umuzE7077KiJ4NneeZD+8M6vV8pcKe5+3yqflXjusjdGujS uaGp32i9/3cDDI0abYkzh+r4iO5yA6LTzshpLYCwbBGc2WCXG30SIYQ09zjoYs8TtVaX 0TdNTCJygQgVyqBgvnijX6iLBS0+0P6VmoKEulsPpZUGL/kNwoQLxz0/cMpOYxK9QSmG 1vDwHmWc4T5ZwEb+r1CJsQVkvVUI/GSDyNM+uSQ6ydSqo5Nypa8QfH5/KbtGXtNTaTl2 TzBoSV4dmn3qYelOx0swphKELLJrf8dluVFCGG2v3IFSact2JEGD32VL5kTReogTRQzn LFiA== X-Gm-Message-State: AOJu0YwrPAclGLWowivHIJ2DSwCJFjTfeYHz8SxJmZCVq6TpKY7QKY0F /G5WL6i9GI2SM8UegFevODhyS895yzWyzp4= X-Received: from guanyulin-p620linsp01.ntc.corp.google.com ([2401:fa00:fc:202:86b7:16db:b4e1:f67a]) (user=guanyulin job=sendgmr) by 2002:a17:90b:2d8c:b0:280:32d5:8904 with SMTP id sj12-20020a17090b2d8c00b0028032d58904mr287071pjb.1.1700123567158; Thu, 16 Nov 2023 00:32:47 -0800 (PST) Date: Thu, 16 Nov 2023 16:32:16 +0800 Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.rc0.421.g78406f8d94-goog Message-ID: <20231116083221.1201892-1-guanyulin@google.com> Subject: [PATCH] usb: typec: tcpm: skip checking port->send_discover in PD3.0 From: Guan-Yu Lin <guanyulin@google.com> To: linux@roeck-us.net, heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, badhri@google.com, kyletso@google.com, albertccwang@google.com, Guan-Yu Lin <guanyulin@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 16 Nov 2023 00:33:03 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782708787631532037 X-GMAIL-MSGID: 1782708787631532037 |
Series |
usb: typec: tcpm: skip checking port->send_discover in PD3.0
|
|
Commit Message
Guan-Yu Lin
Nov. 16, 2023, 8:32 a.m. UTC
The original Collison Avoidance mechanism, port->send_discover, avoids
the conflict when port partners start AMS almost the same time. However,
this mechanism is replaced by SINK_TX_OK and SINK_TX_NG. Skip the check
in PD3.0 to avoid the deadlock when source is requesting DR_SWAP where
sink is requesting DISCOVER_IDENTITY.
Signed-off-by: Guan-Yu Lin <guanyulin@google.com>
---
drivers/usb/typec/tcpm/tcpm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On Thu, Nov 16, 2023 at 04:32:16PM +0800, Guan-Yu Lin wrote: > The original Collison Avoidance mechanism, port->send_discover, avoids > the conflict when port partners start AMS almost the same time. However, > this mechanism is replaced by SINK_TX_OK and SINK_TX_NG. Skip the check > in PD3.0 to avoid the deadlock when source is requesting DR_SWAP where > sink is requesting DISCOVER_IDENTITY. > > Signed-off-by: Guan-Yu Lin <guanyulin@google.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/tcpm/tcpm.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 058d5b853b57..ff3c171a3a75 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -2847,7 +2847,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, > PD_MSG_CTRL_NOT_SUPP, > NONE_AMS); > } else { > - if (port->send_discover) { > + if (port->send_discover && port->negotiated_rev < PD_REV30) { > tcpm_queue_message(port, PD_MSG_CTRL_WAIT); > break; > } > @@ -2863,7 +2863,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, > PD_MSG_CTRL_NOT_SUPP, > NONE_AMS); > } else { > - if (port->send_discover) { > + if (port->send_discover && port->negotiated_rev < PD_REV30) { > tcpm_queue_message(port, PD_MSG_CTRL_WAIT); > break; > } > @@ -2872,7 +2872,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, > } > break; > case PD_CTRL_VCONN_SWAP: > - if (port->send_discover) { > + if (port->send_discover && port->negotiated_rev < PD_REV30) { > tcpm_queue_message(port, PD_MSG_CTRL_WAIT); > break; > } > -- > 2.43.0.rc0.421.g78406f8d94-goog
On 11/16/23 00:32, Guan-Yu Lin wrote: > The original Collison Avoidance mechanism, port->send_discover, avoids > the conflict when port partners start AMS almost the same time. However, > this mechanism is replaced by SINK_TX_OK and SINK_TX_NG. Skip the check > in PD3.0 to avoid the deadlock when source is requesting DR_SWAP where > sink is requesting DISCOVER_IDENTITY. > > Signed-off-by: Guan-Yu Lin <guanyulin@google.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > drivers/usb/typec/tcpm/tcpm.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 058d5b853b57..ff3c171a3a75 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -2847,7 +2847,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, > PD_MSG_CTRL_NOT_SUPP, > NONE_AMS); > } else { > - if (port->send_discover) { > + if (port->send_discover && port->negotiated_rev < PD_REV30) { > tcpm_queue_message(port, PD_MSG_CTRL_WAIT); > break; > } > @@ -2863,7 +2863,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, > PD_MSG_CTRL_NOT_SUPP, > NONE_AMS); > } else { > - if (port->send_discover) { > + if (port->send_discover && port->negotiated_rev < PD_REV30) { > tcpm_queue_message(port, PD_MSG_CTRL_WAIT); > break; > } > @@ -2872,7 +2872,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, > } > break; > case PD_CTRL_VCONN_SWAP: > - if (port->send_discover) { > + if (port->send_discover && port->negotiated_rev < PD_REV30) { > tcpm_queue_message(port, PD_MSG_CTRL_WAIT); > break; > }
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 058d5b853b57..ff3c171a3a75 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2847,7 +2847,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS); } else { - if (port->send_discover) { + if (port->send_discover && port->negotiated_rev < PD_REV30) { tcpm_queue_message(port, PD_MSG_CTRL_WAIT); break; } @@ -2863,7 +2863,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS); } else { - if (port->send_discover) { + if (port->send_discover && port->negotiated_rev < PD_REV30) { tcpm_queue_message(port, PD_MSG_CTRL_WAIT); break; } @@ -2872,7 +2872,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port, } break; case PD_CTRL_VCONN_SWAP: - if (port->send_discover) { + if (port->send_discover && port->negotiated_rev < PD_REV30) { tcpm_queue_message(port, PD_MSG_CTRL_WAIT); break; }