From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB0863B9933 for ; Wed, 27 May 2026 08:28:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779870539; cv=none; b=U4SpytUWTXUiG/xlP7DFWJPCbu9E8SuVtlTBPe9sRXyqfDIn+Dt6yF3Glf1A6ndAPPx7AcagMNYA+vlfd56V0PZ7UQ2UKxEQ0PhcO9XVpxXwGlCUdePN9Q7Ql2Dd/6Abycm6QvDYuGpNwocsfQbfRmVkbIV602a5RpMWKD2RLYs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779870539; c=relaxed/simple; bh=dnKKV4k9imrwOYYrkrG7utWup+ZEdJNlE4/zhl36kBI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Rs/dxGn4cz7xAFX7OD6HdhSkGZMgEj/tpKeQkX6LVqXi8FYPI0b5c8uMOrGki4V/aXLUNQwk1UgNSbeVYbZ+sjM9vXWfffvz5ZtR1lRCPcnkgec/vo5uWCIju5+JjZ5JuGGyLTPAnubrKYmzo7cisl+QxU3usLTtBHLpRwsZUYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Hq698nOU; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Hq698nOU" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-452169ae568so7389638f8f.3 for ; Wed, 27 May 2026 01:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779870536; x=1780475336; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RXP90BLkmwM022fcUvwY7xPlmUwoYsB+/2erQUJ8WqM=; b=Hq698nOUn4wUZTU18JpCC2UeibTPT3RxLM11uHaERs5WIG4PXnTt7IFoKvxGKOfO2s rUIBjxBYd8QjS18JjHhqBAZ9cohwcCNPxgF7tare23DAQX1t8OoVZ21lyFkNBUgbanK1 DDHx+Zs5vNTHU+KwTKWgjUXittWyo//W64HFduvlrUMr1OZeFNadh7Wpnz95NLYxKJMy zXGdMkzOhsbzRUZA+W5fmYl5izkAFj7ywlGylCy6e8DqLf2vTcy3crbNN3zlwdsY3pb4 1GyadCEIQbENK7HaZjyrj+XxRtLprmxbcePVkAkQE03rml9oT+HvVcKtHXPrZE9SARBX wr4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779870536; x=1780475336; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RXP90BLkmwM022fcUvwY7xPlmUwoYsB+/2erQUJ8WqM=; b=q0xdx34Rvy6gZMUBBKGxfNS7E2Yw/NTPhSK/IM24hkqH4nKIG/qyA00yepF4LRTgkv dibsDetZsdNZ8oZWDaFiBVN9LD1ZotG32RTc16GpdZS0QtzYlNB7DgKZQeLSIA2csF8x BOyxXAaOYsUlIhH2sfgC9XuRMnA089vz1S3MER7OOD+qDVv3fg5gOhNl9e31kto9I6Bb 04VI+xHbTFCYBK8iQCG6uFYiltBsb5ofpxxXdl6HGM3FekNLETNyx5L5lhHvlWhWLpdH JlawhszBicuDNeAFWApYgJBWYQZ/k6f8p6AXpqykpW/D/GT5+2xjwsMIKZ15LLFYoqnM nzQw== X-Forwarded-Encrypted: i=1; AFNElJ/QJJsPTGLw7XU/gGd7kC0Cx4xlaOY5LjzyFvmBcMN70g2GHlAjkssHYnKR3Q9Vv6Cr2qAlunHT0YDGxA==@vger.kernel.org X-Gm-Message-State: AOJu0YwzlR4+HuaqxuzT0c3pp6cITKutSUN5TCYEFpoHe5tTWK+6wvRU 3NihEpJymFkcCrxS2pAlltSQCRZswD5OnwPI3v1TfktsXiBKUylV8qRo X-Gm-Gg: Acq92OGHxbaECtDBe11p6r6GzoctUWHIzIaYzr+pvobjcmdh7Hqla5kLvuo77Bb1ubM XjY8w63hBT2Gs94fwMtmI+CrtPrjkCBdXaOWcr+16rK0aIpoNqIoKROJrp93Jxz7VVb3lpDh13R ENtD9JePrdTl+olbFscT1a3HxT6LuGT+xGXxVrb8HldftC++/oIzdet/Dpw8tLaB5dRUsOf8ge6 pWEKRedi9gmaoeZP5OrlX5+Powev8oqDdkfNrOonNPu7d+F+KwU7FtkJbiM0nUMpzNXks7cHy6D GhQCUb2jgFkbXa111dGq5+8uE0k5J4b4f3CORHliI27C6mk/1LAyRrgvEgOvU43++LjK5ODPreD XhxClbavQdysWPov1Xiu13l7qR+WeeUQmokrShxlOukfiEmDG+R4VwD0bPdSAD/Ymdpx1SkY9Ol bGBBZeitNd2qV4QBwb08Uv1DQHxKf3GcmqAQO+4QHyJnbRd7d62jaRMT2QBUTvhi2GlRbO8MK2f 8A9DU5H/C5SuQ== X-Received: by 2002:a05:6000:4b07:b0:43c:cf25:f29a with SMTP id ffacd0b85a97d-45eb3689049mr34779824f8f.8.1779870536122; Wed, 27 May 2026 01:28:56 -0700 (PDT) Received: from orome (p200300e41f1bda00f22f74fffe1f3a53.dip0.t-ipconnect.de. [2003:e4:1f1b:da00:f22f:74ff:fe1f:3a53]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45edb5c27e7sm4474850f8f.35.2026.05.27.01.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 01:28:54 -0700 (PDT) Date: Wed, 27 May 2026 10:28:51 +0200 From: Thierry Reding To: Lukas Wunner Cc: Thierry Reding , Bjorn Helgaas , Lorenzo Pieralisi , Krzysztof Wilczy??ski , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Hunter , Karthikeyan Mitran , Hou Zhiqiang , Thomas Petazzoni , Pali =?utf-8?B?Um9ow6Fy?= , Michal Simek , Kevin Xie , Aksh Garg , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thierry Reding Subject: Re: [PATCH v5 2/4] PCI: Use standard wait times for PCIe link monitoring Message-ID: References: <20260526-tegra264-pcie-v5-0-84a813b979d7@nvidia.com> <20260526-tegra264-pcie-v5-2-84a813b979d7@nvidia.com> Precedence: bulk X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="y57fabq4zbjqmwuy" Content-Disposition: inline In-Reply-To: --y57fabq4zbjqmwuy Content-Type: text/plain; protected-headers=v1; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH v5 2/4] PCI: Use standard wait times for PCIe link monitoring MIME-Version: 1.0 On Tue, May 26, 2026 at 01:10:39PM +0200, Lukas Wunner wrote: > On Tue, May 26, 2026 at 10:53:11AM +0200, Thierry Reding wrote: > > Instead of defining the wait values for each driver, use common values > > defined in the core pci.h header file. Note that most drivers don't use > > the millisecond waits, but rather usleep_range(), so add these commonly > > used values to the header so that all drivers can use them. >=20 > Hm, why not just replace usleep_range() with msleep() and use the existing > macro instead of defining new ones? I'm trying to somewhat unify the implementations across drivers without changing behaviour. I don't have a way of testing any of these drivers, so keeping the existing implementation and just switching out the symbol seemed like a good compromise. > > +++ b/drivers/pci/pci.h > > @@ -63,6 +63,8 @@ struct pcie_tlp_log; > > /* Parameters for the waiting for link up routine */ > > #define PCIE_LINK_WAIT_MAX_RETRIES 10 > > #define PCIE_LINK_WAIT_SLEEP_MS 90 > > +#define PCIE_LINK_WAIT_US_MIN 90000 > > +#define PCIE_LINK_WAIT_US_MAX 100000 >=20 > If you absolutely positively want to add a new macro, consider > 90 * USEC_PER_MSEC instead of 90000. That seems rather useless to me. We have a _US infix in those symbolic names, so it's obvious what the unit is, so nobody should be confused as to the purpose of these. I suppose if you want to make sure it correlates to the SLEEP_MS variant we could maybe do: #define PCIE_LINK_WAIT_US_MIN (PCIE_LINK_WAIT_SLEEP_MS * USEC_PER_MSEC) Then again, I count 2 drivers (in linux-next) that use the existing PCIE_LINK_WAIT_SLEEP_MS, one of which multiplies by MILLI to get at the US version (so it could easily be converted to the US_MIN version). Only pcie-designware.c uses msleep() with PCIE_LINK_WAIT_SLEEP_MS, so it is clearly the outlier. Maybe I should just go all the way and drop the SLEEP_MS symbol and replace usage by the US versions? > Moreover, consider using fsleep() instead of adding an additional MAX > macro. This would then be changing behaviour again for all the drivers. Thierry --y57fabq4zbjqmwuy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmoWq0EACgkQ3SOs138+ s6HatRAAg8da90RqnHjyUFhXOqP7Cjo9/fYMdwG9qKAW71wcGfZM2pK1xmC/LV0g MIyhmSbMyevnALrOnbkobpjgl5QbrSNXE2CqxEKR49UlV0o2lATFB+EJlmtPiSN3 7Q464BWjHaibyl6UU5/FV9VDV0pJK5JQfH/x6I+G27E+XQqzMerQeYuq/Gl3ZLQf 1VZqhztZQ7U/GQBX2g+8FO06udWT0JDk5eNXwrqjg11zIG1C5rXkam1kmgXKYB4w YDg5TN7DAqnWeSyE0j6DYVXNImRv3X+MvVW5fH09eJ5yE5m8KXdr26kDKTQ+n931 TTuyEB+mDL+FjI8JRMSU7nHPs3T16m4CtADOSx5UItd3EnHi/gIJMkmsbdo7P5yq LNYGdCameYwMq2r7NO65c9R6H7ARCA81z8frzhj8cT9LyNmwwpLwPnc77oBArl/o DsdZknA8CG5mHmZOvtcQkTfrdKTJQVolANFj8ARi1pg5p30uGNORSnDrsHSyCygR 8oZSWZr5pKs+aYMYk5c2HgNUQ2IHgEaFkTjdBVpOCTzTXX665DNQH+vANxV91jmx oM5yyVFbEhPq2SdXpSuXAhDqjqLFWckgdB2NFdQ+A0qvjkUzyHqNsYBirxrtU4Cn DGjDBzWzYCnn4KcL8eLVcYxybJBsBD+JwfOUv/k3QCFRDwtoqt8= =BbZl -----END PGP SIGNATURE----- --y57fabq4zbjqmwuy--