public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: Aksh Garg <a-garg7@ti.com>,
	linux-pci@vger.kernel.org, jingoohan1@gmail.com,
	lpieralisi@kernel.org, kwilczynski@kernel.org, robh@kernel.org,
	bhelgaas@google.com, yoshihiro.shimoda.uh@renesas.com,
	fancer.lancer@gmail.com, Zhiqiang.Hou@nxp.com,
	gustavo.pimentel@synopsys.com, cassel@kernel.org,
	linux-kernel@vger.kernel.org, s-vadapalli@ti.com,
	danishanwar@ti.com
Subject: Re: [PATCH 2/2] PCI: dwc: ep: Mirror the max link width and speed fields to all functions
Date: Mon, 23 Feb 2026 12:12:52 -0600	[thread overview]
Message-ID: <20260223181252.GA3700622@bhelgaas> (raw)
In-Reply-To: <kr3yh3unbsynddcgzhl2zpxmna7hbc4dxgbqo3bmlwsn5twlyr@7gxzh4rqjubg>

On Wed, Feb 18, 2026 at 07:08:20PM +0530, Manivannan Sadhasivam wrote:
> On Mon, Feb 02, 2026 at 12:57:58PM +0530, Aksh Garg wrote:
> > PCIe r6.0, section 7.5.3.6 states that for multi-function devices, the
> > Max Link Width and Max Link Speed fields in the Link Capabilities
> > Register must report the same values for all functions.
> ...

> > @@ -1102,6 +1103,27 @@ static void dw_pcie_ep_init_non_sticky_registers(struct dw_pcie *pci)
> >  		dw_pcie_ep_init_rebar_registers(ep, func_no);
> >  
> >  	dw_pcie_setup(pci);
> > +
> > +	/*
> > +	 * PCIe r6.0, section 7.5.3.6 states that for multi-function endpoints,
> > +	 * max link width and speed fields must report same values for all functions.
> > +	 * However, dw_pcie_setup() programs these fields only for physical function 0.
> > +	 * Hence, mirror these fields to all other physical functions as well.
> > +	 */
> > +	if (funcs > 1) {
> > +		offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
> > +		ref_lnkcap = dw_pcie_readl_dbi(pci, offset + PCI_EXP_LNKCAP);
> > +		ref_lnkcap &= PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_SLS;
> 
> Use FIELD_* macros please.
> 
> > +
> > +		for (func_no = 1; func_no < funcs; func_no++) {
> > +			offset = dw_pcie_ep_find_capability(ep, func_no, PCI_CAP_ID_EXP);
> > +			lnkcap = dw_pcie_ep_readl_dbi(ep, func_no, offset + PCI_EXP_LNKCAP);
> > +			lnkcap &= ~(PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_SLS);
> > +			lnkcap |= ref_lnkcap;

I think this can also use FIELD_MODIFY().

> > +			dw_pcie_ep_writel_dbi(ep, func_no, offset + PCI_EXP_LNKCAP, lnkcap);
> > +		}
> > +	}
> > +
> >  	dw_pcie_dbi_ro_wr_dis(pci);
> >  }

      reply	other threads:[~2026-02-23 18:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02  7:27 [PATCH 0/2] PCI: dwc: ep: Multi-function endpoint configuration fixes Aksh Garg
2026-02-02  7:27 ` [PATCH 1/2] PCI: dwc: ep: Fix MSI-X configuration to write to correct physical function Aksh Garg
2026-02-02  7:55   ` Niklas Cassel
2026-02-02  7:57     ` Niklas Cassel
2026-02-02  8:15       ` Aksh Garg
2026-02-02  8:47         ` Niklas Cassel
2026-02-02  7:27 ` [PATCH 2/2] PCI: dwc: ep: Mirror the max link width and speed fields to all functions Aksh Garg
2026-02-18 13:38   ` Manivannan Sadhasivam
2026-02-23 18:12     ` Bjorn Helgaas [this message]

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=20260223181252.GA3700622@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=Zhiqiang.Hou@nxp.com \
    --cc=a-garg7@ti.com \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=danishanwar@ti.com \
    --cc=fancer.lancer@gmail.com \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=jingoohan1@gmail.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=s-vadapalli@ti.com \
    --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