lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250711214558.GA2308483@bhelgaas>
Date: Fri, 11 Jul 2025 16:45:58 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
	Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
	Jingoo Han <jingoohan1@...il.com>,
	Lorenzo Pieralisi <lpieralisi@...nel.org>,
	Rob Herring <robh@...nel.org>, Jeff Johnson <jjohnson@...nel.org>,
	Bartosz Golaszewski <brgl@...ev.pl>,
	Manivannan Sadhasivam <mani@...nel.org>,
	Krzysztof Wilczyński <kwilczynski@...nel.org>,
	linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-msm@...r.kernel.org, mhi@...ts.linux.dev,
	linux-wireless@...r.kernel.org, ath11k@...ts.infradead.org,
	qiang.yu@....qualcomm.com, quic_vbadigan@...cinc.com,
	quic_vpernami@...cinc.com, quic_mrana@...cinc.com,
	Jeff Johnson <jeff.johnson@....qualcomm.com>
Subject: Re: [PATCH v4 10/11] PCI: Add function to convert lnkctl2speed to
 pci_bus_speed

On Mon, Jun 09, 2025 at 04:21:31PM +0530, Krishna Chaitanya Chundru wrote:
> Add a exported function to convert lnkctl2speed to enum pci_bus_speed,
> so that other kernel drivers can use it.

Name the function explicitly in subject and commit log.

> Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
> ---
>  drivers/pci/pci.c   | 12 ++++++++++++
>  include/linux/pci.h |  1 +
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index e9448d55113bdfd2263d8e2f6b3ec802f56b712e..8950e88826e27accfe699e31fba8f4077c26296f 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -6018,6 +6018,18 @@ int pcie_link_speed_mbps(struct pci_dev *pdev)
>  }
>  EXPORT_SYMBOL(pcie_link_speed_mbps);
>  
> +/**
> + * pci_lnkctl2_bus_speed - convert lnkctl2 speed to pci_bus_speed
> + * @speed: LNKCAP2 SLS value
> + *
> + * Return: pci_bus_speed
> + */
> +enum pci_bus_speed pci_lnkctl2_bus_speed(int speed)
> +{
> +	return pcie_link_speed[speed];
> +}
> +EXPORT_SYMBOL(pci_lnkctl2_bus_speed);

You mention both "lnkctl2" and "LNKCAP2" and I don't know whether you
mean Link Capabilities 2 or Link Control 2, and I don't know what the
bits passed in are.

I expect something like FIELD_GET(PCI_EXP_LNKCAP2_SLS, value) here
that tells us clearly where it came from, so the caller isn't
responsible for extracting it.  And it takes some kind of unsigned
value, probably a u32 if it came from Link Capabilities 2.

Bjorn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ