Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2566589rdh; Mon, 30 Oct 2023 00:31:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEH8F2uUskMxp9f5V5iNf24Yi+G7WL/rkmJfJIP2TYSXDFfB6PL8puwcapCrFc3gRXy3bDd X-Received: by 2002:a05:6a20:1453:b0:152:6b63:f1e7 with SMTP id a19-20020a056a20145300b001526b63f1e7mr7366335pzi.1.1698651095446; Mon, 30 Oct 2023 00:31:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698651095; cv=none; d=google.com; s=arc-20160816; b=OFWLwR/jgitOaMdr5iS00/KAVlYXYixq1Nj3oH1Fa6r6Nksa8qmtdwtOpfrVKXyBvw pELuZKduLUt0P5bNS0UPkDazJIo/+DrVgqN1iR0pz9mPBSmIRW9w93vUoyTt1qnCHjJj uOhDU9b4PeMZuqjGqTAPnERpH8tkovkFALA0DMLIMimGwdYAPOMNkp9FGz4F20g3+4kh E/1BU4koFG4Pl9UT+u5eol63tIn2SDMeaDp+pG31k4sTRBMci7rIAVlG0gNvuwxPMF5V ZcFhQ1gF8Pe1RLhwadvKICFQpdq5dJjgZ9K10P0xAes07+zMVek/7isDzaxzXqMx+Qtj 0PPg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=edCOP7Psj0qplBnFUk57rJbWzybzfVUMRxP9iXM5Sgc=; fh=pa3W74tV8xXrZG9a7q3jBXJTWpgkIf+R9AD0DzJee8I=; b=p/rqedAr5hk3vpWcRIiG/7Q2sAuG8ayrSYPjang6DsZEYckpAI9sltgPqZAo7Mgs+N wFp9wAdLfXxLdmYzUarX5GL/5oRca5+KPGewHix4ARya63xTZSAClwp6U8jjEkFmpm/l gcmBDQ+QEvETHZfuMc3yFh0UjZ7FhbxHVXwSmZB4oaZxXZKTnMLq3IdPm532lKH0KPjO p3VPKI5pKoGVgy1KJZ0oV3vYY4IbVrRSnQapD4y6R6W8oDrp8gelixAfbEkrFxAafK5O 6CYXMlVzI93UJu1aOnLVC2kHd238ze0OHBTfUVsEL3Ie+y6SrUDFaN41T5KR/bwb7FSE heog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PQz0Z++h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id m190-20020a633fc7000000b005ad8009e304si4599314pga.784.2023.10.30.00.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 00:31:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PQz0Z++h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 53B238065C9C; Mon, 30 Oct 2023 00:30:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231641AbjJ3Han (ORCPT + 99 others); Mon, 30 Oct 2023 03:30:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbjJ3Hal (ORCPT ); Mon, 30 Oct 2023 03:30:41 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BEE2C0; Mon, 30 Oct 2023 00:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698651038; x=1730187038; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gXWZpt2Baaec3XxSr1059DajNSiecR9cDaFSnzG5vok=; b=PQz0Z++h+BP1Pp3w2Bxw6+Qo1Y2ZSKqN73ddO+qj6NXCK/A+weiygUyd bz40V9A4bvaZd5ikDMyW8IdpqiMTKi8asPWSTwKx5VuqCMLx3u7QrFiTK toLrlTePKCeH+YgDM6K6SJF3pJ6oMNr3yLg1eipwjfMW5wbcz5hUr8rzQ sXWRgZ99C/5D6IWseIAAEL6F71ZPrfqk2Ix4IASG87PYDilYSiaewppk4 VsL12DYGbf8TCX6z4x4x5C6BRIB866W/cUK79jpoxUwtwuoMSHyO0bSlJ 2AkfKEC3vbH85bRQmSg9Jf4CTZd5Z2IQUgQfdUrVvyIyD8/fTR8+z7aUb g==; X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="390884489" X-IronPort-AV: E=Sophos;i="6.03,262,1694761200"; d="scan'208";a="390884489" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 00:30:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="736661418" X-IronPort-AV: E=Sophos;i="6.03,262,1694761200"; d="scan'208";a="736661418" Received: from kuha.fi.intel.com ([10.237.72.185]) by orsmga006.jf.intel.com with SMTP; 30 Oct 2023 00:30:35 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 30 Oct 2023 09:30:34 +0200 Date: Mon, 30 Oct 2023 09:30:34 +0200 From: Heikki Krogerus To: RD Babiera Cc: gregkh@linuxfoundation.org, linux@roeck-us.net, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, badhri@google.com, stable@vger.kernel.org Subject: Re: [PATCH v1] usb: typec: tcpm: only discover modes the port supports svids for Message-ID: References: <20231016232816.3355132-2-rdbabiera@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 30 Oct 2023 00:30:53 -0700 (PDT) Hi, I'm sorry to keep you waiting. > > If you need the modes to be discovered in some specific order, then we > > need the framework to allow you to do that. So perhaps the tcpci > > drivers should be able to supply the preferred order to the tcpm? > > > > But as such, unless I'm mistaken, this patch will change the logic so > > that only the partner alt modes that the port supports get registered, > > and that way are exposed to the user. You can't do that - right now > > it's the only way we can inform the user about them. All partner > > alternate modes (at least the SVIDs) must be exposed to the user one > > way or the other, regardless does the port support them or not. > > The test this patch tries to fix could just be written without consideration > of this. My guess is that the test was designed such that the SVIDs before > the DisplayPort SVID are unknown to the port under test so the mentality > could have been "why should a port care about SVIDs it doesn't know > about?" > > A defense I could make for it is that the USB PD CTS doesn't test > to see if a port under test sends Discover Modes for every SVID returned > in a Discover SVIDs ACK, so the interpretation isn't invalid. I've seen other > tcpm implementations handle Discover Modes this way as well. > > Regardless, you're definitely right that the user should know about all > Alt Modes/SVIDs - the port would lose SVID information without > registering a partner altmode for it. Currently I think the approaches to pass > this test look like: > 1. Your suggestion - let the tcpci decide if there should be a > discovery order. > Alternatively, let the tcpci decide if it wants to opt into this > patch's behavior of > only discovering modes for known SVIDs - a strict discovery flag. > 2. Send a Discover Mode message to known SVIDs first in the order > they come in, and then to unknown SVIDs. The test passes and no information > is lost, but it's unnecessary refactoring just to pass one test for > one Alt Mode. > 3. Don't send a Discover Mode message to unknown SVIDs, but do register > an Alt Mode with blank info for that SVID. It passes the test without having to > do any reordering compared to the first option and it preserves supported > SVIDs. But, the port would lose information such as each SVID's Alt Modes > VDO plus each SVID can support more than one Alt Mode. > > Let me know if any of these approaches sound worth pursuing; I do think > Option 1 does make more sense than the others. I would like to hear what Guenter thinks. Guenter, do you have time to take a look at this? thanks, -- heikki