From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 F2A423DC4CB for ; Wed, 27 May 2026 08:28:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779870539; cv=none; b=Clpb0+kqpy/HJhHTd3Ao6B7Got5B+Pagc6Nj5Qy0NRCXTA1pKMmFYcy0pMSdrgxbwkl0ION+evZiyl679pIyKZsEI1xm2x1qNYw19kZJRKstGPr646pD7LROv9krbqqBUDVjxcUemRrmV2rW3f3aPaFQ1ilesY5rfOzKDE3y4Xw= 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.44 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-f44.google.com with SMTP id ffacd0b85a97d-43d73422431so8100429f8f.2 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=HV1V0L53V4yZQUOVxg0AtCZEpH3YihnLGs03/9LEo+M8ItEPDUZFtKHeMZDcBd08Wg Vl8mZ9asoEuLsI5hgR/OIb0CBj2e/EBfcYZxCMfEfmK5+2SDLwEVLRjoQRTLJsoq3INR LNUB9dJNkRO5OWYpq7fHCtAatGkObZbHk9gGV783SJaxCxZiESh0xLjAqOxAr40H/kZs 6JebNb4IZ9JMdxocbBKbz/HNlZDZroDUVvpOgPdlsD9CC11Oi2vFhtgR5kSgN5H2w5sz Qqz+bOVCwBsQ2X6BPBaWl5LpHty9W/jYt1n3AuNTqXRr5SLmteIw8Ny1Fy/7nKkHCW9G c2NQ== X-Forwarded-Encrypted: i=1; AFNElJ9L4O4sWM1Tpf6aFan/VWNyZM3WpD+DGOj8n5IL5qxAWAyjLfgT3sz6Neb02Nvpl3KJx3oeMkxyrTDZ/tY=@vger.kernel.org X-Gm-Message-State: AOJu0Yxv+JldWR6HWzuNAkKwPyrgUomzH0hwslS+ZLwA337stwhYOUNJ fTBn8/a+ZTObsybbEElpJrcmtCZOMoFe181aWS0yU731ll6h7DvGxRF9 X-Gm-Gg: Acq92OGg91ajt8HjONtt+08IQD2wgnZblEsC1WOO1VQ16upvmyyxI+tvg/Avsgj57rb kSn3d+NK7wpleau8rL+szz47id2ZF8Hnj2LXS4qSBabfu+pHWwwr3QkYEgV/504e9NA/YhYtcKq CF3PWCALEYpk9Z6Tqft9WK2zrcqtoyvix6qqAjVjqfdJfliaiqvAyh0KgD1N5CtFmd2HvMQcRih jsucKdZrRuR/pUWF/wuP1Omk9117kK2fOmqtN4bMYG3+dQSk3ivmKn4EcxdhUyJnOZEDYNrQDfx oMk9jSPuxcF2uer/iubJGz6RhrCME3WA8TYiFAlaHEIesNomyhbilsG0W+JXv0ahFqbMaEmWVFO w2YTXdvGjWQb4ea1V9pAFQCu5C4ENoDsMGSn7+G2fOkhR2qMKEcMjOWfvQixRjlXTL9ZF3P48Sb aY2sgMrShuvV3OloeW0QgmMs0TXZC2Hu1QVtnjpTFirbmQjoBiBth0vb9mj7wR6XJHSSAfNs7WZ Met8rkJUmV+SA== 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-kernel@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--