linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Z.q. Hou" <zhiqiang.hou@nxp.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	PCI <linux-pci@vger.kernel.org>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
	Michael Walle <michael@walle.cc>,
	Ard Biesheuvel <ardb@kernel.org>
Subject: RE: [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops
Date: Mon, 21 Sep 2020 16:31:27 +0000	[thread overview]
Message-ID: <HE1PR0402MB33712A16B4A894BE6CD4D3A9843A0@HE1PR0402MB3371.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20200918124710.GA1800067@bjorn-Precision-5520>

Hi Bjorn,

Thanks a lot for your comments!

> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: 2020年9月18日 20:47
> To: Z.q. Hou <zhiqiang.hou@nxp.com>
> Cc: Rob Herring <robh@kernel.org>; linux-kernel@vger.kernel.org; PCI
> <linux-pci@vger.kernel.org>; Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>;
> Bjorn Helgaas <bhelgaas@google.com>; Gustavo Pimentel
> <gustavo.pimentel@synopsys.com>; Michael Walle <michael@walle.cc>;
> Ard Biesheuvel <ardb@kernel.org>
> Subject: Re: [PATCH] PCI: dwc: Added link up check in map_bus of
> dw_child_pcie_ops
> 
> On Fri, Sep 18, 2020 at 11:02:07AM +0000, Z.q. Hou wrote:
> 
> > But now the SError is exactly caused by the first access of the
> > non-existent function, I dug into the kernel enumeration code and
> > found it will fire a 4Byte CFG read transaction to read the Vendor ID
> > and Device ID together, so I suspect the root cause is access the
> > Device ID of a non-existent function triggers SError.
> >
> > So the alternative solution seems to correct the PCIe enumeration, I
> > will submit a patch to let the first access only read the Vendor ID.
> 
> If it is incorrect for the first access to be a 32-bit read of both the Vendor
> and the Device ID, please cite the relevant section of the spec in your patch.
> 
> I don't like to make changes to generic code to accommodate specific pieces
> of hardware because then we restrict future changes based on some device
> that will soon be obsolete and forgotten.
> 
> I'm pretty sure the spec language about CRS handling is careful to talk about
> "reads that *include* Vendor ID", not just "reads of Vendor ID", so the
> implication is that it covers 32-bit reads as well as 16-bit reads.
> 

Yes, I agree with you that we must be carful with the generic code.
NXP Layerscape SError aside, it turns out to be more complex, limiting the first CFG access to 16-bit Vendor ID also causes SError, the hardware behavior seems not the same as the described of the register PCIE_ABSERR.

For the PCIe enumeration, I found the descriptions of Vendor ID and Device ID in the PCI Express Base Specification, Rev. 4.0 Version 1.0 (pasted below), it recommends to read Vendor ID to determine the presentence of a function and use the Device ID (with Vendor ID and Revision ID) to determine the driver needed. But in section 2.3.2 Completion Handling Rules, it seems, as you said, not limit to 16-bit Vendor ID, so I want to hear your and Rob's suggestion on this change. 

7.5.1.1.1 Vendor ID Register (Offset 00h)
The Vendor ID register is HwInit and the value in this register identifies the manufacturer of the
Function. In keeping with PCI-SIG procedures, valid vendor identifiers must be allocated by the
PCI-SIG to ensure uniqueness. Each vendor must have at least one Vendor ID. It is recommended
that software read the Vendor ID register to determine if a Function is present, where a value of
FFFFh indicates that no Function is present.
7.5.1.1.2 Device ID Register (Offset 02h)
The Device ID register is HwInit and the value in this register identifies the particular Function.
The Device ID must be allocated by the vendor. The Device ID, in conjunction with the Vendor ID
and Revision ID, are used as one mechanism for software to determine which driver should be
loaded. The vendor must ensure that the chosen values do not result in the use of an incompatible
device driver.

Regards,
Zhiqiang

> Bjorn

  reply	other threads:[~2020-09-21 16:31 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  5:41 [PATCH] PCI: dwc: Added link up check in map_bus of dw_child_pcie_ops Zhiqiang Hou
2020-09-16 20:28 ` Rob Herring
2020-09-18 11:02   ` Z.q. Hou
2020-09-18 11:14     ` Michael Walle
2020-09-21 14:48       ` Z.q. Hou
2020-09-18 12:47     ` Bjorn Helgaas
2020-09-21 16:31       ` Z.q. Hou [this message]
2020-09-18 15:27     ` Rob Herring
2020-09-24  4:24       ` Z.q. Hou
2020-09-28  9:39         ` Lorenzo Pieralisi
2020-09-29  4:05           ` Z.q. Hou
2020-09-29 15:24             ` Gustavo Pimentel
2020-09-29 17:11               ` Rob Herring
2020-09-30 13:22                 ` Kishon Vijay Abraham I
2020-09-30 15:01                   ` Rob Herring
2020-10-01 13:32                     ` Kishon Vijay Abraham I
2020-10-01 16:46                       ` Michael Walle
2020-10-02  9:29                         ` Naresh Kamboju
2020-10-08 14:46                           ` Naresh Kamboju
2020-10-08 15:12                             ` Rob Herring
2020-10-08 16:51                               ` Naresh Kamboju
2020-10-08 15:08                       ` Lorenzo Pieralisi
2020-10-12 16:31                         ` Kishon Vijay Abraham I
2020-10-12  4:41                       ` Z.q. Hou
2020-10-19 16:13                         ` Lorenzo Pieralisi
2020-10-20  8:07                           ` Kishon Vijay Abraham I
2020-10-12  4:22                 ` Z.q. Hou
2020-10-20  9:48       ` Lorenzo Pieralisi
2020-10-13  9:15 ` Lorenzo Pieralisi
2020-10-14 11:13 ` Lorenzo Pieralisi
2020-10-14 12:37   ` Rob Herring
2020-10-15 22:47 ` Bjorn Helgaas
2020-10-16 11:59   ` Lorenzo Pieralisi
2020-10-19  5:24   ` Z.q. Hou
2020-10-19  5:41     ` Kishon Vijay Abraham I
2020-10-20  2:13       ` Z.q. Hou
2020-10-20  9:12         ` Lorenzo Pieralisi
2020-10-20  9:55         ` Lorenzo Pieralisi
2020-10-21  8:47           ` Z.q. Hou
2020-10-22  6:20             ` Richard Zhu
2020-10-19 16:26   ` Lorenzo Pieralisi
2020-10-20 10:19   ` Lorenzo Pieralisi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=HE1PR0402MB33712A16B4A894BE6CD4D3A9843A0@HE1PR0402MB3371.eurprd04.prod.outlook.com \
    --to=zhiqiang.hou@nxp.com \
    --cc=ardb@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=michael@walle.cc \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).