Re: [PATCH v2 2/2] PCI: Reduce warnings on possible RW1C corruption

From: Mark Tomlinson
Date: Sun Aug 02 2020 - 23:42:59 EST


On Fri, 2020-07-31 at 09:32 -0600, Rob Herring wrote:
>
> If we don't want to just warn when a 8 or 16 bit access occurs (I'm
> not sure if 32-bit only accesses is possible or common. Seems like
> PCI_COMMAND would always get written?), then a simple way to do this
> is just move this out of line and do something like this where the bus
> or device is created/registered:
>
> if (bus->ops->write == pci_generic_config_write32)
> warn()
>
This doesn't work for many of the PCI drivers, since they wrap the call
to pci_generic_config_write32() in their own function.

> >
> > diff --git a/include/linux/pci.h b/include/linux/pci.h
> > index 34c1c4f45288..5b6ab593ae09 100644
> > --- a/include/linux/pci.h
> > +++ b/include/linux/pci.h
> > @@ -613,6 +613,7 @@ struct pci_bus {
> > unsigned char primary; /* Number of primary bridge */
> > unsigned char max_bus_speed; /* enum pci_bus_speed */
> > unsigned char cur_bus_speed; /* enum pci_bus_speed */
> > + bool unsafe_warn; /* warned about RW1C config write */
>
> Make this a bitfield next to 'is_added'.

Will do, thanks.