linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0
@ 2020-11-04 20:58 Ryder Lee
  2020-11-05 18:22 ` Frank Wunderlich
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ryder Lee @ 2020-11-04 20:58 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci, linux-mediatek, Ryder Lee

PCI_FUNC(port->slot << 3)" is always 0, so previously
mtk_pcie_startup_port() only configured FC credits and FTs for
function 0.

Compute "func" correctly so we also configure functions other than
0. This affects MT2701 and MT7623.

Addresses-Coverity-ID: 1437218 ("Wrong operator used")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
v2 & v3 - update commit log
---
 drivers/pci/controller/pcie-mediatek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
index cf4c18f0c25a..1980b01cee35 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
@@ -760,7 +760,7 @@ static struct pci_ops mtk_pcie_ops = {
 static int mtk_pcie_startup_port(struct mtk_pcie_port *port)
 {
 	struct mtk_pcie *pcie = port->pcie;
-	u32 func = PCI_FUNC(port->slot << 3);
+	u32 func = PCI_FUNC(port->slot);
 	u32 slot = PCI_SLOT(port->slot << 3);
 	u32 val;
 	int err;
-- 
2.18.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0
  2020-11-04 20:58 [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0 Ryder Lee
@ 2020-11-05 18:22 ` Frank Wunderlich
  2021-02-21 19:29 ` Krzysztof Wilczyński
  2021-03-29 15:03 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 6+ messages in thread
From: Frank Wunderlich @ 2020-11-05 18:22 UTC (permalink / raw)
  To: linux-mediatek, Ryder Lee, Bjorn Helgaas; +Cc: linux-pci

How can i verify (triggering bug without patch)?
regards Frank

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0
  2020-11-04 20:58 [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0 Ryder Lee
  2020-11-05 18:22 ` Frank Wunderlich
@ 2021-02-21 19:29 ` Krzysztof Wilczyński
  2021-03-26 15:51   ` Lorenzo Pieralisi
  2021-03-29 15:03 ` Lorenzo Pieralisi
  2 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Wilczyński @ 2021-02-21 19:29 UTC (permalink / raw)
  To: Ryder Lee; +Cc: Bjorn Helgaas, Lorenzo Pieralisi, linux-pci, linux-mediatek

[+cc Lorenzo for visiblity]

Hi,

Thank you for taking care of this!

[...]
> PCI_FUNC(port->slot << 3)" is always 0, so previously
> mtk_pcie_startup_port() only configured FC credits and FTs for
> function 0.
[...]

A small nit.  The commit message is missing the opening quote, see
Bjorn's suggestion:

  https://lore.kernel.org/linux-pci/20201104131054.GA307984@bjorn-Precision-5520/

But, it's probably not worth sending another patch, and perhaps either
Bjorn or Lorenzo could fix this when applying changes.

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0
  2021-02-21 19:29 ` Krzysztof Wilczyński
@ 2021-03-26 15:51   ` Lorenzo Pieralisi
  2021-03-26 23:53     ` Krzysztof Wilczyński
  0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Pieralisi @ 2021-03-26 15:51 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: Ryder Lee, Bjorn Helgaas, linux-pci, linux-mediatek

On Sun, Feb 21, 2021 at 08:29:02PM +0100, Krzysztof Wilczyński wrote:
> [+cc Lorenzo for visiblity]
> 
> Hi,
> 
> Thank you for taking care of this!
> 
> [...]
> > PCI_FUNC(port->slot << 3)" is always 0, so previously
> > mtk_pcie_startup_port() only configured FC credits and FTs for
> > function 0.
> [...]
> 
> A small nit.  The commit message is missing the opening quote, see
> Bjorn's suggestion:
> 
>   https://lore.kernel.org/linux-pci/20201104131054.GA307984@bjorn-Precision-5520/
> 
> But, it's probably not worth sending another patch, and perhaps either
> Bjorn or Lorenzo could fix this when applying changes.
> 
> Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Thanks, I will do. Can I apply it or there are still pending review
comments to address ?

Lorenzo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0
  2021-03-26 15:51   ` Lorenzo Pieralisi
@ 2021-03-26 23:53     ` Krzysztof Wilczyński
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Wilczyński @ 2021-03-26 23:53 UTC (permalink / raw)
  To: Lorenzo Pieralisi; +Cc: Ryder Lee, Bjorn Helgaas, linux-pci, linux-mediatek

Hi Lorenzo,

[...]
> > A small nit.  The commit message is missing the opening quote, see
> > Bjorn's suggestion:
> > 
> >   https://lore.kernel.org/linux-pci/20201104131054.GA307984@bjorn-Precision-5520/
> > 
> > But, it's probably not worth sending another patch, and perhaps either
> > Bjorn or Lorenzo could fix this when applying changes.
> > 
> > Reviewed-by: Krzysztof Wilczyński <kw@linux.com>
> 
> Thanks, I will do. Can I apply it or there are still pending review
> comments to address ?

Nothing from me, so it's good to go, I'd say.  Thank you!

Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0
  2020-11-04 20:58 [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0 Ryder Lee
  2020-11-05 18:22 ` Frank Wunderlich
  2021-02-21 19:29 ` Krzysztof Wilczyński
@ 2021-03-29 15:03 ` Lorenzo Pieralisi
  2 siblings, 0 replies; 6+ messages in thread
From: Lorenzo Pieralisi @ 2021-03-29 15:03 UTC (permalink / raw)
  To: Bjorn Helgaas, Ryder Lee; +Cc: Lorenzo Pieralisi, linux-pci, linux-mediatek

On Thu, 5 Nov 2020 04:58:33 +0800, Ryder Lee wrote:
> PCI_FUNC(port->slot << 3)" is always 0, so previously
> mtk_pcie_startup_port() only configured FC credits and FTs for
> function 0.
> 
> Compute "func" correctly so we also configure functions other than
> 0. This affects MT2701 and MT7623.

Applied to pci/mediatek, thanks!

[1/1] PCI: mediatek: Configure FC and FTS for functions other than 0
      https://git.kernel.org/lpieralisi/pci/c/31ec9c2746

Thanks,
Lorenzo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-29 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04 20:58 [PATCH v3] PCI: mediatek: Configure FC and FTS for functions other than 0 Ryder Lee
2020-11-05 18:22 ` Frank Wunderlich
2021-02-21 19:29 ` Krzysztof Wilczyński
2021-03-26 15:51   ` Lorenzo Pieralisi
2021-03-26 23:53     ` Krzysztof Wilczyński
2021-03-29 15:03 ` Lorenzo Pieralisi

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