Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2320521rwd; Wed, 17 May 2023 08:29:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7wG05gjoxVAVIJivjEUL0B5FBRKBoKY20N2UA12yMz0tzqw88D82YA+46/1lisep83xz/E X-Received: by 2002:a05:6a20:8e19:b0:105:12ab:8785 with SMTP id y25-20020a056a208e1900b0010512ab8785mr9017823pzj.9.1684337399368; Wed, 17 May 2023 08:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684337399; cv=none; d=google.com; s=arc-20160816; b=zfg8UvbiCoo1ZvqQ7bUXUzK0TZik63ia1dtkAoko+WKEgqzochpdOlxboKigLmgCKr jTwZ4gK2rVLs3PKSsE1UjWbmzAP8V24xood+QwEidp4lSOASlIg3nidAZ4Zsae8TQ7pm dz8pQy2LseE4ZqyDTFwlOvxt1WHSOG9xDkGVX5YyRTiB8ISCnGibU25v2P4r4/VTWmSs 5NKM8I/JhtpZ/5VEsSPCQqv2QdHD4c79Sa30UFC36yy2o3rKdHpZA2JhOzoANf/wlRqG eDSs5CLlnqdQqswJfFUgfclneWMjsEO58nHJBm6Ck8mNpTjniSUROcTRmfzSvHqsxr7n SlJA== 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=TVYWhOG+T8bCGvNMifPdFtFVwZCL7OQvLMTkZ80hvR8=; b=BQ7arPBOoXDm9+nk0pedZzF0oMiCTkJF6fSA2ZWPxz1fd+7UoyKm1HogBSYhjoE9aS 23XK90XrSlIOV6z2dpfuB6gR3j31C/sTlYRxV+dpE1NCRzZ9EQBZ8gNsxuSXqN4tOq5Q aL73YUe9BsaDGzk2AgqmDT34ME1xX/U8lcXr+cfcRxU0rfPw/ScnkfZGT+Y5yf2bpxyu 4hDjCm2SKJ/wSCFKk5mVpBtUXxnlMWfsymvL/cOVqRt8BkH83iRPlmK0ecW/b70E4wWZ bNaMs9d9ncadSnJoko4FwOVBTXk72o1/OgICkdw0kvYGpK0b7ZHmHAv+X4pEd7IhG/WI SZ6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bjrUez/4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m2-20020a637d42000000b005306facab05si16041476pgn.120.2023.05.17.08.29.47; Wed, 17 May 2023 08:29:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bjrUez/4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231642AbjEQPKz (ORCPT + 99 others); Wed, 17 May 2023 11:10:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231687AbjEQPKu (ORCPT ); Wed, 17 May 2023 11:10:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB6AA5D4; Wed, 17 May 2023 08:10:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C2A1A60FBD; Wed, 17 May 2023 15:10:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CEE0C433EF; Wed, 17 May 2023 15:10:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684336238; bh=Ny0LoiDv3bdptEg6qSZYN06fzaz93keaVkr7dslnSLA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bjrUez/4cBi2daN/lwRZUVJr2uMICn2TiWwRJKY5GVljwxRJOtPmsMt6z2oSfhDDc Y7RwIrQi3vSr6HeQjOf4WI+hDofp6G4GK7v7A3NtM9jpr9qKtqUjUbl7UPV/I76NJ5 Sa0bdeTErhYfHu7YdrPjpP7dzFT9ozbHgkDBuMpbjmT5Sr5VbUUP04Qu0lXHs9R4zh IhgpGJd+v+zIHLhCMnrzGT4MDkq3rNDnZkTqGmnXqiI82k0+LCYUDakvZKOz2OdisR 4XEPouomRWHk9Irbh7o/AGGGwNbXx/JHMW977iXccU/BTP7tV6BAIDzEvDM06yKhI1 Cyc3s/ZLhGWSQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pzInW-0005qx-Fz; Wed, 17 May 2023 17:10:39 +0200 Date: Wed, 17 May 2023 17:10:38 +0200 From: Johan Hovold To: Krishna Kurapati PSSNV Cc: Thinh Nguyen , Greg Kroah-Hartman , Philipp Zabel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, quic_pkondeti@quicinc.com, quic_ppratap@quicinc.com, quic_wcheng@quicinc.com, quic_jackp@quicinc.com, quic_harshq@quicinc.com, ahalaney@redhat.com Subject: Re: [PATCH v8 3/9] usb: dwc3: core: Access XHCI address space temporarily to read port info Message-ID: References: <20230514054917.21318-1-quic_kriskura@quicinc.com> <20230514054917.21318-4-quic_kriskura@quicinc.com> <82a8c414-bfa8-5066-fb68-1ac117b76c4e@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <82a8c414-bfa8-5066-fb68-1ac117b76c4e@quicinc.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 17, 2023 at 05:51:45PM +0530, Krishna Kurapati PSSNV wrote: > On 5/17/2023 1:05 PM, Johan Hovold wrote: > >>>> + temp = readl(regs + DWC3_XHCI_HCSPARAMS1); > >>>> + if (HCS_MAX_PORTS(temp) != (dwc->num_usb3_ports + dwc->num_usb2_ports)) { > >>>> + dev_err(dwc->dev, > >>>> + "Mismatched reported MAXPORTS (%d)\n", HCS_MAX_PORTS(temp)); > >>>> + ret = -EINVAL; > >>>> + goto unmap_reg; > >>>> + } > >>> > >>> Not sure this is needed either. > >>> > >>> Could this risk regressing platforms which does not have currently have > >>> all PHYs described in DT? > >>> > >> No, it doesn't. AFAIK, this only tells how many ports are present as per > >> the core consultant configuration of the device. I tried to explain what > >> would happen incase phy's are not present in DT in [2] & [3]. > > > > Right, whether the PHYs are described in DT is not directly related to > > this. > > > > As long as HCS_MAX_PORTS by definition (assumption) is always > > (dwc->num_usb3_ports + dwc->num_usb2_ports) any such machines would > > continue to work. > > > > But if you want to catch machines where this assumption does not hold, > > you could also end up regressing machines which have so far been working > > despite these numbers not adding up. > > > > That may be acceptable, but I'm still not sure what the value of this > > check is (e.g. as xhci core will handle basic sanity checks like usb2 + > > usb3 <= max_ports). > Thanks for the review comments. Ideally the HCC_PARAMS1 must indicate > total number of ports supported. If not then I believe the core > consultant configuration is wrong. > > According to the spec: > > "The MaxPorts value in the HCSPARAMS1 register defines the number of > Port Register Sets (e.g. PORTSC, PORTPMSC, and PORTLI register sets)." > > So shouldn't the (usb2+usb3 ports be equal to MaxPorts to ensure each > port properly accesses the respective PortSC etc., ? Sure, that's what is expected, but why do you need to add a check for this in the glue driver all of a sudden? Your series does not seem to rely on this. This is the xHCI driver's business (as is parsing these registers in the first place, really). Johan