Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1099636pxb; Tue, 17 Aug 2021 03:56:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUSJd7wbZrd0uLtHWZRdT4hdwEZuAMFfSbh2mXiGF6cFMb8h+OtkXuSLGOaAoW9UzlYcid X-Received: by 2002:a05:6638:4121:: with SMTP id ay33mr2276566jab.137.1629197812422; Tue, 17 Aug 2021 03:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629197812; cv=none; d=google.com; s=arc-20160816; b=hD6hVUepZY2xV6KZt3toxZDWmJG9Sguo6kKR29Fqwi7hOa2tp+LRHuyZjatUTtTHV/ u8aq4EuqcZiF8GIyEaOaL8B/EpMvebm5QMSZFjvwcvBw+3fJ3gYuTZEJZZH+5LxdIrVg 8UUbrVLUKVwMX3xyWSrT9f/PQmXqCAaT/5hLEdVT0MWBVVOt0LhEsB1KI/IZwBtMs44W iHlP61mNm1VNvIjS0/39rX+42p+Fq4kQBjCZkGgDQvPw9wrUuiFBI98oHfjz3KCGhdOl FD99qdDsGN13SzI3INEcShVqdD1lTIiVW4l9DWoEy1qRZACcWRclYPSj50iCeDHkumBl +LrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=VctywGYb+8h8uJrjacMzS7W2uFEbVoxo4c4T1O14Ra0=; b=m0LQBBjVN4H9j43HwGSJeE45POyBQ+Bc+WjfiKu0zlsSu9iwslIWMWFRFruc1SUyV9 XGgfr6QAGBMeCHt832tuCbe3vZ/RAK3PhB1BneQOiM7XEPwxoqRUdEXZLSnlkbxhbSqj SZnTc63g0NOqEgPkHaAThNMHhnR2eEdCmN/9jgUDgTBarZ3dHM7YheKS6iFQmkSptuWX EZU7Y4ce8+1ZtW5tfsFeOaXqQLFMO9XcPPQskWvYX9EiBmjBcENIDC3iPnFlmFwfOPq7 nPsWts06ATMopB1YVf1N9lYk9amTE6pHRzfXgQzCBt5HOD+g1n+dBajtsLVfwCAsJqIJ OqPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si2507088iov.17.2021.08.17.03.56.40; Tue, 17 Aug 2021 03:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239505AbhHQKzs (ORCPT + 99 others); Tue, 17 Aug 2021 06:55:48 -0400 Received: from mga03.intel.com ([134.134.136.65]:56076 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231515AbhHQKzr (ORCPT ); Tue, 17 Aug 2021 06:55:47 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10078"; a="216073268" X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="216073268" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2021 03:55:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,328,1620716400"; d="scan'208";a="593311540" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 17 Aug 2021 03:55:11 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 17 Aug 2021 13:55:10 +0300 Date: Tue, 17 Aug 2021 13:55:10 +0300 From: Heikki Krogerus To: Kyle Tso Cc: linux@roeck-us.net, gregkh@linuxfoundation.org, badhri@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: typec: tcpm: Raise vdm_sm_running flag only when VDM SM is running Message-ID: References: <20210816075449.2236547-1-kyletso@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 17, 2021 at 06:32:55PM +0800, Kyle Tso wrote: > On Tue, Aug 17, 2021 at 5:39 PM Heikki Krogerus > wrote: > > > > On Mon, Aug 16, 2021 at 03:54:49PM +0800, Kyle Tso wrote: > > > If the port is going to send Discover_Identity Message, vdm_sm_running > > > flag was intentionally set before entering Ready States in order to > > > avoid the conflict because the port and the port partner might start > > > AMS at almost the same time after entering Ready States. > > > > > > However, the original design has a problem. When the port is doing > > > DR_SWAP from Device to Host, it raises the flag. Later in the > > > tcpm_send_discover_work, the flag blocks the procedure of sending the > > > Discover_Identity and it might never be cleared until disconnection. > > > > This is a bit off-topic, but I just asked this in another thread: Why > > do we have to do discovery with data role swap? > > > > thanks, > > > > This can be separated into two cases: > > 1. in PD2: If the port is originally UFP, it cannot send > Discover_Identity Message according to the Spec. And then DR_SWAP > happens. The port becomes DFP, and now it can do that. > > 2. in PD3: DFP and UFP are allowed to send Discover_Identity Message > and the responses may differ based on which roles they are active on. > > Quote from the PD3 Spec: > ``` > The Discover Identity Command Shall be used to determine the identity > and/or capabilities of the Port Partner. The following products Shall > return a Discover Identity Command ACK in response to a Discover > Identity Command request sent to SOP: > > • A PD-Capable UFP that supports Modal Operation. > • A PD-Capable product that has multiple DFPs. > • A PD-Capable [USB4] product. > ``` Got it. Thanks for the explanation. > > > Since there exists another flag send_discover representing that the port > > > is going to send Discover_Identity or not, it is enough to use that flag > > > to prevent the conflict. Also change the timing of the set/clear of > > > vdm_sm_running to indicate whether the VDM SM is actually running or > > > not. > > > > > > Fixes: c34e85fa69b9 ("usb: typec: tcpm: Send DISCOVER_IDENTITY from dedicated work") > > > Cc: Badhri Jagan Sridharan > > > Signed-off-by: Kyle Tso FWIW: Acked-by: Heikki Krogerus thanks, -- heikki