linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <mani@kernel.org>
To: Serge Semin <fancer.lancer@gmail.com>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	"jingoohan1@gmail.com" <jingoohan1@gmail.com>,
	"gustavo.pimentel@synopsys.com" <gustavo.pimentel@synopsys.com>,
	"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"kw@linux.com" <kw@linux.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"kishon@kernel.org" <kishon@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org" 
	<krzysztof.kozlowski+dt@linaro.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"marek.vasut+renesas@gmail.com" <marek.vasut+renesas@gmail.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org" 
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v18 09/20] PCI: dwc: Add PCI_EXP_LNKCAP_MLW handling
Date: Wed, 2 Aug 2023 16:16:30 +0530	[thread overview]
Message-ID: <20230802104630.GC57374@thinkpad> (raw)
In-Reply-To: <2zv7mcxa7skywhxe2ene3c5ycine6tsmsfwmpf4nknhoeye7rx@m525r5ph3xow>

On Fri, Jul 28, 2023 at 07:07:03PM +0300, Serge Semin wrote:
> On Fri, Jul 28, 2023 at 04:19:38AM +0000, Yoshihiro Shimoda wrote:
> > Hi Manivannan,
> > 
> > > From: Manivannan Sadhasivam, Sent: Friday, July 28, 2023 11:51 AM
> > > 
> > > On Wed, Jul 26, 2023 at 02:12:15AM +0000, Yoshihiro Shimoda wrote:
> > > > Hi Manivannan,
> > > >
> > > > > From: Manivannan Sadhasivam, Sent: Monday, July 24, 2023 8:04 PM
> > > > >
> > > > > Subject should contain the word "missing". Like, "Add missing PCI_EXP_LNKCAP_MLW
> > > > > handling".
> > > >
> > > > I got it.
> > > >
> > > > > On Fri, Jul 21, 2023 at 04:44:41PM +0900, Yoshihiro Shimoda wrote:
> > > > > > Update dw_pcie_link_set_max_link_width() to set PCI_EXP_LNKCAP_MLW.
> > > > > > In accordance with the DW PCIe RC/EP HW manuals [1,2,3,...] aside with
> > > > > > the PORT_LINK_CTRL_OFF.LINK_CAPABLE and GEN2_CTRL_OFF.NUM_OF_LANES[8:0]
> > > > > > field there is another one which needs to be updated. It's
> > > > > > LINK_CAPABILITIES_REG.PCIE_CAP_MAX_LINK_WIDTH. If it isn't done at
> > > > > > the very least the maximum link-width capability CSR won't expose
> > > > > > the actual maximum capability.
> > > > > >
> > > > > > [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
> > > > > >     Version 4.60a, March 2015, p.1032
> > > > > > [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
> > > > > >     Version 4.70a, March 2016, p.1065
> > > > > > [3] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
> > > > > >     Version 4.90a, March 2016, p.1057
> > > > > > ...
> > > > > > [X] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint,
> > > > > >       Version 5.40a, March 2019, p.1396
> > > > > > [X+1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port,
> > > > > >       Version 5.40a, March 2019, p.1266
> > > > > >
> > > > > > Suggested-by: Serge Semin <fancer.lancer@gmail.com>
> > > > >
> > > > > Add Reported-by also?
> > > >
> > > > I don't think so because Serge suggested the commit description from my submitted patch [1].
> > > >
> > > > [1]
> > > >
> > <snip URL>
> > > >
> > > 
> > > Fine then.
> > > 
> > > > > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > > > >
> > > > > This looks like a potential bug fix to me. So please move this change before the
> > > > > previous patch that introduces dw_pcie_link_set_max_link_width(), tag fixes and
> > > > > CC stable list for backporting.
> > > >
> > > > I think that this patch should be a next branch because this is possible to
> > > > cause side effective. Almost all drivers/pcie/controller/dwc/ host drivers except
> > > > pcie-tegra194.c doesn't have this setting, but I assume that the drivers work correctly
> > > > without this setting.
> > > >
> > > > Also, to be honest, I could not find a suitable commit ID for this patch's "Fixes" tag.
> > > > Additionally, I could not determine which old kernel versions should have this patch
> > > > applied as backporting.
> > > >
> > > 
> 
> > > Ok. But you can still move this patch as I suggested. If we happen to hit any
> > > issue with this setting, then we can easily revert it.
> > 
> > I got it. I'll move this patch as you suggested.
> 
> No. By moving this patch to be implemented before the patch:
> [PATCH v18 08/20] PCI: dwc: Add dw_pcie_link_set_max_link_width()
> you won't be able to easily revert it afterwards because the patch #8
> will move the code added by the patch #9 to the
> dw_pcie_link_set_max_link_width() function. Basically you suggest to
> switch the preparation and functional patches order which doesn't look
> right.
> 
> Basically the Link-width-related part of this series currently implies
> the next logic:
> 
> 1. Prepare the DW PCIe core driver to implementing a comprehensive
> Max-link-width setup methods (aka as it's done in
> dw_pcie_link_set_max_speed()) by moving the Link-width related code to
> a dedicated method:
> [PATCH v18 08/20] PCI: dwc: Add dw_pcie_link_set_max_link_width()
> 
> 2. Add the PCI_EXP_LNKCAP_MLW field update, which
> dw_pcie_link_set_max_link_width() lacks to be comprehensive:
> [PATCH v18 09/20] PCI: dwc: Add PCI_EXP_LNKCAP_MLW handling
> 
> 3. Drop the duplicating code from the Tegra194 PCIe driver:
> [PATCH v18 10/20] PCI: tegra194: Drop PCI_EXP_LNKSTA_NLW setting
> 
> In case if the patch #9 appears to be a bug fix, then it will need to
> be backported together with patch #8 which isn't a problem at all
> (though it's doubtfully to happen since nobody reported any problem
> with that so far). But if patch #9 turns out to break something in
> current circumstances we'll be able to either easily revert it (since
> it's applied after the preparation patch) or fix somehow. If you
> switch patch #8 and #9 order, the reversion will require to be
> performed for both these patches to avoid the conflicts. Thus I'd
> suggest to leave the patches order as is which looks more natural and
> won't cause any problems to revert the functional change or to
> backport it.
> 

Hmm, I overlooked the dependency. Let's keep the order as it is.

- Mani

> -Serge(y)
> 
> > 
> > Best regards,
> > Yoshihiro Shimoda
> > 
> > > - Mani
> > > 
> > > > Best regards,
> > > > Yoshihiro Shimoda
> > > >
> > > > > - Mani
> > > > >
> > > > > > Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
> > > > > > ---
> > > > > >  drivers/pci/controller/dwc/pcie-designware.c | 9 ++++++++-
> > > > > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> > > > > > index 5cca34140d2a..c4998194fe74 100644
> > > > > > --- a/drivers/pci/controller/dwc/pcie-designware.c
> > > > > > +++ b/drivers/pci/controller/dwc/pcie-designware.c
> > > > > > @@ -730,7 +730,8 @@ static void dw_pcie_link_set_max_speed(struct dw_pcie *pci, u32 link_gen)
> > > > > >
> > > > > >  static void dw_pcie_link_set_max_link_width(struct dw_pcie *pci, u32 num_lanes)
> > > > > >  {
> > > > > > -	u32 lwsc, plc;
> > > > > > +	u32 lnkcap, lwsc, plc;
> > > > > > +	u8 cap;
> > > > > >
> > > > > >  	if (!num_lanes)
> > > > > >  		return;
> > > > > > @@ -766,6 +767,12 @@ static void dw_pcie_link_set_max_link_width(struct dw_pcie *pci, u32 num_lanes)
> > > > > >  	}
> > > > > >  	dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, plc);
> > > > > >  	dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, lwsc);
> > > > > > +
> > > > > > +	cap = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
> > > > > > +	lnkcap = dw_pcie_readl_dbi(pci, cap + PCI_EXP_LNKCAP);
> > > > > > +	lnkcap &= ~PCI_EXP_LNKCAP_MLW;
> > > > > > +	lnkcap |= FIELD_PREP(PCI_EXP_LNKCAP_MLW, num_lanes);
> > > > > > +	dw_pcie_writel_dbi(pci, cap + PCI_EXP_LNKCAP, lnkcap);
> > > > > >  }
> > > > > >
> > > > > >  void dw_pcie_iatu_detect(struct dw_pcie *pci)
> > > > > > --
> > > > > > 2.25.1
> > > > > >
> > > > >
> > > > > --
> > > > > மணிவண்ணன் சதாசிவம்
> > > 
> > > --
> > > மணிவண்ணன் சதாசிவம்

-- 
மணிவண்ணன் சதாசிவம்

  parent reply	other threads:[~2023-08-02 10:46 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21  7:44 [PATCH v18 00/20] PCI: rcar-gen4: Add R-Car Gen4 PCIe support Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 01/20] PCI: Add INTx Mechanism Messages macros Yoshihiro Shimoda
2023-07-24  7:25   ` Manivannan Sadhasivam
2023-07-21  7:44 ` [PATCH v18 02/20] PCI: Rename PCI_EPC_IRQ_LEGACY to PCI_EPC_IRQ_INTX Yoshihiro Shimoda
2023-07-21  8:10   ` Damien Le Moal
2023-07-24  7:32     ` Manivannan Sadhasivam
2023-07-29  1:35       ` Serge Semin
2023-07-29  1:55         ` Damien Le Moal
2023-07-29  1:58           ` Damien Le Moal
2023-07-29  2:02             ` Serge Semin
2023-07-29 15:32             ` Bjorn Helgaas
2023-07-30  4:58               ` Manivannan Sadhasivam
2023-07-21  7:44 ` [PATCH v18 03/20] PCI: dwc: Rename "legacy_irq" to "INTx_irq" Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 04/20] PCI: dwc: Change arguments of dw_pcie_prog_outbound_atu() Yoshihiro Shimoda
2023-07-24  7:45   ` Manivannan Sadhasivam
2023-07-26  5:02     ` Serge Semin
2023-07-26 13:00       ` Manivannan Sadhasivam
2023-07-26 23:38         ` Serge Semin
2023-07-27  1:06           ` Yoshihiro Shimoda
2023-07-27 11:03           ` Manivannan Sadhasivam
2023-07-27 12:21             ` Serge Semin
2023-07-29  2:06   ` Serge Semin
2023-07-31  1:24     ` Yoshihiro Shimoda
2023-07-31 21:33       ` Serge Semin
2023-08-01  1:29         ` Yoshihiro Shimoda
2023-08-01  1:44           ` Serge Semin
2023-08-01  7:02             ` Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 05/20] PCI: dwc: Add outbound MSG TLPs support Yoshihiro Shimoda
2023-07-24  8:12   ` Manivannan Sadhasivam
2023-07-29  1:40     ` Serge Semin
2023-07-31  1:18       ` Yoshihiro Shimoda
2023-07-31 22:11         ` Serge Semin
2023-08-01  1:31           ` Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 06/20] PCI: designware-ep: Add INTx IRQs support Yoshihiro Shimoda
2023-07-24  8:34   ` Manivannan Sadhasivam
2023-07-26  3:03     ` Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 07/20] PCI: dwc: endpoint: Add multiple PFs support for dbi2 Yoshihiro Shimoda
2023-07-24  9:24   ` Manivannan Sadhasivam
2023-07-25 11:57     ` Yoshihiro Shimoda
2023-07-28  2:34       ` Manivannan Sadhasivam
2023-07-28  4:18         ` Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 08/20] PCI: dwc: Add dw_pcie_link_set_max_link_width() Yoshihiro Shimoda
2023-07-31 23:53   ` Serge Semin
2023-08-01  1:50     ` Yoshihiro Shimoda
2023-08-07 22:53       ` Serge Semin
2023-08-07 23:40         ` Bjorn Helgaas
2023-08-08  0:15           ` Serge Semin
2023-08-08 15:08             ` Bjorn Helgaas
2023-08-08 21:16               ` Serge Semin
2023-07-21  7:44 ` [PATCH v18 09/20] PCI: dwc: Add PCI_EXP_LNKCAP_MLW handling Yoshihiro Shimoda
2023-07-24 11:03   ` Manivannan Sadhasivam
2023-07-26  2:12     ` Yoshihiro Shimoda
2023-07-28  2:51       ` Manivannan Sadhasivam
2023-07-28  4:19         ` Yoshihiro Shimoda
2023-07-28 16:07           ` Serge Semin
2023-07-31  1:15             ` Yoshihiro Shimoda
2023-08-01  0:00               ` Serge Semin
2023-08-01  6:26                 ` Yoshihiro Shimoda
2023-08-02 10:46             ` Manivannan Sadhasivam [this message]
2023-07-21  7:44 ` [PATCH v18 10/20] PCI: tegra194: Drop PCI_EXP_LNKSTA_NLW setting Yoshihiro Shimoda
2023-07-24 11:29   ` Manivannan Sadhasivam
2023-07-26  2:26     ` Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 11/20] PCI: dwc: Add EDMA_UNROLL capability flag Yoshihiro Shimoda
2023-07-24 11:35   ` Manivannan Sadhasivam
2023-07-26  2:58     ` Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 12/20] PCI: dwc: Expose dw_pcie_ep_exit() to module Yoshihiro Shimoda
2023-07-24 11:36   ` Manivannan Sadhasivam
2023-07-21  7:44 ` [PATCH v18 13/20] PCI: dwc: Introduce .ep_pre_init() and .ep_deinit() Yoshihiro Shimoda
2023-07-21  9:23   ` Sergei Shtylyov
2023-07-24 11:40   ` Manivannan Sadhasivam
2023-07-26  3:02     ` Yoshihiro Shimoda
2023-08-01  0:15       ` Serge Semin
2023-08-02 10:40         ` Manivannan Sadhasivam
2023-08-01  0:22   ` Serge Semin
2023-08-01  6:27     ` Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 14/20] dt-bindings: PCI: dwc: Update maxItems of reg and reg-names Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 15/20] dt-bindings: PCI: renesas: Add R-Car Gen4 PCIe Host Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 16/20] dt-bindings: PCI: renesas: Add R-Car Gen4 PCIe Endpoint Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 17/20] PCI: rcar-gen4: Add R-Car Gen4 PCIe Host support Yoshihiro Shimoda
2023-07-24 12:28   ` Manivannan Sadhasivam
2023-08-01  1:06     ` Serge Semin
2023-08-01  6:46       ` Yoshihiro Shimoda
2023-08-01 18:28         ` Serge Semin
2023-08-02 10:36       ` Manivannan Sadhasivam
2023-07-21  7:44 ` [PATCH v18 18/20] PCI: rcar-gen4-ep: Add R-Car Gen4 PCIe Endpoint support Yoshihiro Shimoda
2023-08-01  1:36   ` Serge Semin
2023-08-01  6:59     ` Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 19/20] MAINTAINERS: Update PCI DRIVER FOR RENESAS R-CAR for R-Car Gen4 Yoshihiro Shimoda
2023-07-21  7:44 ` [PATCH v18 20/20] misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller Yoshihiro Shimoda
2023-07-24 10:53 ` [PATCH v18 00/20] PCI: rcar-gen4: Add R-Car Gen4 PCIe support Serge Semin

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=20230802104630.GC57374@thinkpad \
    --to=mani@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=jingoohan1@gmail.com \
    --cc=kishon@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /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).