[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260127215844.GA377410@bhelgaas>
Date: Tue, 27 Jan 2026 15:58:44 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: Håkon Bugge <haakon.bugge@...cle.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Niklas Schnelle <schnelle@...ux.ibm.com>,
Alex Williamson <alex@...zbot.org>,
Johannes Thumshirn <morbidrsa@...il.com>, linux-pci@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>, linux-acpi@...r.kernel.org
Subject: Re: [PATCH v3 1/2] PCI: Initialize RCB from pci_configure_device
On Thu, Jan 22, 2026 at 03:45:58PM +0200, Ilpo Järvinen wrote:
> On Thu, 22 Jan 2026, Håkon Bugge wrote:
>
> > Commit e42010d8207f ("PCI: Set Read Completion Boundary to 128 iff
> > Root Port supports it (_HPX)") fixed a bogus _HPX type 2 record, which
> > instructed program_hpx_type2() to set the RCB in an endpoint,
> > although it's RC did not have the RCB bit set.
> > + pcie_capability_read_word(dev, PCI_EXP_LNKCTL, &lnkctl);
> > + if (rcb) {
> > + if (lnkctl & PCI_EXP_LNKCTL_RCB)
> > + return;
> > +
> > + lnkctl |= PCI_EXP_LNKCTL_RCB;
> > + } else {
> > + if (!(lnkctl & PCI_EXP_LNKCTL_RCB))
> > + return;
> > +
> > + pci_info(dev, FW_INFO "clearing RCB (RCB not set in Root Port)\n");
> > + lnkctl &= ~PCI_EXP_LNKCTL_RCB;
> > + }
> > +
> > + pcie_capability_write_word(dev, PCI_EXP_LNKCTL, lnkctl);
>
> So this sequence is effectively implementing this simple statement:
>
> pcie_capability_clear_and_set_word(dev, PCI_EXP_LNKCTL,
> PCI_EXP_LNKCTL_RCB,
> rcb ? PCI_EXP_LNKCTL_RCB : 0);
>
> + the print.
>
> Is there a good reason why you want to avoid the write by using early
> returns?
Good question, pcie_capability_clear_and_set_word() is much more
readable.
> I also wonder if those clear & set & clean_and_set interfaces should
> implement the write avoidance if it's an useful thing (callers should be
> checked they're not used for RW1C bits if that's implemented though).
Powered by blists - more mailing lists