[v2,1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association
diff mbox series

Message ID 20210219022359.435-1-qiuxu.zhuo@intel.com
State Accepted
Commit d9b7eae8e3424c3480fe9f40ebafbb0c96426e4c
Headers show
Series
  • [v2,1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association
Related show

Commit Message

Zhuo, Qiuxu Feb. 19, 2021, 2:23 a.m. UTC
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.

[ Krzysztof: Update commit message. ]

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>
---
v1->v2:
  - Update the subject and the commit message.
  - Add 'Reviewed-by: Sean V Kelley <sean.v.kelley@intel.com>' to the SoB chain.

 drivers/pci/pcie/rcec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Krzysztof WilczyƄski Feb. 22, 2021, 12:56 a.m. UTC | #1
[+cc Lorenzo for visiblity]

Hi,

[...]
> 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.
> 
> [ Krzysztof: Update commit message. ]
[...]

Thank you!  I appreciate that.  However, we probably should drop this
from the commit message.  Perhaps either Bjorn or Lorenzo could do it
when applying changes.

Krzysztof
Zhuo, Qiuxu Feb. 22, 2021, 1:04 a.m. UTC | #2
> ...
> > [ Krzysztof: Update commit message. ]
> [...]
> 
> Thank you!  I appreciate that.  However, we probably should drop this from the
> commit message.  Perhaps either Bjorn or Lorenzo could do it when applying
> changes.

OK, will send out the v3 that drops "[ Krzysztof: Update commit message. ]" from the commit message.

-Qiuxu

Patch
diff mbox series

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;