linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Amey Narkhede <ameynarkhede03@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Raphael Norwitz <raphael.norwitz@nutanix.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	kw@linux.com, Shanker Donthineni <sdonthineni@nvidia.com>,
	Sinan Kaya <okaya@kernel.org>, Len Brown <lenb@kernel.org>,
	"Rafael J . Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH v8 1/8] PCI: Add pcie_reset_flr to follow calling convention of other reset methods
Date: Fri, 2 Jul 2021 14:11:23 -0500	[thread overview]
Message-ID: <20210702191123.GA228462@bjorn-Precision-5520> (raw)
In-Reply-To: <20210630144955.71c5abac.alex.williamson@redhat.com>

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@gmail.com> wrote:
> > On 21/06/30 11:56AM, Alex Williamson wrote:
> > > On Tue, 29 Jun 2021 21:30:57 +0530
> > > Amey Narkhede <ameynarkhede03@gmail.com> 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

  reply	other threads:[~2021-07-02 19:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 16:00 [PATCH v8 0/8] Expose and manage PCI device reset Amey Narkhede
2021-06-29 16:00 ` [PATCH v8 1/8] PCI: Add pcie_reset_flr to follow calling convention of other reset methods Amey Narkhede
2021-06-30 17:56   ` Alex Williamson
2021-06-30 20:04     ` Amey Narkhede
2021-06-30 20:49       ` Alex Williamson
2021-07-02 19:11         ` Bjorn Helgaas [this message]
2021-06-29 16:00 ` [PATCH v8 2/8] PCI: Add new array for keeping track of ordering of " Amey Narkhede
2021-06-30 18:33   ` Alex Williamson
2021-06-29 16:00 ` [PATCH v8 3/8] PCI: Remove reset_fn field from pci_dev Amey Narkhede
2021-06-29 16:01 ` [PATCH v8 4/8] PCI/sysfs: Allow userspace to query and set device reset mechanism Amey Narkhede
2021-06-30 18:49   ` Alex Williamson
2021-06-29 16:01 ` [PATCH v8 5/8] PCI: Define a function to set ACPI_COMPANION in pci_dev Amey Narkhede
2021-06-29 16:01 ` [PATCH v8 6/8] PCI: Setup ACPI fwnode early and at the same time with OF Amey Narkhede
2021-06-29 16:01 ` [PATCH v8 7/8] PCI: Add support for ACPI _RST reset method Amey Narkhede
2021-06-29 16:01 ` [PATCH v8 8/8] PCI: Change the type of probe argument in reset functions Amey Narkhede

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=20210702191123.GA228462@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=alex.williamson@redhat.com \
    --cc=ameynarkhede03@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=kw@linux.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=okaya@kernel.org \
    --cc=raphael.norwitz@nutanix.com \
    --cc=rjw@rjwysocki.net \
    --cc=sdonthineni@nvidia.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;
as well as URLs for NNTP newsgroup(s).