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: <20241211163629.00002937@huawei.com>
Date: Wed, 11 Dec 2024 16:36:29 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
CC: <linux-pci@...r.kernel.org>, Bjorn Helgaas <bhelgaas@...gle.com>, "Mahesh
 J Salgaonkar" <mahesh@...ux.ibm.com>, Oliver O'Halloran <oohall@...il.com>,
	Lukas Wunner <lukas@...ner.de>, Krzysztof Wilczyński
	<kw@...ux.com>, <linux-kernel@...r.kernel.org>,
	<linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH v6 5/8] PCI: Store # of supported End-End TLP Prefixes

On Fri, 13 Sep 2024 17:36:29 +0300
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com> wrote:

> eetlp_prefix_path in the struct pci_dev tells if End-End TLP Prefixes
> are supported by the path or not, the value is only calculated if
> CONFIG_PCI_PASID is set.
> 
> The Max End-End TLP Prefixes field in the Device Capabilities Register
> 2 also tells how many (1-4) End-End TLP Prefixes are supported (PCIe r6
> sec 7.5.3.15). The number of supported End-End Prefixes is useful for
> reading correct number of DWORDs from TLP Prefix Log register in AER
> capability (PCIe r6 sec 7.8.4.12).
> 
> Replace eetlp_prefix_path with eetlp_prefix_max and determine the
> number of supported End-End Prefixes regardless of CONFIG_PCI_PASID so
> that an upcoming commit generalizing TLP Prefix Log register reading
> does not have to read extra DWORDs for End-End Prefixes that never will
> be there.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
> ---
>  drivers/pci/ats.c             |  2 +-
>  drivers/pci/probe.c           | 14 +++++++++-----
>  include/linux/pci.h           |  2 +-
>  include/uapi/linux/pci_regs.h |  1 +
>  4 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
> index c570892b2090..e13433dcfc82 100644
> --- a/drivers/pci/ats.c
> +++ b/drivers/pci/ats.c
> @@ -377,7 +377,7 @@ int pci_enable_pasid(struct pci_dev *pdev, int features)
>  	if (WARN_ON(pdev->pasid_enabled))
>  		return -EBUSY;
>  
> -	if (!pdev->eetlp_prefix_path && !pdev->pasid_no_tlp)
> +	if (!pdev->eetlp_prefix_max && !pdev->pasid_no_tlp)
>  		return -EINVAL;
>  
>  	if (!pasid)
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index b14b9876c030..0ab70ea6840c 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2228,8 +2228,8 @@ static void pci_configure_relaxed_ordering(struct pci_dev *dev)
>  
>  static void pci_configure_eetlp_prefix(struct pci_dev *dev)
>  {
> -#ifdef CONFIG_PCI_PASID
>  	struct pci_dev *bridge;
> +	unsigned int eetlp_max;
>  	int pcie_type;
>  	u32 cap;
>  
> @@ -2241,15 +2241,19 @@ static void pci_configure_eetlp_prefix(struct pci_dev *dev)
>  		return;
>  
>  	pcie_type = pci_pcie_type(dev);
> +
> +	eetlp_max = FIELD_GET(PCI_EXP_DEVCAP2_EE_PREFIX_MAX, cap);
> +	/* 00b means 4 */
> +	eetlp_max = eetlp_max ?: 4;
> +
>  	if (pcie_type == PCI_EXP_TYPE_ROOT_PORT ||
>  	    pcie_type == PCI_EXP_TYPE_RC_END)
> -		dev->eetlp_prefix_path = 1;
> +		dev->eetlp_prefix_max = eetlp_max;
>  	else {
>  		bridge = pci_upstream_bridge(dev);
> -		if (bridge && bridge->eetlp_prefix_path)
> -			dev->eetlp_prefix_path = 1;
> +		if (bridge && bridge->eetlp_prefix_max)

What happens if they disagree?  That is the bridge supports 2
and the device 3?


> +			dev->eetlp_prefix_max = eetlp_max;
>  	}
> -#endif
>  }



>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ