Re: [PATCH v7 09/12] PCI: liveupdate: Inherit ARI Forwarding Enable on preserved bridges

David Matlack <[email protected]> Mon, 20 Jul 2026 16:19:00 -0700
Newsgroups org.infradead.lists.kexec,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kvack.linux-mm
Message-ID <CALzav=eZYfYYKAGEzk4TsGFLp1TPb2iFePNmqGsjX4jEZNJ9XA@mail.gmail.com>
On Fri, Jul 17, 2026 at 4:29 PM Pasha Tatashin
<[email protected]> wrote:
>
> On Fri, 10 Jul 2026 21:26:12 +0000, David Matlack <[email protected]> wrote:
> > diff --git a/drivers/pci/liveupdate.c b/drivers/pci/liveupdate.c
> > index a95bfe5eff77..74a11e520f0d 100644
> > --- a/drivers/pci/liveupdate.c
> > +++ b/drivers/pci/liveupdate.c
> > @@ -816,6 +820,20 @@ int pci_liveupdate_enable_acs(struct pci_dev *dev)
> >       return 0;
> >  }
> >
> > +int pci_liveupdate_configure_ari(struct pci_dev *dev)
> > +{
> > +     u16 val;
> > +
> > +     guard(rwsem_read)(&pci_liveupdate.rwsem);
> > +
> > +     if (!dev->liveupdate.incoming)
> > +             return -EINVAL;
> > +
> > +     pcie_capability_read_word(dev, PCI_EXP_DEVCTL2, &val);
> > +     dev->ari_enabled = !!(val & PCI_EXP_DEVCTL2_ARI);
>
> unsigned int    ari_enabled:1;
>
> Sashiko asks a valid question, what protects other bits in this word
> during modication?  At a very list a comment is needed.

This was my reply to Sashiko, not sure if you saw it:

.  pci_liveupdate_configure_ari() is called from pci_configure_ari()
.  which also sets dev->ari_enabled=1 and is pre-existing code.
.
.  If writing to dev->ari_enabled in this path is indeed unsafe then that
.  is a pre-existing bug.

I figured that a comment wouldn't be needed for continuing an
established precedent (it's ok to write to ari_enabled during this
path).

>
> --
> Pasha Tatashin <[email protected]>