public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <mani@kernel.org>
To: Bjorn Andersson <quic_bjorande@quicinc.com>
Cc: "Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Gustavo Pimentel" <gustavo.pimentel@synopsys.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 2/2] PCI: qcom-ep: Implement dbi_cs2_access() function callback for DBI CS2 access
Date: Tue, 17 Oct 2023 23:11:00 +0530	[thread overview]
Message-ID: <20231017174100.GA137137@thinkpad> (raw)
In-Reply-To: <20231017165609.GT3553829@hu-bjorande-lv.qualcomm.com>

On Tue, Oct 17, 2023 at 09:56:09AM -0700, Bjorn Andersson wrote:
> On Tue, Oct 17, 2023 at 09:51:29PM +0530, Manivannan Sadhasivam wrote:
> > On Tue, Oct 17, 2023 at 07:24:31AM -0700, Bjorn Andersson wrote:
> > > On Tue, Oct 17, 2023 at 11:47:55AM +0530, Manivannan Sadhasivam wrote:
> > > > From: Manivannan Sadhasivam <mani@kernel.org>
> > > 
> > > Your S-o-b should match this.
> > > 
> > 
> > I gave b4 a shot for sending the patches and missed this. Will fix it in next
> > version.
> > 
> > > > 
> > > > Qcom EP platforms require enabling/disabling the DBI CS2 access while
> > > > programming some read only and shadow registers through DBI. So let's
> > > > implement the dbi_cs2_access() callback that will be called by the DWC core
> > > > while programming such registers like BAR mask register.
> > > > 
> > > > Without DBI CS2 access, writes to those registers will not be reflected.
> > > > 
> > > > Fixes: f55fee56a631 ("PCI: qcom-ep: Add Qualcomm PCIe Endpoint controller driver")
> > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > > > ---
> > > >  drivers/pci/controller/dwc/pcie-qcom-ep.c | 14 ++++++++++++++
> > > >  1 file changed, 14 insertions(+)
> > > > 
> > > > diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> > > > index 32c8d9e37876..4653cbf7f9ed 100644
> > > > --- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
> > > > +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
> > > > @@ -124,6 +124,7 @@
> > > >  
> > > >  /* ELBI registers */
> > > >  #define ELBI_SYS_STTS				0x08
> > > > +#define ELBI_CS2_ENABLE				0xa4
> > > >  
> > > >  /* DBI registers */
> > > >  #define DBI_CON_STATUS				0x44
> > > > @@ -262,6 +263,18 @@ static void qcom_pcie_dw_stop_link(struct dw_pcie *pci)
> > > >  	disable_irq(pcie_ep->perst_irq);
> > > >  }
> > > >  
> > > > +static void qcom_pcie_dbi_cs2_access(struct dw_pcie *pci, bool enable)
> > > > +{
> > > > +	struct qcom_pcie_ep *pcie_ep = to_pcie_ep(pci);
> > > > +
> > > > +	writel_relaxed(enable, pcie_ep->elbi + ELBI_CS2_ENABLE);
> > > 
> > > Don't you want to maintain the ordering of whatever write came before
> > > this?
> > > 
> > 
> > Since this in a dedicated function, I did not care about the ordering w.r.t
> > previous writes. Even if it gets inlined, the order should not matter since it
> > only enables/disables the CS2 access for the forthcoming writes.
> > 
> 
> The wmb() - in a non-relaxed writel -  would ensure that no earlier
> writes are reordered and end up in your expected set of "forthcoming
> writes".
> 

I was under the impression that the readl_relaxed() here serves as an implicit
barrier. But reading the holy memory-barriers documentation doesn't explicitly
say so. So I'm going to add wmb() to be on the safe side as you suggested.

Thanks for pointing it out.

- Mani

> Not sure that the code is wrong, I just want you to be certain that this
> isn't a problem.
> 
> Thanks,
> Bjorn

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

  reply	other threads:[~2023-10-17 17:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17  6:17 [PATCH 0/2] PCI: dwc: Fix the BAR size programming Manivannan Sadhasivam
2023-10-17  6:17 ` [PATCH 1/2] PCI: dwc: Add new accessors to enable/disable DBI CS2 while setting the BAR size Manivannan Sadhasivam
2023-10-18 14:13   ` Serge Semin
2023-10-19  5:28     ` Manivannan Sadhasivam
2023-10-19 14:37       ` Serge Semin
2023-10-19 16:50         ` Manivannan Sadhasivam
2023-10-17  6:17 ` [PATCH 2/2] PCI: qcom-ep: Implement dbi_cs2_access() function callback for DBI CS2 access Manivannan Sadhasivam
2023-10-17 14:24   ` Bjorn Andersson
2023-10-17 16:21     ` Manivannan Sadhasivam
2023-10-17 16:56       ` Bjorn Andersson
2023-10-17 17:41         ` Manivannan Sadhasivam [this message]
2023-10-17 22:18           ` Bjorn Andersson
2023-10-18 13:27             ` Manivannan Sadhasivam
2023-10-19  3:18               ` Bjorn Andersson
2023-10-19  5:19                 ` Manivannan Sadhasivam

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=20231017174100.GA137137@thinkpad \
    --to=mani@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=jingoohan1@gmail.com \
    --cc=kw@linux.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=quic_bjorande@quicinc.com \
    --cc=robh@kernel.org \
    /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