Re: [PATCH v8 1/8] PCI: Add pcie_reset_flr to follow calling convention of other reset methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please add "()" after function names in subject lines.

On Wed, Jun 30, 2021 at 02:49:55PM -0600, Alex Williamson wrote:
> On Thu, 1 Jul 2021 01:34:15 +0530
> Amey Narkhede <ameynarkhede03@xxxxxxxxx> wrote:
> > On 21/06/30 11:56AM, Alex Williamson wrote:
> > > On Tue, 29 Jun 2021 21:30:57 +0530
> > > Amey Narkhede <ameynarkhede03@xxxxxxxxx> wrote:
> > >  
> > > > Add has_flr bitfield in struct pci_dev to indicate support for pcie flr
> > > > to avoid reading PCI_EXP_DEVCAP multiple times and get rid of
> > > > PCI_DEV_FLAGS_NO_FLR_RESET in quirk_no_flr().
> > > >
> > > > Currently there is separate function pcie_has_flr() to probe if pcie flr is
> > > > supported by the device which does not match the calling convention
> > > > followed by reset methods which use second function argument to decide
> > > > whether to probe or not.  Add new function pcie_reset_flr() that follows
> > > > the calling convention of reset methods.

s/pcie/PCIe/ (except for variables, function names, etc)

> > > >  static int pci_af_flr(struct pci_dev *dev, int probe)
> > > >  {
> > > >  	int pos;
> > > >  	u8 cap;
> > > >
> > > > -	pos = pci_find_capability(dev, PCI_CAP_ID_AF);
> > > > -	if (!pos)
> > > > +	if (!dev->has_flr)
> > > >  		return -ENOTTY;
> > > >
> > > > -	if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET)
> > > > +	pos = pci_find_capability(dev, PCI_CAP_ID_AF);
> > > > +	if (!pos)
> > > >  		return -ENOTTY;
> > > >
> > > >  	pci_read_config_byte(dev, pos + PCI_AF_CAP, &cap);  
> > >
> > >
> > > How can has_flr encompass both methods of invoking FLR?  PCIe FLR is
> > > not a prerequisite to AF FLR.
> > >  
> > I see. Does this mean that there should be a separate flag for disabling
> > AF FLR?
> 
> There hasn't been a need so far.  Per the ECN, the AF capability is
> meant to make select PCIe features available on conventional PCI
> devices.  It seems like it would be against the spirit of the AF
> capability to implement both an AF capability and a PCIe capability,
> but I don't see that it's definitively addressed by the spec.
> 
> AF FLR is sufficiently rare that it's probably reasonable to make a
> has_pcie_flr bit on the device and leave AF FLR alone.

This sounds good to me.  I agree that I'd prefer not to have a single
bit that applies to both AF FLR and PCIe FLR since they are distinct
mechanisms, discovered and initiated differently.

> I can't really say that I'm in favor of assigning a has_flr bit the
> double duty of also quirking broken FLR, if nothing else it's
> inconsistent with our other means of quirking resets.

By "other means of quirking resets," do you mean
PCI_DEV_FLAGS_NO_BUS_RESET, PCI_DEV_FLAGS_NO_PM_RESET, and
PCI_DEV_FLAGS_NO_FLR_RESET?

I agree that a pdev->has_pcie_flr bit would be different from those,
and maybe it's better to stick with PCI_DEV_FLAGS_NO_FLR_RESET for
now.

In general, I don't like the dual approach of some things being in the
pci_dev_flags enum and others being "unsigned int foo:1" in the struct
pci_dev because I can't tell if there's a reason to choose one over
the other.  If there's not a reason to have both, I'd like to migrate
them all to the ":1" approach because it seems a little more readable
to me.

Bjorn



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux