Message ID | 20210222011717.43266-1-qiuxu.zhuo@intel.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | [v3,1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association | expand |
Hi Bjorn, Do you have any comments on this patch? If need any changes, please let me know. Thanks! -Qiuxu > -----Original Message----- > From: Zhuo, Qiuxu <qiuxu.zhuo@intel.com> > Sent: Monday, February 22, 2021 9:17 AM > To: Bjorn Helgaas <bhelgaas@google.com> > Cc: Zhuo, Qiuxu <qiuxu.zhuo@intel.com>; Lorenzo Pieralisi > <lorenzo.pieralisi@arm.com>; Krzysztof WilczyĆski <kw@linux.com>; Kelley, > Sean V <sean.v.kelley@intel.com>; Luck, Tony <tony.luck@intel.com>; Jin, Wen > <wen.jin@intel.com>; linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: [PATCH v3 1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association > > Function rcec_assoc_rciep() incorrectly used "rciep->devfn" (a single byte > encoding the device and function number) as the device number to check > whether the corresponding bit was set in the RCiEPBitmap of the RCEC (Root > Complex Event Collector) while enumerating over each bit of the RCiEPBitmap. > > As per the PCI Express Base Specification, Revision 5.0, Version 1.0, Section > 7.9.10.2, "Association Bitmap for RCiEPs", p. 935, only needs to use a device > number to check whether the corresponding bit was set in the RCiEPBitmap. > > Fix rcec_assoc_rciep() using the PCI_SLOT() macro and convert the value of > "rciep->devfn" to a device number to ensure that the RCiEP devices associated > with the RCEC are linked when the RCEC is enumerated. > > Fixes: 507b460f8144 ("PCI/ERR: Add pcie_link_rcec() to associate RCiEPs") > Reported-and-tested-by: Wen Jin <wen.jin@intel.com> > Reviewed-by: Sean V Kelley <sean.v.kelley@intel.com> > Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> > --- > v2->v3: > Drop "[ Krzysztof: Update commit message. ]" from the commit message > > drivers/pci/pcie/rcec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/pcie/rcec.c b/drivers/pci/pcie/rcec.c index > 2c5c552994e4..d0bcd141ac9c 100644 > --- a/drivers/pci/pcie/rcec.c > +++ b/drivers/pci/pcie/rcec.c > @@ -32,7 +32,7 @@ static bool rcec_assoc_rciep(struct pci_dev *rcec, struct > pci_dev *rciep) > > /* Same bus, so check bitmap */ > for_each_set_bit(devn, &bitmap, 32) > - if (devn == rciep->devfn) > + if (devn == PCI_SLOT(rciep->devfn)) > return true; > > return false; > -- > 2.17.1
On Mon, Feb 22, 2021 at 09:17:17AM +0800, Qiuxu Zhuo wrote: > Function rcec_assoc_rciep() incorrectly used "rciep->devfn" (a single > byte encoding the device and function number) as the device number to > check whether the corresponding bit was set in the RCiEPBitmap of the > RCEC (Root Complex Event Collector) while enumerating over each bit of > the RCiEPBitmap. > > As per the PCI Express Base Specification, Revision 5.0, Version 1.0, > Section 7.9.10.2, "Association Bitmap for RCiEPs", p. 935, only needs to > use a device number to check whether the corresponding bit was set in > the RCiEPBitmap. > > Fix rcec_assoc_rciep() using the PCI_SLOT() macro and convert the value > of "rciep->devfn" to a device number to ensure that the RCiEP devices > associated with the RCEC are linked when the RCEC is enumerated. > > Fixes: 507b460f8144 ("PCI/ERR: Add pcie_link_rcec() to associate RCiEPs") > Reported-and-tested-by: Wen Jin <wen.jin@intel.com> > Reviewed-by: Sean V Kelley <sean.v.kelley@intel.com> > Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> I think 507b460f8144 appeared in v5.11, so not something we broke in v5.12. Applied to pci/error for v5.13, thanks! If I understand correctly, we previously only got this right in one case: 0 == PCI_SLOT(00.0) # correct 1 == PCI_SLOT(00.1) # incorrect 2 == PCI_SLOT(00.2) # incorrect ... 8 == PCI_SLOT(01.0) # incorrect 9 == PCI_SLOT(01.1) # incorrect ... 31 == PCI_SLOT(03.7) # incorrect > --- > v2->v3: > Drop "[ Krzysztof: Update commit message. ]" from the commit message > > drivers/pci/pcie/rcec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/pcie/rcec.c b/drivers/pci/pcie/rcec.c > index 2c5c552994e4..d0bcd141ac9c 100644 > --- a/drivers/pci/pcie/rcec.c > +++ b/drivers/pci/pcie/rcec.c > @@ -32,7 +32,7 @@ static bool rcec_assoc_rciep(struct pci_dev *rcec, struct pci_dev *rciep) > > /* Same bus, so check bitmap */ > for_each_set_bit(devn, &bitmap, 32) > - if (devn == rciep->devfn) > + if (devn == PCI_SLOT(rciep->devfn)) > return true; > > return false; > -- > 2.17.1 >
> [...] > > I think 507b460f8144 appeared in v5.11, so not something we broke in v5.12. > Applied to pci/error for v5.13, thanks! Thanks Bjorn! > If I understand correctly, we previously only got this right in one > case: > > 0 == PCI_SLOT(00.0) # correct > 1 == PCI_SLOT(00.1) # incorrect > 2 == PCI_SLOT(00.2) # incorrect > ... > 8 == PCI_SLOT(01.0) # incorrect > 9 == PCI_SLOT(01.1) # incorrect > ... > 31 == PCI_SLOT(03.7) # incorrect Yes, you're right. Thanks! -Qiuxu
diff --git a/drivers/pci/pcie/rcec.c b/drivers/pci/pcie/rcec.c index 2c5c552994e4..d0bcd141ac9c 100644 --- a/drivers/pci/pcie/rcec.c +++ b/drivers/pci/pcie/rcec.c @@ -32,7 +32,7 @@ static bool rcec_assoc_rciep(struct pci_dev *rcec, struct pci_dev *rciep) /* Same bus, so check bitmap */ for_each_set_bit(devn, &bitmap, 32) - if (devn == rciep->devfn) + if (devn == PCI_SLOT(rciep->devfn)) return true; return false;