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: <20240910003029.GA554499@bhelgaas>
Date: Mon, 9 Sep 2024 19:30:29 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Jinjie Ruan <ruanjinjie@...wei.com>
Cc: joyce.ooi@...el.com, lpieralisi@...nel.org, kw@...ux.com,
	manivannan.sadhasivam@...aro.org, robh@...nel.org,
	bhelgaas@...gle.com, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] PCI: altera: Replace TLP_REQ_ID() with macro
 PCI_DEVID()

On Wed, Aug 28, 2024 at 06:42:02PM +0800, Jinjie Ruan wrote:
> The TLP_REQ_ID's function is same as current PCI_DEVID()
> macro, replace it.
> 
> Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
> ---
>  drivers/pci/controller/pcie-altera.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-altera.c b/drivers/pci/controller/pcie-altera.c
> index ef73baefaeb9..650b2dd81c48 100644
> --- a/drivers/pci/controller/pcie-altera.c
> +++ b/drivers/pci/controller/pcie-altera.c
> @@ -55,12 +55,11 @@
>  #define TLP_READ_TAG			0x1d
>  #define TLP_WRITE_TAG			0x10
>  #define RP_DEVFN			0
> -#define TLP_REQ_ID(bus, devfn)		(((bus) << 8) | (devfn))
>  #define TLP_CFG_DW0(pcie, cfg)		\
>  		(((cfg) << 24) |	\
>  		  TLP_PAYLOAD_SIZE)
>  #define TLP_CFG_DW1(pcie, tag, be)	\
> -	(((TLP_REQ_ID(pcie->root_bus_nr,  RP_DEVFN)) << 16) | (tag << 8) | (be))
> +	(((PCI_DEVID(pcie->root_bus_nr,  RP_DEVFN)) << 16) | (tag << 8) | (be))

This doesn't cause a problem per se, but PCI_DEVID() is defined
basically as a PCI core convenience without any particular connection
to the PCIe Requester ID format, so I don't think this is an
improvement.

I think it *would* be an improvement to move TLP_REQ_ID() to
drivers/pci/pci.h, where other drivers could share it.  

It's obvious how the Requester ID must be laid out, but I took a quick
look through the PCIe spec and was surprised that I couldn't find a
clear definition of it, unlike the *Completer ID*, which is specified
in PCIe r6.0, sec 2.2.9.1.

Bjorn

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ