linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Sean V Kelley" <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: Re: [PATCH v3 1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association
Date: Wed, 10 Mar 2021 16:00:30 -0600	[thread overview]
Message-ID: <20210310220030.GA2068330@bjorn-Precision-5520> (raw)
In-Reply-To: <20210222011717.43266-1-qiuxu.zhuo@intel.com>

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
> 

  parent reply	other threads:[~2021-03-10 22:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10  2:05 [PATCH 1/1] PCI/RCEC: Fix failure to inject errors to some RCiEP devices Qiuxu Zhuo
2021-02-10  4:33 ` Kelley, Sean V
2021-02-10 17:12 ` Krzysztof Wilczyński
2021-02-18  3:00   ` Zhuo, Qiuxu
2021-02-18 22:07     ` 'Krzysztof Wilczyński'
2021-02-18 22:11       ` 'Krzysztof Wilczyński'
2021-02-19  1:52         ` Zhuo, Qiuxu
2021-02-19  2:23           ` [PATCH v2 1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association Qiuxu Zhuo
2021-02-22  0:56             ` Krzysztof Wilczyński
2021-02-22  1:04               ` Zhuo, Qiuxu
2021-02-22  1:17                 ` [PATCH v3 " Qiuxu Zhuo
2021-03-05  6:12                   ` Zhuo, Qiuxu
2021-03-10 22:00                   ` Bjorn Helgaas [this message]
2021-03-11  3:13                     ` Zhuo, Qiuxu
2021-02-19  1:51       ` [PATCH 1/1] PCI/RCEC: Fix failure to inject errors to some RCiEP devices Zhuo, Qiuxu

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=20210310220030.GA2068330@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=qiuxu.zhuo@intel.com \
    --cc=sean.v.kelley@intel.com \
    --cc=tony.luck@intel.com \
    --cc=wen.jin@intel.com \
    --subject='Re: [PATCH v3 1/1] PCI/RCEC: Fix RCiEP capable devices RCEC association' \
    /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

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).