linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] pci: Add probe functions for bus and slot reset
Date: Wed, 14 Aug 2013 14:24:53 -0600	[thread overview]
Message-ID: <CAErSpo625CTnxZvy-gmy8VzxT4favF4s=_giU6nGey_N=VwK5A@mail.gmail.com> (raw)
In-Reply-To: <20130814200549.21626.79779.stgit@bling.home>

On Wed, Aug 14, 2013 at 2:06 PM, Alex Williamson
<alex.williamson@redhat.com> wrote:
> Users of pci_reset_bus() and pci_reset_slot() need a way to probe
> whether the bus or slot supports reset.  Add trivial helper functions
> and export them as vfio-pci will make use of these.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>
> This is logically patch 10/9 for v5 pci: bus and slot reset interfaces.
> If there's a need to re-spin anything I'll roll this in.
>
>  drivers/pci/pci.c   |   24 ++++++++++++++++++++++++
>  include/linux/pci.h |    2 ++
>  2 files changed, 26 insertions(+)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index ba68451..888d847 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -3610,6 +3610,18 @@ static int pci_slot_reset(struct pci_slot *slot, int probe)
>  }
>
>  /**
> + * pci_probe_reset_slot - probe whether a PCI slot can be reset
> + * @slot: PCI slot to probe
> + *
> + * Return 0 if slot can be reset, negative if a slot reset is not supported.

Remind me again why we need all the "probe" stuff.  That really
uglifies the code and the locking.  I think I worked through it once,
but regrettably, I didn't add any explanation and I've forgotten.

I assume all the return values are immutable, i.e., they won't change
because of hotplug events on the slot or the bus, right?

Why do you need probe functions for slot and bus reset, but not for
function reset?

> + */
> +int pci_probe_reset_slot(struct pci_slot *slot)
> +{
> +       return pci_slot_reset(slot, 1);
> +}
> +EXPORT_SYMBOL_GPL(pci_probe_reset_slot);
> +
> +/**
>   * pci_reset_slot - reset a PCI slot
>   * @slot: PCI slot to reset
>   *
> @@ -3662,6 +3674,18 @@ static int pci_bus_reset(struct pci_bus *bus, int probe)
>  }
>
>  /**
> + * pci_probe_reset_bus - probe whether a PCI bus can be reset
> + * @bus: PCI bus to probe
> + *
> + * Return 0 if bus can be reset, negative if a bus reset is not supported.
> + */
> +int pci_probe_reset_bus(struct pci_bus *bus)
> +{
> +       return pci_bus_reset(bus, 1);
> +}
> +EXPORT_SYMBOL_GPL(pci_probe_reset_bus);
> +
> +/**
>   * pci_reset_bus - reset a PCI bus
>   * @bus: top level PCI bus to reset
>   *
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 1a8fd34..daf40cd 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -924,7 +924,9 @@ int pcie_set_mps(struct pci_dev *dev, int mps);
>  int __pci_reset_function(struct pci_dev *dev);
>  int __pci_reset_function_locked(struct pci_dev *dev);
>  int pci_reset_function(struct pci_dev *dev);
> +int pci_probe_reset_slot(struct pci_slot *slot);
>  int pci_reset_slot(struct pci_slot *slot);
> +int pci_probe_reset_bus(struct pci_bus *bus);
>  int pci_reset_bus(struct pci_bus *bus);
>  void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
>  void pci_update_resource(struct pci_dev *dev, int resno);
>

  reply	other threads:[~2013-08-14 20:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14 20:06 [PATCH] pci: Add probe functions for bus and slot reset Alex Williamson
2013-08-14 20:24 ` Bjorn Helgaas [this message]
2013-08-14 23:01   ` Alex Williamson
2013-08-15 20:50 ` Bjorn Helgaas

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='CAErSpo625CTnxZvy-gmy8VzxT4favF4s=_giU6nGey_N=VwK5A@mail.gmail.com' \
    --to=bhelgaas@google.com \
    --cc=alex.williamson@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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).